diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-06-21 15:43:06 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-06-22 19:51:33 +0000 |
commit | aafe27dd091db7560758b727c3e28263d0a2edcd (patch) | |
tree | 982f7dae7f49d1ceb28220d3e2c91fc26c9c95d2 /src/imports/platform/qquickplatformsystemtrayicon.cpp | |
parent | ab3f016fb34b5ec0d62b8d3bf9bb6349eeea320d (diff) |
SystemTrayIcon: use widgets as a fallback
This makes system tray icons available on Windows and KDE. One more
reason to keep the module experimental. In the long run, platforms
should implement QPA system trays so that we can remove the undesired
dependency.
Change-Id: Ibc30f881525cd14091affc996104c65310c0a13e
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/imports/platform/qquickplatformsystemtrayicon.cpp')
-rw-r--r-- | src/imports/platform/qquickplatformsystemtrayicon.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/imports/platform/qquickplatformsystemtrayicon.cpp b/src/imports/platform/qquickplatformsystemtrayicon.cpp index 704a1054..258af11e 100644 --- a/src/imports/platform/qquickplatformsystemtrayicon.cpp +++ b/src/imports/platform/qquickplatformsystemtrayicon.cpp @@ -41,6 +41,10 @@ #include <QtGui/qpa/qplatformtheme.h> #include <QtGui/private/qguiapplication_p.h> +#ifdef QT_WIDGETS_LIB +#include "widgets/qwidgetplatformsystemtrayicon_p.h" +#endif + QT_BEGIN_NAMESPACE /*! @@ -117,7 +121,7 @@ QT_BEGIN_NAMESPACE \section2 Availability - SystemTrayIcon is currently \l available on the following platforms: + A native system tray icon is currently \l available on the following platforms: \list \li All window managers and independent tray implementations for X11 that implement the @@ -130,6 +134,8 @@ QT_BEGIN_NAMESPACE for showMessage() to display messages on OS X prior to 10.8 (Mountain Lion). \endlist + \input includes/widgets.qdocinc 1 + \labs \sa Menu @@ -167,6 +173,10 @@ QQuickPlatformSystemTrayIcon::QQuickPlatformSystemTrayIcon(QObject *parent) m_handle(nullptr) { m_handle = QGuiApplicationPrivate::platformTheme()->createPlatformSystemTrayIcon(); +#ifdef QT_WIDGETS_LIB + if (!m_handle) + m_handle = new QWidgetPlatformSystemTrayIcon(this); +#endif if (m_handle) { connect(m_handle, &QPlatformSystemTrayIcon::activated, this, &QQuickPlatformSystemTrayIcon::activated); connect(m_handle, &QPlatformSystemTrayIcon::messageClicked, this, &QQuickPlatformSystemTrayIcon::messageClicked); |