diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-09-23 14:49:07 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-09-25 15:14:36 +0200 |
commit | 8810f82f3f9b3fe35d82fb842a5a21a098b2343f (patch) | |
tree | 71e1038f2822feb126474394d8ed3bea89c00f56 /src/widgets | |
parent | c3faeb852866a2fc8ae9cd6f8cf91947bd42b538 (diff) |
QWizard/Aerostyle: Fix "&Next" shortcut
The fix for QTBUG-35203 set the Alt+Right shortcut on the next
button, clobbering the Alt+N shortcut from parsing the text (similar
for other languages). Add a separate shortcut for Alt+Right since a
button may not have several shortcuts.
Amends 6714196f45fbae755b26a4b2406a7bbe066084dc.
Fixes: QTBUG-78604
Change-Id: I1367da739c35fbd011d11f850c9bc3915113c644
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/dialogs/qwizard.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index b4a5904779..5ba48aeff3 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -55,10 +55,14 @@ #if QT_CONFIG(lineedit) #include "qlineedit.h" #endif +#include <qpointer.h> #include "qpainter.h" #include "qwindow.h" #include "qpushbutton.h" #include "qset.h" +#if QT_CONFIG(shortcut) +# include "qshortcut.h" +#endif #include "qstyle.h" #include "qvarlengtharray.h" #if defined(Q_OS_MACX) @@ -631,6 +635,9 @@ public: #if QT_CONFIG(style_windowsvista) QVistaHelper *vistaHelper = nullptr; +# if QT_CONFIG(shortcut) + QPointer<QShortcut> vistaNextShortcut; +# endif bool vistaInitPending = true; QVistaHelper::VistaState vistaState = QVistaHelper::Dirty; bool vistaStateChanged = false; @@ -1417,10 +1424,17 @@ void QWizardPrivate::updateButtonTexts() // Vista: Add shortcut for 'next'. Note: native dialogs use ALT-Right // even in RTL mode, so do the same, even if it might be counter-intuitive. // The shortcut for 'back' is set in class QVistaBackButton. -#if QT_CONFIG(shortcut) - if (btns[QWizard::NextButton] && isVistaThemeEnabled()) - btns[QWizard::NextButton]->setShortcut(QKeySequence(Qt::ALT | Qt::Key_Right)); -#endif +#if QT_CONFIG(shortcut) && QT_CONFIG(style_windowsvista) + if (btns[QWizard::NextButton] && isVistaThemeEnabled()) { + if (vistaNextShortcut.isNull()) { + vistaNextShortcut = + new QShortcut(QKeySequence(Qt::ALT | Qt::Key_Right), + btns[QWizard::NextButton], SLOT(animateClick())); + } + } else { + delete vistaNextShortcut; + } +#endif // shortcut && style_windowsvista } void QWizardPrivate::updateButtonLayout() |