From 6cff40c1959a57b52bf0be6b427b0f807e0e82b4 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 17 Feb 2017 12:50:24 +0100 Subject: Build fix for -no-feature-shortcut Change-Id: I99144b114b3c2eacb56b522b3059aa53a6bbd969 Reviewed-by: Lars Knoll --- src/widgets/dialogs/qcolordialog.cpp | 5 ++++- src/widgets/dialogs/qfiledialog.cpp | 6 ++++-- src/widgets/dialogs/qmessagebox.cpp | 4 ++-- src/widgets/dialogs/qwizard.cpp | 2 ++ 4 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src/widgets/dialogs') diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index ab3099dfe8..dbcd2d7fe2 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -2246,10 +2246,13 @@ bool QColorDialogPrivate::handleColorPickingMouseButtonRelease(QMouseEvent *e) bool QColorDialogPrivate::handleColorPickingKeyPress(QKeyEvent *e) { Q_Q(QColorDialog); +#if QT_CONFIG(shortcut) if (e->matches(QKeySequence::Cancel)) { releaseColorPicking(); q->setCurrentColor(beforeScreenColorPicking); - } else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) { + } else +#endif + if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) { q->setCurrentColor(grabScreenColor(QCursor::pos())); releaseColorPicking(); } diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index a552746385..78e304950a 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -3813,12 +3813,12 @@ void QFileDialogPrivate::_q_nativeEnterDirectory(const QUrl &directory) bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) { Q_Q(QFileDialog); - +#if QT_CONFIG(shortcut) if (event->matches(QKeySequence::Cancel)) { q->reject(); return true; } - +#endif switch (event->key()) { case Qt::Key_Backspace: _q_navigateToParent(); @@ -4020,7 +4020,9 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e) int key = e->key(); QLineEdit::keyPressEvent(e); +#if QT_CONFIG(shortcut) if (!e->matches(QKeySequence::Cancel) && key != Qt::Key_Back) +#endif e->accept(); } diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 98d070e493..3b0a71518d 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1405,7 +1405,7 @@ void QMessageBox::changeEvent(QEvent *ev) void QMessageBox::keyPressEvent(QKeyEvent *e) { Q_D(QMessageBox); - +#if QT_CONFIG(shortcut) if (e->matches(QKeySequence::Cancel)) { if (d->detectedEscapeButton) { #ifdef Q_OS_MAC @@ -1416,7 +1416,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e) } return; } - +#endif // QT_CONFIG(shortcut) #if !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT) diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 532ee4700f..5e598ba990 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -1465,8 +1465,10 @@ 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]) btns[QWizard::NextButton]->setShortcut(isVistaThemeEnabled() ? QKeySequence(Qt::ALT | Qt::Key_Right) : QKeySequence()); +#endif } void QWizardPrivate::updateButtonLayout() -- cgit v1.2.3