21 #ifndef SEARCHABLEVIEW_H
22 #define SEARCHABLEVIEW_H
24 #include "Gui/Utils/Widgets/WidgetTemplate.h"
25 #include "Gui/Utils/SearchableWidget/SelectionView.h"
26 #include "Gui/Utils/SearchableWidget/SearchableModel.h"
27 #include "Utils/Pimpl.h"
34 class QAbstractItemView;
35 class QItemSelectionModel;
36 class ExtraTriggerMap;
53 bool isActive()
const;
55 bool handleKeyPress(QKeyEvent* e);
58 void lineEditChanged(
const QString& str);
60 void selectPrevious();
74 enum class SearchDirection : unsigned char
85 QAbstractItemView* view()
const;
86 virtual int viewportHeight()
const;
87 virtual int viewportWidth()
const;
89 int setSearchstring(
const QString& str);
90 void selectNextMatch(
const QString& str);
91 void selectPreviousMatch(
const QString& str);
92 bool isMinisearcherActive()
const;
96 virtual QModelIndex matchIndex(
const QString& str, SearchDirection direction)
const;
97 virtual void selectMatch(
const QString& str, SearchDirection direction);
98 bool handleKeyPress(QKeyEvent* e)
override;
102 template<
typename View,
typename Model>
108 using View::setModel;
109 using SearchableViewInterface::setSearchModel;
119 virtual void setSearchableModel(Model* model)
121 View::setModel(model);
122 SearchableViewInterface::setSearchModel(model);
127 return (View::model() ==
nullptr) ? 0 : View::model()->rowCount();
131 void keyPressEvent(QKeyEvent* e)
override
133 bool processed = handleKeyPress(e);
138 View::keyPressEvent(e);
146 #endif // SEARCHABLEVIEW_H