Fix build with -no-feature-menu

Change-Id: I8f9d5ef6b7f7102e56816677f1d3a5b5144b7083
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Paul Olav Tvete 2017-01-24 18:00:16 +01:00
parent eae92384b0
commit 056a35d02f
3 changed files with 10 additions and 2 deletions

View File

@ -85,7 +85,9 @@ QList<QWidget*> childWidgets(const QWidget *widget)
QString objectName = w->objectName(); QString objectName = w->objectName();
if (!w->isWindow() if (!w->isWindow()
&& !qobject_cast<QFocusFrame*>(w) && !qobject_cast<QFocusFrame*>(w)
#if QT_CONFIG(menu)
&& !qobject_cast<QMenu*>(w) && !qobject_cast<QMenu*>(w)
#endif
&& objectName != QLatin1String("qt_rubberband") && objectName != QLatin1String("qt_rubberband")
&& objectName != QLatin1String("qt_qmainwindow_extended_splitter")) { && objectName != QLatin1String("qt_qmainwindow_extended_splitter")) {
widgets.append(w); widgets.append(w);

View File

@ -339,10 +339,12 @@ QStringList QAccessibleToolButton::actionNames() const
{ {
QStringList names; QStringList names;
if (widget()->isEnabled()) { if (widget()->isEnabled()) {
#if QT_CONFIG(menu)
if (toolButton()->menu()) if (toolButton()->menu())
names << showMenuAction(); names << showMenuAction();
if (toolButton()->popupMode() != QToolButton::InstantPopup) if (toolButton()->popupMode() != QToolButton::InstantPopup)
names << QAccessibleButton::actionNames(); names << QAccessibleButton::actionNames();
#endif
} }
return names; return names;
} }
@ -355,12 +357,12 @@ void QAccessibleToolButton::doAction(const QString &actionName)
if (actionName == pressAction()) { if (actionName == pressAction()) {
button()->click(); button()->click();
} else if (actionName == showMenuAction()) { } else if (actionName == showMenuAction()) {
#if QT_CONFIG(menu)
if (toolButton()->popupMode() != QToolButton::InstantPopup) { if (toolButton()->popupMode() != QToolButton::InstantPopup) {
toolButton()->setDown(true); toolButton()->setDown(true);
#ifndef QT_NO_MENU
toolButton()->showMenu(); toolButton()->showMenu();
#endif
} }
#endif
} else { } else {
QAccessibleButton::doAction(actionName); QAccessibleButton::doAction(actionName);
} }

View File

@ -693,10 +693,12 @@ void QSystemTrayIconPrivate::updateIcon_sys_qpa()
void QSystemTrayIconPrivate::updateMenu_sys_qpa() void QSystemTrayIconPrivate::updateMenu_sys_qpa()
{ {
#if QT_CONFIG(menu)
if (menu) { if (menu) {
addPlatformMenu(menu); addPlatformMenu(menu);
qpa_sys->updateMenu(menu->platformMenu()); qpa_sys->updateMenu(menu->platformMenu());
} }
#endif
} }
void QSystemTrayIconPrivate::updateToolTip_sys_qpa() void QSystemTrayIconPrivate::updateToolTip_sys_qpa()
@ -729,6 +731,7 @@ void QSystemTrayIconPrivate::showMessage_sys_qpa(const QString &title,
void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const
{ {
#if QT_CONFIG(menu)
if (menu->platformMenu()) if (menu->platformMenu())
return; // The platform menu already exists. return; // The platform menu already exists.
@ -745,6 +748,7 @@ void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const
QPlatformMenu *platformMenu = qpa_sys->createMenu(); QPlatformMenu *platformMenu = qpa_sys->createMenu();
if (platformMenu) if (platformMenu)
menu->setPlatformMenu(platformMenu); menu->setPlatformMenu(platformMenu);
#endif // QT_CONFIG(menu)
} }
QT_END_NAMESPACE QT_END_NAMESPACE