mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-24 22:09:20 +02:00
gui: Add GUIUtil::ItemDelegate with keyEscapePressed signal
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
#include <QDoubleValidator>
|
||||
#include <QFileDialog>
|
||||
#include <QFont>
|
||||
#include <QKeyEvent>
|
||||
#include <QLineEdit>
|
||||
#include <QSettings>
|
||||
#include <QTextDocument> // for Qt::mightBeRichText
|
||||
@@ -927,4 +928,14 @@ void ClickableProgressBar::mouseReleaseEvent(QMouseEvent *event)
|
||||
Q_EMIT clicked(event->pos());
|
||||
}
|
||||
|
||||
bool ItemDelegate::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
if (static_cast<QKeyEvent*>(event)->key() == Qt::Key_Escape) {
|
||||
Q_EMIT keyEscapePressed();
|
||||
}
|
||||
}
|
||||
return QItemDelegate::eventFilter(object, event);
|
||||
}
|
||||
|
||||
} // namespace GUIUtil
|
||||
|
||||
Reference in New Issue
Block a user