forked from qt-creator/qt-creator
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: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -30,13 +30,14 @@
|
|||||||
#include "wizard.h"
|
#include "wizard.h"
|
||||||
#include "hostosinfo.h"
|
#include "hostosinfo.h"
|
||||||
|
|
||||||
#include <QMap>
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QMap>
|
||||||
|
#include <QStyle>
|
||||||
|
#include <QVBoxLayout>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QStyle>
|
|
||||||
|
|
||||||
/*! \class Utils::Wizard
|
/*! \class Utils::Wizard
|
||||||
|
|
||||||
@@ -376,6 +377,18 @@ bool Wizard::validateCurrentPage()
|
|||||||
return QWizard::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)
|
void Wizard::_q_currentPageChanged(int pageId)
|
||||||
{
|
{
|
||||||
Q_D(Wizard);
|
Q_D(Wizard);
|
||||||
|
|||||||
@@ -72,6 +72,9 @@ signals:
|
|||||||
void nextClicked(); /* workaround for QWizard behavior where page->initialize is
|
void nextClicked(); /* workaround for QWizard behavior where page->initialize is
|
||||||
* called before currentIdChanged */
|
* called before currentIdChanged */
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool event(QEvent *event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void _q_currentPageChanged(int pageId);
|
void _q_currentPageChanged(int pageId);
|
||||||
void _q_pageAdded(int pageId);
|
void _q_pageAdded(int pageId);
|
||||||
|
|||||||
Reference in New Issue
Block a user