diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index b2f087136..60a5ced3b 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -212,6 +212,20 @@ void DialogTool::showEvent(QShowEvent *event) ShowVisualization(); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogTool::keyPressEvent(QKeyEvent *event) +{ + switch (event->key()) + { + case Qt::Key_Escape: + DialogRejected(); + return; // After reject the dialog will be destroyed, exit imidiately + default: + break; + } + QDialog::keyPressEvent ( event ); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogTool::FillComboBoxPiecesList(QComboBox *box, const QVector &list) { diff --git a/src/libs/vtools/dialogs/tools/dialogtool.h b/src/libs/vtools/dialogs/tools/dialogtool.h index ee80baec3..e8f1e948f 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.h +++ b/src/libs/vtools/dialogs/tools/dialogtool.h @@ -205,6 +205,7 @@ protected: virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE; virtual void showEvent( QShowEvent *event ) Q_DECL_OVERRIDE; + virtual void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE; void FillComboBoxPiecesList(QComboBox *box, const QVector &list); void FillComboBoxPoints(QComboBox *box, FillComboBox rule = FillComboBox::Whole,