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