From 074224eca0088a261418b53a1cc64a5053f89807 Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Sat, 26 May 2012 02:12:06 +0200 Subject: Implement QWidgetPrivate::setWindowIcon_sys() * The widgets icon are correctly set, through the QPA plugins * Removing QTLWExtra::iconPixmap that was only used in some platforms in Qt 4.7, so if that wariable is still needed somewhere, it sould be declared in the concerned QPA plugins Change-Id: I85f50726cce3578b66c09c327767111f09935075 Reviewed-by: Girish Ramakrishnan --- src/widgets/kernel/qwidget.cpp | 8 ++------ src/widgets/kernel/qwidget_p.h | 3 +-- src/widgets/kernel/qwidget_qpa.cpp | 5 ++++- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 1852c5f648..454ffd5eb7 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1336,7 +1336,8 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) // need to force the resting of the icon after changing parents if (testAttribute(Qt::WA_SetWindowIcon)) - d->setWindowIcon_sys(true); + d->setWindowIcon_sys(); + if (isWindow() && !d->topData()->iconText.isEmpty()) d->setWindowIconText_helper(d->topData()->iconText); if (isWindow() && !d->topData()->caption.isEmpty()) @@ -1520,7 +1521,6 @@ void QWidgetPrivate::createTLExtra() if (!extra->topextra) { QTLWExtra* x = extra->topextra = new QTLWExtra; x->icon = 0; - x->iconPixmap = 0; x->backingStore = 0; x->sharedPainter = 0; x->incw = x->inch = 0; @@ -1604,7 +1604,6 @@ void QWidgetPrivate::deleteExtra() deleteTLSysExtra(); extra->topextra->backingStoreTracker.destroy(); delete extra->topextra->icon; - delete extra->topextra->iconPixmap; delete extra->topextra->backingStore; delete extra->topextra; } @@ -5660,9 +5659,6 @@ void QWidget::setWindowIcon(const QIcon &icon) d->extra->topextra->icon = new QIcon(); *d->extra->topextra->icon = icon; - delete d->extra->topextra->iconPixmap; - d->extra->topextra->iconPixmap = 0; - d->setWindowIcon_sys(); d->setWindowIcon_helper(); } diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 274a61eb9f..78844960bd 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -155,7 +155,6 @@ struct QTLWExtra { // Regular pointers (keep them together to avoid gaps on 64 bits architectures). QIcon *icon; // widget icon - QPixmap *iconPixmap; QWidgetBackingStoreTracker backingStoreTracker; QBackingStore *backingStore; QPainter *sharedPainter; @@ -421,7 +420,7 @@ public: bool close_helper(CloseMode mode); void setWindowIcon_helper(); - void setWindowIcon_sys(bool forceReset = false); + void setWindowIcon_sys(); void setWindowOpacity_sys(qreal opacity); void adjustQuitOnCloseAttribute(); diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 9d444fee8f..20f1384d0a 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -328,8 +328,11 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption) } -void QWidgetPrivate::setWindowIcon_sys(bool /*forceReset*/) +void QWidgetPrivate::setWindowIcon_sys() { + Q_Q(QWidget); + if (QWindow *window = q->windowHandle()) + window->setWindowIcon(q->windowIcon()); } void QWidgetPrivate::setWindowIconText_sys(const QString &iconText) -- cgit v1.2.3