diff options
author | David Faure <david.faure@kdab.com> | 2014-02-01 14:17:51 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-12 20:12:17 +0100 |
commit | f42bd772f8110dba13d209d81d8eed0077772185 (patch) | |
tree | 2c5582727b3684e71887a2be594c2beda7f0c7db /src/gui/kernel/qwindow.cpp | |
parent | bf82245bafad25403aeb7129ebe1fc419c6f4ad9 (diff) |
Move setWindowIcon() up to QGuiApplication.
[ChangeLog][QtGui][QWindow]QWindow::icon() now defaults to the application
icon, which can be set with QGuiApplication::setWindowIcon().
Change-Id: Id1974e5cda81775e515c14b294f67fb99351c6c9
Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 2382764183..51548aa371 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -776,6 +776,8 @@ void QWindow::setIcon(const QIcon &icon) d->windowIcon = icon; if (d->platformWindow) d->platformWindow->setWindowIcon(icon); + QEvent e(QEvent::WindowIconChange); + QCoreApplication::sendEvent(this, &e); } /*! @@ -786,6 +788,8 @@ void QWindow::setIcon(const QIcon &icon) QIcon QWindow::icon() const { Q_D(const QWindow); + if (d->windowIcon.isNull()) + return QGuiApplication::windowIcon(); return d->windowIcon; } @@ -1940,6 +1944,10 @@ bool QWindow::event(QEvent *ev) hideEvent(static_cast<QHideEvent *>(ev)); break; + case QEvent::ApplicationWindowIconChange: + setIcon(icon()); + break; + case QEvent::WindowStateChange: { Q_D(QWindow); emit windowStateChanged(d->windowState); |