Commit ae06612f authored by Jean-Philippe André's avatar Jean-Philippe André

Qt: really close ExtensionDialog when user presses ESC

parent 92432ec2
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <QComboBox> #include <QComboBox>
#include <QCloseEvent> #include <QCloseEvent>
#include <QCoreApplication> #include <QCoreApplication>
#include <QKeyEvent>
#include "util/customwidgets.hpp" #include "util/customwidgets.hpp"
ExtensionsDialogProvider *ExtensionsDialogProvider::instance = NULL; ExtensionsDialogProvider *ExtensionsDialogProvider::instance = NULL;
...@@ -681,6 +682,21 @@ void ExtensionDialog::closeEvent( QCloseEvent *event ) ...@@ -681,6 +682,21 @@ void ExtensionDialog::closeEvent( QCloseEvent *event )
extension_DialogClosed( p_dialog ); extension_DialogClosed( p_dialog );
} }
/** Grab some keyboard input (ESC, ...) and handle actions manually */
void ExtensionDialog::keyPressEvent( QKeyEvent *event )
{
assert( p_dialog != NULL );
switch( event->key() )
{
case Qt::Key_Escape:
close();
return;
default:
QDialog::keyPressEvent( event );
return;
}
}
void ExtensionDialog::parentDestroyed() void ExtensionDialog::parentDestroyed()
{ {
msg_Dbg( p_intf, "About to destroy dialog '%s'", p_dialog->psz_title ); msg_Dbg( p_intf, "About to destroy dialog '%s'", p_dialog->psz_title );
......
...@@ -34,6 +34,7 @@ class QObject; ...@@ -34,6 +34,7 @@ class QObject;
class QGridLayout; class QGridLayout;
class QSignalMapper; class QSignalMapper;
class QCloseEvent; class QCloseEvent;
class QKeyEvent;
class ExtensionsDialogProvider; class ExtensionsDialogProvider;
class ExtensionDialog; class ExtensionDialog;
...@@ -106,6 +107,7 @@ private: ...@@ -106,6 +107,7 @@ private:
protected: protected:
virtual void closeEvent( QCloseEvent* ); virtual void closeEvent( QCloseEvent* );
virtual void keyPressEvent( QKeyEvent* );
private slots: private slots:
int TriggerClick( QObject *object ); int TriggerClick( QObject *object );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment