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();
if (!w->isWindow()
&& !qobject_cast<QFocusFrame*>(w)
#if QT_CONFIG(menu)
&& !qobject_cast<QMenu*>(w)
#endif
&& objectName != QLatin1String("qt_rubberband")
&& objectName != QLatin1String("qt_qmainwindow_extended_splitter")) {
widgets.append(w);

View File

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

View File

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