From 51e7aeb29bc804b904656083d4317c8239c6f8b0 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Thu, 6 Dec 2012 14:54:01 +0100 Subject: [PATCH] Fix compile with -DQT_NO_SYSTEMTRAYICON Change-Id: Icca0bef7efca77a841b30f40692144663e7ae913 Reviewed-by: Marc Mutz --- examples/widgets/desktop/systray/main.cpp | 25 ++++++++++++++++++++- examples/widgets/desktop/systray/window.cpp | 5 +++++ examples/widgets/desktop/systray/window.h | 5 +++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/examples/widgets/desktop/systray/main.cpp b/examples/widgets/desktop/systray/main.cpp index bb81bb78e46..ece04524b8b 100644 --- a/examples/widgets/desktop/systray/main.cpp +++ b/examples/widgets/desktop/systray/main.cpp @@ -39,8 +39,10 @@ ****************************************************************************/ #include -#include +#ifndef QT_NO_SYSTEMTRAYICON + +#include #include "window.h" int main(int argc, char *argv[]) @@ -61,3 +63,24 @@ int main(int argc, char *argv[]) window.show(); return app.exec(); } + +#else + +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + QString text("QSystemTrayIcon is not supported on this platform"); + + QLabel *label = new QLabel(text); + label->setWordWrap(true); + + label->show(); + qDebug() << text; + + app.exec(); +} + +#endif diff --git a/examples/widgets/desktop/systray/window.cpp b/examples/widgets/desktop/systray/window.cpp index 8de1f5843e1..a7ea3b471ee 100644 --- a/examples/widgets/desktop/systray/window.cpp +++ b/examples/widgets/desktop/systray/window.cpp @@ -39,6 +39,9 @@ ****************************************************************************/ #include "window.h" + +#ifndef QT_NO_SYSTEMTRAYICON + #include #include @@ -265,3 +268,5 @@ void Window::createTrayIcon() trayIcon = new QSystemTrayIcon(this); trayIcon->setContextMenu(trayIconMenu); } + +#endif diff --git a/examples/widgets/desktop/systray/window.h b/examples/widgets/desktop/systray/window.h index 2c338127785..08919e8a496 100644 --- a/examples/widgets/desktop/systray/window.h +++ b/examples/widgets/desktop/systray/window.h @@ -42,6 +42,9 @@ #define WINDOW_H #include + +#ifndef QT_NO_SYSTEMTRAYICON + #include QT_BEGIN_NAMESPACE @@ -109,4 +112,6 @@ private: }; //! [0] +#endif // QT_NO_SYSTEMTRAYICON + #endif