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>
This commit is contained in:
Friedemann Kleint 2012-05-04 09:11:13 +02:00 committed by Qt by Nokia
parent fde021c6d7
commit e40b13459b
3 changed files with 17 additions and 3 deletions

View File

@ -2469,7 +2469,12 @@ void QWindowsVistaStyle::unpolish(QWidget *widget)
{ {
QWindowsXPStyle::unpolish(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); d->stopAnimation(widget);
#ifndef QT_NO_LINEEDIT #ifndef QT_NO_LINEEDIT
@ -2542,8 +2547,7 @@ QWindowsVistaStylePrivate::QWindowsVistaStylePrivate() :
QWindowsVistaStylePrivate::~QWindowsVistaStylePrivate() QWindowsVistaStylePrivate::~QWindowsVistaStylePrivate()
{ {
qDeleteAll(animations); qDeleteAll(animations);
if (m_treeViewHelper) cleanupTreeViewTheming();
DestroyWindow(m_treeViewHelper);
} }
void QWindowsVistaStylePrivate::timerEvent() void QWindowsVistaStylePrivate::timerEvent()
@ -2694,6 +2698,14 @@ bool QWindowsVistaStylePrivate::initTreeViewTheming()
return QWindowsXPStylePrivate::createTheme(QWindowsXPStylePrivate::TreeViewTheme, m_treeViewHelper); return QWindowsXPStylePrivate::createTheme(QWindowsXPStylePrivate::TreeViewTheme, m_treeViewHelper);
} }
void QWindowsVistaStylePrivate::cleanupTreeViewTheming()
{
if (m_treeViewHelper) {
DestroyWindow(m_treeViewHelper);
m_treeViewHelper = 0;
}
}
/*! /*!
\internal \internal
*/ */

View File

@ -208,6 +208,7 @@ public:
private: private:
bool initTreeViewTheming(); bool initTreeViewTheming();
void cleanupTreeViewTheming();
QList <QWindowsVistaAnimation*> animations; QList <QWindowsVistaAnimation*> animations;
QBasicTimer animationTimer; QBasicTimer animationTimer;

View File

@ -351,6 +351,7 @@ public:
static HTHEME createTheme(int theme, HWND hwnd); static HTHEME createTheme(int theme, HWND hwnd);
static QString themeName(int theme); static QString themeName(int theme);
static inline bool hasTheme(int theme) { return theme >= 0 && theme < NThemes && m_themes[theme]; }
QIcon dockFloat, dockClose; QIcon dockFloat, dockClose;