Commit 82296d32 authored by Eike Ziller's avatar Eike Ziller
Browse files

Wizards: Close wizards with escape



Since they are no longer modal, the "return to editor" shortcut was
executed for the escape key instead.

Change-Id: I4505f49105ad46f7c5f9e0257e77a8ca4652ef06
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent bef7181e
......@@ -30,13 +30,14 @@
#include "wizard.h"
#include "hostosinfo.h"
#include <QMap>
#include <QHash>
#include <QVariant>
#include <QKeyEvent>
#include <QLabel>
#include <QVBoxLayout>
#include <QMap>
#include <QStyle>
#include <QVBoxLayout>
#include <QVariant>
/*! \class Utils::Wizard
......@@ -376,6 +377,18 @@ bool Wizard::validateCurrentPage()
return QWizard::validateCurrentPage();
}
bool Wizard::event(QEvent *event)
{
if (event->type() == QEvent::ShortcutOverride) {
auto ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
ke->accept();
return true;
}
}
return QWizard::event(event);
}
void Wizard::_q_currentPageChanged(int pageId)
{
Q_D(Wizard);
......
......@@ -72,6 +72,9 @@ signals:
void nextClicked(); /* workaround for QWizard behavior where page->initialize is
* called before currentIdChanged */
protected:
bool event(QEvent *event);
private slots:
void _q_currentPageChanged(int pageId);
void _q_pageAdded(int pageId);
......
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