aboutsummaryrefslogtreecommitdiff
path: root/include/eventfilters.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/eventfilters.h')
-rw-r--r--include/eventfilters.h36
1 files changed, 0 insertions, 36 deletions
diff --git a/include/eventfilters.h b/include/eventfilters.h
deleted file mode 100644
index 7847608d..00000000
--- a/include/eventfilters.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef EVENTFILTERS_H
-#define EVENTFILTERS_H
-
-#include <QEvent>
-#include <QLineEdit>
-
-class AOLineEditFilter : public QObject
-{
- Q_OBJECT
-public:
- bool preserve_selection = false;
-
-protected:
- bool eventFilter(QObject *obj, QEvent *event) override {
- QLineEdit *lineEdit = qobject_cast<QLineEdit *>(obj);
- if (event->type() == QEvent::FocusOut && lineEdit != nullptr && preserve_selection) { // lost focus
- int start = lineEdit->selectionStart();
- #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
- int len = lineEdit->selectionLength();
- #else
- int len = lineEdit->selectedText().length();
- #endif
- if (start != -1 && len != -1) {
- lineEdit->setSelection(start, len);\
- return true;
- }
- }
- return false;
- }
-signals:
- void double_clicked();
-};
-
-
-
-#endif // EVENTFILTERS_H