diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-05-04 09:11:13 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-04 09:20:07 +0200 |
commit | e40b13459bb382732c1f0349bd1274b9ba55078b (patch) | |
tree | c6f1890ab63d28995c9b0a9300b1b4de1dc82ec8 | |
parent | fde021c6d73f1785fb4763c01f3d5ed691373e33 (diff) |
Windows: Fix Vista style for use with QProxyStyle.
Cleanup the treeview helper window in case XP style cleans
the handle map.
This fixes the drawing of the PE_IndicatorBranch primitives
in Qt Creator.
Task-number: QTBUG-25395
Change-Id: Iba561709e3d4032a59690c7b9163fb69bfa98619
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
-rw-r--r-- | src/widgets/styles/qwindowsvistastyle.cpp | 18 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsvistastyle_p.h | 1 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsxpstyle_p.h | 1 |
3 files changed, 17 insertions, 3 deletions
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 138f5dbf17..6fce426dd3 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -2469,7 +2469,12 @@ void QWindowsVistaStyle::unpolish(QWidget *widget) { QWindowsXPStyle::unpolish(widget); - QWindowsVistaStylePrivate *d = const_cast<QWindowsVistaStylePrivate*>(d_func()); + QWindowsVistaStylePrivate *d = d_func(); + // Delete the tree view helper in case the XP style cleaned the + // theme handle map due to a theme or QStyle change (QProxyStyle). + if (!QWindowsXPStylePrivate::hasTheme(QWindowsXPStylePrivate::TreeViewTheme)) + d->cleanupTreeViewTheming(); + d->stopAnimation(widget); #ifndef QT_NO_LINEEDIT @@ -2542,8 +2547,7 @@ QWindowsVistaStylePrivate::QWindowsVistaStylePrivate() : QWindowsVistaStylePrivate::~QWindowsVistaStylePrivate() { qDeleteAll(animations); - if (m_treeViewHelper) - DestroyWindow(m_treeViewHelper); + cleanupTreeViewTheming(); } void QWindowsVistaStylePrivate::timerEvent() @@ -2694,6 +2698,14 @@ bool QWindowsVistaStylePrivate::initTreeViewTheming() return QWindowsXPStylePrivate::createTheme(QWindowsXPStylePrivate::TreeViewTheme, m_treeViewHelper); } +void QWindowsVistaStylePrivate::cleanupTreeViewTheming() +{ + if (m_treeViewHelper) { + DestroyWindow(m_treeViewHelper); + m_treeViewHelper = 0; + } +} + /*! \internal */ diff --git a/src/widgets/styles/qwindowsvistastyle_p.h b/src/widgets/styles/qwindowsvistastyle_p.h index 78282d01ef..cdb1227319 100644 --- a/src/widgets/styles/qwindowsvistastyle_p.h +++ b/src/widgets/styles/qwindowsvistastyle_p.h @@ -208,6 +208,7 @@ public: private: bool initTreeViewTheming(); + void cleanupTreeViewTheming(); QList <QWindowsVistaAnimation*> animations; QBasicTimer animationTimer; diff --git a/src/widgets/styles/qwindowsxpstyle_p.h b/src/widgets/styles/qwindowsxpstyle_p.h index 058668d3fb..1ef60096c7 100644 --- a/src/widgets/styles/qwindowsxpstyle_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p.h @@ -351,6 +351,7 @@ public: static HTHEME createTheme(int theme, HWND hwnd); static QString themeName(int theme); + static inline bool hasTheme(int theme) { return theme >= 0 && theme < NThemes && m_themes[theme]; } QIcon dockFloat, dockClose; |