Enable testStyleOptionInit for all styles and fix affected styles.
Change-Id: I7cb759445342ecb58d5187ddd4a22e41fdea084a Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
62091be85c
commit
ca434d0c20
@ -2385,8 +2385,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
|
||||
if (!titleBar->icon.isNull()) {
|
||||
titleBar->icon.paint(painter, iconRect);
|
||||
} else {
|
||||
QStyleOption tool(0);
|
||||
tool.palette = titleBar->palette;
|
||||
QStyleOption tool = *titleBar;
|
||||
QPixmap pm = proxy()->standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(16, 16);
|
||||
tool.rect = iconRect;
|
||||
painter->save();
|
||||
|
@ -1765,8 +1765,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
|
||||
if (!titleBar->icon.isNull()) {
|
||||
titleBar->icon.paint(painter, iconRect);
|
||||
} else {
|
||||
QStyleOption tool(0);
|
||||
tool.palette = titleBar->palette;
|
||||
QStyleOption tool = *titleBar;
|
||||
QPixmap pm = proxy()->standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(16, 16);
|
||||
tool.rect = iconRect;
|
||||
painter->save();
|
||||
@ -2071,9 +2070,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
|
||||
mflags |= State_MouseOver;
|
||||
}
|
||||
|
||||
QStyleOption tool(0);
|
||||
|
||||
tool.palette = toolbutton->palette;
|
||||
QStyleOption tool = *toolbutton;
|
||||
|
||||
if (toolbutton->subControls & SC_ToolButton) {
|
||||
if (bflags & (State_Sunken | State_On | State_Raised | State_MouseOver)) {
|
||||
|
@ -5978,12 +5978,10 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
if (QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)) {
|
||||
if (tb->subControls & SC_ToolButtonMenu) {
|
||||
QStyleOption arrowOpt(0);
|
||||
QStyleOption arrowOpt = *tb;
|
||||
arrowOpt.rect = proxy()->subControlRect(cc, tb, SC_ToolButtonMenu, widget);
|
||||
arrowOpt.rect.setY(arrowOpt.rect.y() + arrowOpt.rect.height() / 2);
|
||||
arrowOpt.rect.setHeight(arrowOpt.rect.height() / 2);
|
||||
arrowOpt.state = tb->state;
|
||||
arrowOpt.palette = tb->palette;
|
||||
proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);
|
||||
} else if ((tb->features & QStyleOptionToolButton::HasMenu)
|
||||
&& (tb->toolButtonStyle != Qt::ToolButtonTextOnly && !tb->icon.isNull())) {
|
||||
|
@ -1437,8 +1437,7 @@ void QWindowsCEStyle::drawComplexControl(ComplexControl control, const QStyleOpt
|
||||
if (toolbutton->activeSubControls & SC_ToolButtonMenu)
|
||||
mflags |= State_Sunken;
|
||||
|
||||
QStyleOption tool(0);
|
||||
tool.palette = toolbutton->palette;
|
||||
QStyleOption tool = *toolbutton;
|
||||
if (toolbutton->subControls & SC_ToolButton) {
|
||||
tool.rect = button;
|
||||
tool.state = bflags;
|
||||
@ -1620,9 +1619,8 @@ void QWindowsCEStyle::drawComplexControl(ComplexControl control, const QStyleOpt
|
||||
|
||||
if (cmb->activeSubControls == SC_ComboBoxArrow)
|
||||
flags |= State_Sunken;
|
||||
QStyleOption arrowOpt(0);
|
||||
QStyleOption arrowOpt = *cmb;
|
||||
arrowOpt.rect = ar;
|
||||
arrowOpt.palette = cmb->palette;
|
||||
arrowOpt.state = flags;
|
||||
drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget);
|
||||
}
|
||||
|
@ -6105,8 +6105,7 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
|
||||
buttonFlags |= State_Sunken;
|
||||
if (toolbutton->activeSubControls & SC_ToolButtonMenu)
|
||||
menuFlags |= State_On;
|
||||
QStyleOption tool(0);
|
||||
tool.palette = toolbutton->palette;
|
||||
QStyleOption tool = *toolbutton;
|
||||
if (toolbutton->subControls & SC_ToolButton) {
|
||||
tool.rect = button;
|
||||
tool.state = buttonFlags;
|
||||
@ -6115,14 +6114,11 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
|
||||
if (toolbutton->subControls & SC_ToolButtonMenu) {
|
||||
tool.rect = menuarea;
|
||||
tool.state = buttonFlags & State_Enabled;
|
||||
QStyleOption toolMenu(0);
|
||||
toolMenu = *toolbutton;
|
||||
QStyleOption toolMenu = *toolbutton;
|
||||
toolMenu.state = menuFlags;
|
||||
if (buttonFlags & State_Sunken)
|
||||
proxy()->drawPrimitive(PE_PanelButtonTool, &toolMenu, painter, widget);
|
||||
QStyleOption arrowOpt(0);
|
||||
arrowOpt.rect = tool.rect;
|
||||
arrowOpt.palette = tool.palette;
|
||||
QStyleOption arrowOpt = toolMenu;
|
||||
State flags = State_None;
|
||||
if (menuFlags & State_Enabled)
|
||||
flags |= State_Enabled;
|
||||
@ -6244,9 +6240,8 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
|
||||
flags |= State_Enabled;
|
||||
if (option->state & State_On)
|
||||
flags |= State_Sunken;
|
||||
QStyleOption arrowOpt(0);
|
||||
QStyleOption arrowOpt = *cmb;
|
||||
arrowOpt.rect = ar;
|
||||
arrowOpt.palette = cmb->palette;
|
||||
arrowOpt.state = flags;
|
||||
proxy()->drawPrimitive(PrimitiveElement(PE_IndicatorArrowDownBig), &arrowOpt, painter, widget);
|
||||
if (cmb->subControls & SC_ComboBoxEditField) {
|
||||
|
@ -2164,9 +2164,8 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
|
||||
|
||||
if (sunkenArrow)
|
||||
flags |= State_Sunken;
|
||||
QStyleOption arrowOpt(0);
|
||||
QStyleOption arrowOpt = *cmb;
|
||||
arrowOpt.rect = ar.adjusted(1, 1, -1, -1);
|
||||
arrowOpt.palette = cmb->palette;
|
||||
arrowOpt.state = flags;
|
||||
proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);
|
||||
}
|
||||
|
@ -3044,8 +3044,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
|
||||
}
|
||||
}
|
||||
|
||||
QStyleOption tool(0);
|
||||
tool.palette = toolbutton->palette;
|
||||
QStyleOption tool = *toolbutton;
|
||||
if (toolbutton->subControls & SC_ToolButton) {
|
||||
if (flags & (State_Sunken | State_On | State_Raised) || !autoRaise) {
|
||||
if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup && autoRaise) {
|
||||
|
@ -949,17 +949,14 @@ private:
|
||||
void tst_QStyle::testStyleOptionInit()
|
||||
{
|
||||
QStringList keys = QStyleFactory::keys();
|
||||
QVector<QStyle*> styles;
|
||||
styles.reserve(keys.size() + 1);
|
||||
keys.prepend(QString()); // QCommonStyle marker
|
||||
|
||||
styles << new QCommonStyle();
|
||||
|
||||
Q_FOREACH (QStyle *style, styles) {
|
||||
Q_FOREACH (const QString &key, keys) {
|
||||
QStyle* style = key.isEmpty() ? new QCommonStyle : QStyleFactory::create(key);
|
||||
TestStyleOptionInitProxy testStyle;
|
||||
testStyle.setBaseStyle(style);
|
||||
testAllFunctions(style);
|
||||
QVERIFY(!testStyle.invalidOptionsDetected);
|
||||
delete style;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user