Windows XP style: Pass widget to XPThemeData.

Previously, 0 was passed which causes QWindowsXPStylePrivate::winId() to
go on a hunt trying to find a window handle needlessly looping over top
levels, slowing down painting.

Task-number: QTBUG-42245
Change-Id: Ic702d9a73c4f749fd5988950280aef632a3308c4
Reviewed-by: Marko Kangas <marko.kangas@theqtcompany.com>
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
bb10
Friedemann Kleint 2015-07-08 16:16:38 +02:00
parent 1443cdcfe0
commit 3719744b39
2 changed files with 4 additions and 4 deletions

View File

@ -396,7 +396,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
case PE_IndicatorBranch:
{
XPThemeData theme(0, painter, QWindowsXPStylePrivate::TreeViewTheme);
XPThemeData theme(widget, painter, QWindowsXPStylePrivate::TreeViewTheme);
static int decoration_size = 0;
if (d->initTreeViewTheming() && theme.isValid() && !decoration_size) {
XPThemeData themeSize = theme;
@ -710,7 +710,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
state = LISS_HOT;
QPainter pixmapPainter(&pixmap);
XPThemeData theme(0, &pixmapPainter,
XPThemeData theme(widget, &pixmapPainter,
QWindowsXPStylePrivate::TreeViewTheme,
LVP_LISTITEM, state, QRect(0, 0, sectionSize.width(), sectionSize.height()));
if (d->initTreeViewTheming() && theme.isValid()) {

View File

@ -1224,7 +1224,7 @@ void QWindowsXPStyle::polish(QWidget *widget)
if (!d->hasInitColors) {
// Get text color for group box labels
COLORREF cref;
XPThemeData theme(0, 0, QWindowsXPStylePrivate::ButtonTheme, 0, 0);
XPThemeData theme(widget, 0, QWindowsXPStylePrivate::ButtonTheme, 0, 0);
QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &cref);
d->groupBoxTextColor = qRgb(GetRValue(cref), GetGValue(cref), GetBValue(cref));
QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), BP_GROUPBOX, GBS_DISABLED, TMT_TEXTCOLOR, &cref);
@ -1540,7 +1540,7 @@ case PE_Frame:
return;
themeNumber = QWindowsXPStylePrivate::ListViewTheme;
partId = LVP_LISTGROUP;
XPThemeData theme(0, 0, themeNumber, partId, 0);
XPThemeData theme(widget, 0, themeNumber, partId, 0);
if (!(flags & State_Enabled))
stateId = ETS_DISABLED;