Fix building with -no-feature-shortcut

Change-Id: I7576055a6d81d6a7a075ebff16ca6b0ced4e984e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Joni Poikelin 2018-05-03 19:31:53 +03:00
parent 8f7dcba204
commit 3a912e92bb
3 changed files with 12 additions and 0 deletions

View File

@ -855,8 +855,12 @@ bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, con
sendExtendedPressRelease(receiver, qtKey, Qt::KeyboardModifier(state), 0, 0, 0);
// QTBUG-43343: Make sure to return false if Qt does not handle the key, otherwise,
// the keys are not passed to the active media player.
# if QT_CONFIG(shortcut)
const QKeySequence sequence(Qt::Modifier(state) + qtKey);
return QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(sequence);
# else
return false;
# endif
#else
Q_UNREACHABLE();
return false;

View File

@ -390,6 +390,7 @@ void QWindowsMenuItem::setChecked(bool isChecked)
menuItemSetChangeState(parentMenuHandle(), m_id, FALSE, m_checked, MF_CHECKED, MF_UNCHECKED);
}
#if QT_CONFIG(shortcut)
void QWindowsMenuItem::setShortcut(const QKeySequence &shortcut)
{
qCDebug(lcQpaMenus) << __FUNCTION__ << '(' << shortcut << ')' << this;
@ -399,6 +400,7 @@ void QWindowsMenuItem::setShortcut(const QKeySequence &shortcut)
if (m_parentMenu != nullptr)
updateText();
}
#endif
void QWindowsMenuItem::setEnabled(bool enabled)
{
@ -441,10 +443,12 @@ UINT QWindowsMenuItem::state() const
QString QWindowsMenuItem::nativeText() const
{
QString result = m_text;
#if QT_CONFIG(shortcut)
if (!m_shortcut.isEmpty()) {
result += QLatin1Char('\t');
result += m_shortcut.toString(QKeySequence::NativeText);
}
#endif
return result;
}
@ -894,8 +898,10 @@ void QWindowsMenuItem::formatDebug(QDebug &d) const
d << ", subMenu=" << static_cast<const void *>(m_subMenu);
d << ", tag=" << showbase << hex
<< tag() << noshowbase << dec << ", id=" << m_id;
#if QT_CONFIG(shortcut)
if (!m_shortcut.isEmpty())
d << ", shortcut=" << m_shortcut;
#endif
if (m_visible)
d << " [visible]";
if (m_enabled)

View File

@ -79,7 +79,9 @@ QVistaBackButton::QVistaBackButton(QWidget *widget)
{
setFocusPolicy(Qt::NoFocus);
// Native dialogs use ALT-Left even in RTL mode, so do the same, even if it might be counter-intuitive.
#if QT_CONFIG(shortcut)
setShortcut(QKeySequence(Qt::ALT | Qt::Key_Left));
#endif
}
QSize QVistaBackButton::sizeHint() const