summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qguiapplication.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r--src/gui/kernel/qguiapplication.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 1e27b5b7c9..0f3f8d8ff2 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -133,6 +133,8 @@ enum ApplicationResourceFlags
static unsigned applicationResourceFlags = 0;
+QIcon *QGuiApplicationPrivate::app_icon = 0;
+
QString *QGuiApplicationPrivate::platform_name = 0;
QString *QGuiApplicationPrivate::displayName = 0;
@@ -523,6 +525,8 @@ QGuiApplication::~QGuiApplication()
d->cursor_list.clear();
#endif
+ delete QGuiApplicationPrivate::app_icon;
+ QGuiApplicationPrivate::app_icon = 0;
delete QGuiApplicationPrivate::platform_name;
QGuiApplicationPrivate::platform_name = 0;
delete QGuiApplicationPrivate::displayName;
@@ -2596,6 +2600,35 @@ void QGuiApplicationPrivate::notifyActiveWindowChange(QWindow *)
{
}
+/*!
+ \property QGuiApplication::windowIcon
+ \brief the default window icon
+
+ \sa QWindow::setIcon(), {Setting the Application Icon}
+*/
+QIcon QGuiApplication::windowIcon()
+{
+ return QGuiApplicationPrivate::app_icon ? *QGuiApplicationPrivate::app_icon : QIcon();
+}
+
+void QGuiApplication::setWindowIcon(const QIcon &icon)
+{
+ if (!QGuiApplicationPrivate::app_icon)
+ QGuiApplicationPrivate::app_icon = new QIcon();
+ *QGuiApplicationPrivate::app_icon = icon;
+ if (QGuiApplicationPrivate::is_app_running && !QGuiApplicationPrivate::is_app_closing)
+ QGuiApplicationPrivate::self->notifyWindowIconChanged();
+}
+
+void QGuiApplicationPrivate::notifyWindowIconChanged()
+{
+ QEvent ev(QEvent::ApplicationWindowIconChange);
+ const QWindowList list = QGuiApplication::topLevelWindows();
+ for (int i = 0; i < list.size(); ++i)
+ QCoreApplication::sendEvent(list.at(i), &ev);
+}
+
+
/*!
\property QGuiApplication::quitOnLastWindowClosed