summaryrefslogtreecommitdiff
path: root/src/filterwidget.h
diff options
context:
space:
mode:
authorAl <gabriel.cortesi@outlook.com>2019-06-01 09:54:09 +0200
committerGitHub <noreply@github.com>2019-06-01 09:54:09 +0200
commitf00314442b9c3c28e846c64da3c3f776e50656de (patch)
tree371f52175eaa83db0b3b354b95d382bd7080ca38 /src/filterwidget.h
parent41f8da011d1df7a368e3fb73f972cee1f4efd0c0 (diff)
parentd2eb890f2b9df13c402db6adeaafa7e3f4a7d736 (diff)
Merge pull request #740 from isanae/new-conflict-list
New conflict list, new "go to" conflict menu item
Diffstat (limited to 'src/filterwidget.h')
-rw-r--r--src/filterwidget.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/filterwidget.h b/src/filterwidget.h
new file mode 100644
index 00000000..4fee5983
--- /dev/null
+++ b/src/filterwidget.h
@@ -0,0 +1,33 @@
+#ifndef FILTERWIDGET_H
+#define FILTERWIDGET_H
+
+class EventFilter;
+
+class FilterWidget
+{
+public:
+ std::function<void ()> changed;
+
+ FilterWidget();
+
+ void set(QLineEdit* edit);
+ void clear();
+
+ bool matches(std::function<bool (const QString& what)> pred) const;
+
+private:
+ QLineEdit* m_edit;
+ EventFilter* m_eventFilter;
+ QToolButton* m_clear;
+ QString m_text;
+
+ void unhook();
+ void createClear();
+ void hookEvents();
+ void repositionClearButton();
+
+ void onTextChanged();
+ void onResized();
+};
+
+#endif // FILTERWIDGET_H