diff options
author | Martin Gräßlin <mgraesslin@kde.org> | 2014-01-29 10:57:34 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-17 16:47:05 +0100 |
commit | 824f080468b02ad0a82e42bbd120b55c0bce1769 (patch) | |
tree | ba6a531b43016bb0f31c4e674a7ba2922d7c5623 /src/gui/kernel/kernel.pri | |
parent | 6aef733a7a80cc937ba67c982a41a7338379d401 (diff) |
Allow QPlatformSystemTrayIcon to create the QPlatformMenu
In case the QPlatformTheme does not provide a QPlatformMenu the
QPlatformSystemTrayIcon is not able to forward the menu because the
QPlatformMenu pointer passed to updateMenu is always null. Providing a
QPlatformMenu in the QPlatformTheme implementation should not be a
requirement for having the menu in the system tray icon. There are
cases where no QPlatformMenu should be created by the theme, e.g. if
the X11 implementation of QSystemTrayIcon gets provided by the xcb
plugin.
The change adds a virtual method to QPlatformSystemTrayIcon to create
a QPlatformMenu. This method is called from the QPA implementation of
QSystemTrayIcon if the QMenu's platformMenu is not present. Thus the
system tray icon is able to provide a custom implementation of the
menu. This gets installed through a new internal method in QMenu to set
the platform menu. It creates the required connections and sync the
state to the QMenu to the newly created QPlatformMenu.
Last but not least QPlatformMenu is extended by a method to create a
QPlatformMenuItem. The default implementation delegates to the platform
theme. This allows to provide the menu item implementation for the
system tray icon without providing the QPlatformMenuItem through the
platform theme.
Change-Id: I17234bd8bcf8c05f8bd786feff0cf8f860430e82
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/gui/kernel/kernel.pri')
-rw-r--r-- | src/gui/kernel/kernel.pri | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index d9bcbf316f..e9e4a1d818 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -121,7 +121,8 @@ SOURCES += \ kernel/qplatformservices.cpp \ kernel/qplatformscreenpageflipper.cpp \ kernel/qplatformsystemtrayicon_qpa.cpp \ - kernel/qplatformsessionmanager.cpp + kernel/qplatformsessionmanager.cpp \ + kernel/qplatformmenu.cpp contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) { HEADERS += \ |