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 @@
#include <QComboBox>
#include <QCloseEvent>
#include <QCoreApplication>
#include <QKeyEvent>
#include "util/customwidgets.hpp"
ExtensionsDialogProvider *ExtensionsDialogProvider::instance = NULL;
......@@ -681,6 +682,21 @@ void ExtensionDialog::closeEvent( QCloseEvent *event )
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()
{
msg_Dbg( p_intf, "About to destroy dialog '%s'", p_dialog->psz_title );
......
......@@ -34,6 +34,7 @@ class QObject;
class QGridLayout;
class QSignalMapper;
class QCloseEvent;
class QKeyEvent;
class ExtensionsDialogProvider;
class ExtensionDialog;
......@@ -106,6 +107,7 @@ private:
protected:
virtual void closeEvent( QCloseEvent* );
virtual void keyPressEvent( QKeyEvent* );
private slots:
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