summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qwindowsxpstyle.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-02-11 08:24:34 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-02-11 08:25:04 +0100
commitd456f87ece0323982b7601047712545ab95426ad (patch)
tree46b90468b01144615f280620d73763fc189d25ac /src/widgets/styles/qwindowsxpstyle.cpp
parentcc2938b5b6aa07210b04bd48ad8a2830701a06e5 (diff)
parent4fc070a4192d5b914b6f814a8dcab3f552d9abac (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: src/corelib/io/qfilesystemwatcher_win.cpp src/corelib/plugin/plugin.pri src/plugins/platforms/cocoa/qcocoaaccessibility.mm tests/auto/corelib/tools/qlocale/tst_qlocale.cpp Change-Id: Id6824631252609a75eff8b68792e4d10095c8fc1
Diffstat (limited to 'src/widgets/styles/qwindowsxpstyle.cpp')
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index 7529bcaafb..fecfb02782 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -377,6 +377,22 @@ bool QWindowsXPStylePrivate::isItemViewDelegateLineEdit(const QWidget *widget)
&& parent2->inherits("QAbstractItemView");
}
+// Returns whether base color is set for this widget
+bool QWindowsXPStylePrivate::isLineEditBaseColorSet(const QStyleOption *option, const QWidget *widget)
+{
+ uint resolveMask = option->palette.resolve();
+ if (widget) {
+ // 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 (const QAbstractSpinBox *spinbox = qobject_cast<QAbstractSpinBox*>(widget->parentWidget()))
+ resolveMask |= spinbox->palette().resolve();
+#endif // QT_NO_SPINBOX
+ }
+ return (resolveMask & (1 << QPalette::Base)) != 0;
+}
+
/*! \internal
This function will always return a valid window handle, and might
create a limbo widget to do so.
@@ -1606,30 +1622,12 @@ case PE_Frame:
themeNumber = QWindowsXPStylePrivate::EditTheme;
partId = EP_EDITTEXT;
noBorder = true;
- QBrush bg;
- bool usePalette = false;
bool isEnabled = flags & State_Enabled;
- uint resolve_mask = panel->palette.resolve();
-
-#ifndef QT_NO_SPINBOX
- // 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();
- }
-#endif // QT_NO_SPINBOX
- if (resolve_mask & (1 << QPalette::Base)) {
- // Base color is set for this widget, so use it
- bg = panel->palette.brush(QPalette::Base);
- usePalette = true;
- }
stateId = isEnabled ? ETS_NORMAL : ETS_DISABLED;
- if (usePalette) {
- p->fillRect(panel->rect, bg);
+ if (QWindowsXPStylePrivate::isLineEditBaseColorSet(option, widget)) {
+ p->fillRect(panel->rect, panel->palette.brush(QPalette::Base));
} else {
XPThemeData theme(0, p, themeNumber, partId, stateId, rect);
if (!theme.isValid()) {