File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 49
49
#include < QDoubleValidator>
50
50
#include < QFileDialog>
51
51
#include < QFont>
52
+ #include < QKeyEvent>
52
53
#include < QLineEdit>
53
54
#include < QSettings>
54
55
#include < QTextDocument> // for Qt::mightBeRichText
@@ -927,4 +928,14 @@ void ClickableProgressBar::mouseReleaseEvent(QMouseEvent *event)
927
928
Q_EMIT clicked (event->pos ());
928
929
}
929
930
931
+ bool ItemDelegate::eventFilter (QObject *object, QEvent *event)
932
+ {
933
+ if (event->type () == QEvent::KeyPress) {
934
+ if (static_cast <QKeyEvent*>(event)->key () == Qt::Key_Escape) {
935
+ Q_EMIT keyEscapePressed ();
936
+ }
937
+ }
938
+ return QItemDelegate::eventFilter (object, event);
939
+ }
940
+
930
941
} // namespace GUIUtil
Original file line number Diff line number Diff line change 10
10
11
11
#include < QEvent>
12
12
#include < QHeaderView>
13
+ #include < QItemDelegate>
13
14
#include < QMessageBox>
14
15
#include < QObject>
15
16
#include < QProgressBar>
@@ -232,6 +233,18 @@ namespace GUIUtil
232
233
233
234
typedef ClickableProgressBar ProgressBar;
234
235
236
+ class ItemDelegate : public QItemDelegate
237
+ {
238
+ Q_OBJECT
239
+ public:
240
+ ItemDelegate (QObject* parent) : QItemDelegate(parent) {}
241
+
242
+ Q_SIGNALS:
243
+ void keyEscapePressed ();
244
+
245
+ private:
246
+ bool eventFilter (QObject *object, QEvent *event);
247
+ };
235
248
} // namespace GUIUtil
236
249
237
250
#endif // BITCOIN_QT_GUIUTIL_H
You can’t perform that action at this time.
0 commit comments