QWindowsVistaStyle: fix frame rendering

A regression caused by 79a389 - it should only draw a styled frame for
text input widgets.

Task-number: QTBUG-28876
Change-Id: I5cda920b7db55f35e0ab6cee460c0e27951d29b9
Reviewed-by: Jonathan Liu <net147@gmail.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
This commit is contained in:
J-P Nurmi 2013-01-07 13:18:59 +01:00 committed by The Qt Project
parent 2c241d0604
commit 25ae390461

View File

@ -502,29 +502,33 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
} }
break; break;
case PE_Frame: { case PE_Frame: {
painter->save(); if (QStyleHelper::isInstanceOf(option->styleObject, QAccessible::EditableText)) {
int stateId = ETS_NORMAL; painter->save();
if (!(state & State_Enabled)) int stateId = ETS_NORMAL;
stateId = ETS_DISABLED; if (!(state & State_Enabled))
else if (state & State_ReadOnly) stateId = ETS_DISABLED;
stateId = ETS_READONLY; else if (state & State_ReadOnly)
else if (state & State_HasFocus) stateId = ETS_READONLY;
stateId = ETS_SELECTED; else if (state & State_HasFocus)
XPThemeData theme(widget, painter, stateId = ETS_SELECTED;
QWindowsXPStylePrivate::EditTheme, XPThemeData theme(widget, painter,
EP_EDITBORDER_HVSCROLL, stateId, option->rect); QWindowsXPStylePrivate::EditTheme,
uint resolve_mask = option->palette.resolve(); EP_EDITBORDER_HVSCROLL, stateId, option->rect);
if (resolve_mask & (1 << QPalette::Base)) { uint resolve_mask = option->palette.resolve();
// Since EP_EDITBORDER_HVSCROLL does not us borderfill, theme.noContent cannot be used for clipping if (resolve_mask & (1 << QPalette::Base)) {
int borderSize = 1; // Since EP_EDITBORDER_HVSCROLL does not us borderfill, theme.noContent cannot be used for clipping
pGetThemeInt(theme.handle(), theme.partId, theme.stateId, TMT_BORDERSIZE, &borderSize); int borderSize = 1;
QRegion clipRegion = option->rect; pGetThemeInt(theme.handle(), theme.partId, theme.stateId, TMT_BORDERSIZE, &borderSize);
QRegion content = option->rect.adjusted(borderSize, borderSize, -borderSize, -borderSize); QRegion clipRegion = option->rect;
clipRegion ^= content; QRegion content = option->rect.adjusted(borderSize, borderSize, -borderSize, -borderSize);
painter->setClipRegion(clipRegion); clipRegion ^= content;
painter->setClipRegion(clipRegion);
}
d->drawBackground(theme);
painter->restore();
} else {
QWindowsXPStyle::drawPrimitive(element, option, painter, widget);
} }
d->drawBackground(theme);
painter->restore();
} }
break; break;