From f1e0eedcf501936e6b4f77b6fe3ac4997d757d94 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 1 Apr 2016 09:25:45 +0200 Subject: QWindowsXP/VistaStyle: Move the Vista treeview handling to QWindowsXPStylePrivate. QWindowsXPStylePrivate maintains a list of theme handles for various style items. The derived class QWindowsVistaStylePrivate had logic to use a special helper window with the "explorer" window theme set to obtain the correct treeview arrow branch indicator (arrow shape for Vista as opposed to '+'/'-' on Windows XP) when creating the "TREEVIEW" theme. This required calling the helper function QWindowsVistaStylePrivate::initTreeViewTheming() before QWindowsXPStylePrivate::createTheme(), which is prone to errors and initialization order issues. This could be solved by making QWindowsXPStylePrivate::createTheme() virtual or similar, but since it the fate of QWindowsXPStylePrivate is most likely to be merged into QWindowsVistaStylePrivate; it was decided to move the entire special handling of the Vista treeviews into QWindowsXPStylePrivate. The existing enumeration value QWindowsXPStylePrivate::TreeViewTheme is renamed to QWindowsXPStylePrivate::XpTreeViewTheme and a new value QWindowsXPStylePrivate::VistaTreeViewTheme is added for which QWindowsXPStylePrivate::createTheme() invokes the special handling. This also removes the need to destroy the helper window in unpolish(), which should save some initializations. Task-number: QTBUG-52230 Change-Id: I0492ecf38fb3e5eabc4ecbdef70f0bf05e82e104 Reviewed-by: Adam Light Reviewed-by: Joerg Bornemann --- src/widgets/styles/qwindowsxpstyle_p_p.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/widgets/styles/qwindowsxpstyle_p_p.h') diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h index d75c064369..51541ed218 100644 --- a/src/widgets/styles/qwindowsxpstyle_p_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p_p.h @@ -350,9 +350,10 @@ public: ToolBarTheme, ToolTipTheme, TrackBarTheme, - TreeViewTheme, + XpTreeViewTheme, // '+'/'-' shape treeview indicators (XP) WindowTheme, StatusTheme, + VistaTreeViewTheme, // arrow shape treeview indicators (Vista) obtained from "explorer" theme. NThemes }; @@ -413,6 +414,9 @@ private: void showProperties(XPThemeData &themeData); #endif + static bool initVistaTreeViewTheming(); + static void cleanupVistaTreeViewTheming(); + static QBasicAtomicInt ref; static bool use_xp; static QPixmap *tabbody; @@ -424,6 +428,7 @@ private: uchar *bufferPixels; int bufferW, bufferH; + static HWND m_vistaTreeViewHelper; static HTHEME m_themes[NThemes]; }; -- cgit v1.2.3