summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2012-03-12 13:36:25 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-13 22:58:10 +0100
commit2d68c8ee8d28556eb40eb576d30b64fdac9b388d (patch)
tree3ef176af5bdc290329e50f45e5034e6c604b1e51 /src/widgets
parente9fdfd746bc374b7b2cbccb875d36727b3946990 (diff)
Windows: Fix QSpinBox background setting via stylesheet
When using stylesheets, palette mask for drawing the background of line edit child of spinbox is already correctly resolved to style options in QStyleSheetStyle::drawPrimitive(), so we cannot simply ignore that mask and check the palette mask of the parent spinbox. Fixed by using a union mask of the parent spinbox palette and the palette supplied by style option instead of simply using the mask from parent spinbox. If either specifies custom base color, use that to paint the background of the spinbox's line edit. Task-number: QTBUG-24323 Change-Id: I1e738192db83b16d9bd48da54d29779e18788ef7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp6
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 1aecb64acf..c18b2266b8 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -586,10 +586,12 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
bool isEnabled = option->state & State_Enabled;
uint resolve_mask = panel->palette.resolve();
if (widget) {
- //Since spin box and combo box includes a line edit we need to resolve the palette on the parent instead
+ // Since spin box includes a line edit we need to resolve the palette mask also from
+ // the parent, as while the color is always correct on the palette supplied by panel,
+ // the mask can still be empty. If either mask specifies custom base color, use that.
#ifndef QT_NO_SPINBOX
if (QAbstractSpinBox *spinbox = qobject_cast<QAbstractSpinBox*>(widget->parentWidget()))
- resolve_mask = spinbox->palette().resolve();
+ resolve_mask |= spinbox->palette().resolve();
#endif // QT_NO_SPINBOX
}
if (resolve_mask & (1 << QPalette::Base)) {
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index 5aab69983c..8b745ba114 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -1583,10 +1583,12 @@ case PE_Frame:
uint resolve_mask = panel->palette.resolve();
#ifndef QT_NO_SPINBOX
- //Since spin box includes a line edit we need to resolve the palette on the spin box instead
+ // Since spin box includes a line edit we need to resolve the palette mask also from
+ // the parent, as while the color is always correct on the palette supplied by panel,
+ // the mask can still be empty. If either mask specifies custom base color, use that.
if (widget) {
if (QAbstractSpinBox *spinbox = qobject_cast<QAbstractSpinBox*>(widget->parentWidget()))
- resolve_mask = spinbox->palette().resolve();
+ resolve_mask |= spinbox->palette().resolve();
}
#endif // QT_NO_SPINBOX
if (resolve_mask & (1 << QPalette::Base)) {