Build fix for -no-feature-shortcut

Change-Id: I99144b114b3c2eacb56b522b3059aa53a6bbd969
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
bb10
Paul Olav Tvete 2017-02-17 12:50:24 +01:00
parent 585bb526c4
commit 6cff40c195
10 changed files with 28 additions and 10 deletions

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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)

View File

@ -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()

View File

@ -462,11 +462,13 @@ bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e)
case QEvent::KeyPress:
{
QKeyEvent* kev = (QKeyEvent*)e;
#if QT_CONFIG(shortcut)
if (kev->matches(QKeySequence::Cancel)) {
QWhatsThis::leaveWhatsThisMode();
return true;
} else if (customWhatsThis) {
} else
#endif
if (customWhatsThis) {
return false;
} else if (kev->key() == Qt::Key_Menu ||
(kev->key() == Qt::Key_F10 &&

View File

@ -1347,11 +1347,12 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e)
}
// default implementation for keys not handled by the widget when popup is open
#if QT_CONFIG(shortcut)
if (ke->matches(QKeySequence::Cancel)) {
d->popup->hide();
return true;
}
#endif
switch (key) {
#ifdef QT_KEYPAD_NAVIGATION
case Qt::Key_Select:

View File

@ -770,8 +770,10 @@ bool QCalendarTextNavigator::eventFilter(QObject *o, QEvent *e)
applyDate();
emit editingFinished();
removeDateLabel();
#if QT_CONFIG(shortcut)
} else if (ke->matches(QKeySequence::Cancel)) {
removeDateLabel();
#endif
} else if (e->type() == QEvent::KeyPress) {
createDateLabel();
m_dateValidator->handleKeyEvent(ke);
@ -3107,12 +3109,14 @@ void QCalendarWidget::resizeEvent(QResizeEvent * event)
*/
void QCalendarWidget::keyPressEvent(QKeyEvent * event)
{
#if QT_CONFIG(shortcut)
Q_D(QCalendarWidget);
if (d->yearEdit->isVisible()&& event->matches(QKeySequence::Cancel)) {
d->yearEdit->setValue(yearShown());
d->_q_yearEditingFinished();
return;
}
#endif
QWidget::keyPressEvent(event);
}

View File

@ -682,10 +682,12 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e)
combo->hidePopup();
return true;
default:
#if QT_CONFIG(shortcut)
if (keyEvent->matches(QKeySequence::Cancel)) {
combo->hidePopup();
return true;
}
#endif
break;
}
break;

View File

@ -2662,11 +2662,13 @@ void QCalendarPopup::mouseReleaseEvent(QMouseEvent*)
bool QCalendarPopup::event(QEvent *event)
{
#if QT_CONFIG(shortcut)
if (event->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
if (keyEvent->matches(QKeySequence::Cancel))
dateChanged = false;
}
#endif
return QWidget::event(event);
}

View File

@ -410,9 +410,9 @@ QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardBut
qWarning("QDialogButtonBox::createButton: Invalid ButtonRole, button not added");
else
addButton(button, static_cast<QDialogButtonBox::ButtonRole>(role), doLayout);
#if QT_CONFIG(shortcut)
button->setShortcut(QGuiApplicationPrivate::platformTheme()->standardButtonShortcut(sbutton));
#endif
return button;
}