##// END OF EJS Templates
Some progress on new Catalogue GUI, can display most of items, still lack edition and link to SciQLop...
Some progress on new Catalogue GUI, can display most of items, still lack edition and link to SciQLop Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>

File last commit:

r1328:eb278710ae3b
r1408:45ab63a4480c
Show More
FilteringAction.cpp
27 lines | 827 B | text/x-c | CppLexer
/ gui / src / Actions / FilteringAction.cpp
#include "Actions/FilteringAction.h"
#include <QLineEdit>
struct FilteringAction::FilteringActionPrivate {
QLineEdit *m_FilterLineEdit;
QVector<QAction *> m_FilteredActions;
};
FilteringAction::FilteringAction(QWidget *parent)
: QWidgetAction(parent), impl{spimpl::make_unique_impl<FilteringActionPrivate>()}
{
impl->m_FilterLineEdit = new QLineEdit(parent);
setDefaultWidget(impl->m_FilterLineEdit);
connect(impl->m_FilterLineEdit, &QLineEdit::textEdited, [this](auto text) {
for (auto action : impl->m_FilteredActions) {
auto match = action->text().contains(text, Qt::CaseInsensitive);
action->setVisible(match);
}
});
}
void FilteringAction::addActionToFilter(QAction *action)
{
impl->m_FilteredActions << action;
}