diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-08-05 11:53:44 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-08-05 11:58:51 (GMT) |
commit | e80dc7d3a8ab098627c9c81ea390de7db0ec264e (patch) | |
tree | 3dc590cbd98cd748b3b82a27ff2f214cacb1019f | |
parent | ca2a9d87d81095f6ff7b821e3d8cbe120a6d9b23 (diff) | |
download | Qt-e80dc7d3a8ab098627c9c81ea390de7db0ec264e.zip Qt-e80dc7d3a8ab098627c9c81ea390de7db0ec264e.tar.gz Qt-e80dc7d3a8ab098627c9c81ea390de7db0ec264e.tar.bz2 |
Fixed setting a style shet on a QSpinBox to change the arrow possition
If you only set the position, of the button without setting a geometry,
it did not work.
Task-number: 259226
-rw-r--r-- | src/gui/styles/qstylesheetstyle.cpp | 8 | ||||
-rw-r--r-- | tests/auto/uiloader/baseline/css_task259226_spinboxes.ui | 83 |
2 files changed, 87 insertions, 4 deletions
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 2efa4a7..5f6d4ab 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -2891,8 +2891,8 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC bool customUp = true, customDown = true; QRenderRule upRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton); QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton); - bool upRuleMatch = upRule.hasGeometry(); - bool downRuleMatch = downRule.hasGeometry(); + bool upRuleMatch = upRule.hasGeometry() || upRule.hasPosition(); + bool downRuleMatch = downRule.hasGeometry() || downRule.hasPosition(); if (rule.hasNativeBorder() && !upRuleMatch && !downRuleMatch) { rule.drawBackgroundImage(p, spinOpt.rect); customUp = (opt->subControls & QStyle::SC_SpinBoxUp) @@ -5167,8 +5167,8 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp QRenderRule upRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton); QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton); bool ruleMatch = rule.hasBox() || !rule.hasNativeBorder(); - bool upRuleMatch = upRule.hasGeometry(); - bool downRuleMatch = downRule.hasGeometry(); + bool upRuleMatch = upRule.hasGeometry() || upRule.hasPosition(); + bool downRuleMatch = downRule.hasGeometry() || upRule.hasPosition(); if (ruleMatch || upRuleMatch || downRuleMatch) { switch (sc) { case SC_SpinBoxFrame: diff --git a/tests/auto/uiloader/baseline/css_task259226_spinboxes.ui b/tests/auto/uiloader/baseline/css_task259226_spinboxes.ui new file mode 100644 index 0000000..eb9ade3 --- /dev/null +++ b/tests/auto/uiloader/baseline/css_task259226_spinboxes.ui @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Form</class> + <widget class="QWidget" name="Form"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>320</width> + <height>116</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <property name="styleSheet"> + <string notr="true">#spinbox1::up-button{ + subcontrol-origin: border; + subcontrol-position: top left; + } +#spinbox1::down-button { + subcontrol-origin: border; + subcontrol-position: bottom left; + } + + +#spinbox2::up-button{ + subcontrol-origin: border; + subcontrol-position: center left; + left: 0px; + height: 100%; + top: 0px; + } +#spinbox2::down-button { + subcontrol-origin: border; + subcontrol-position: center right; + right: 0px; + height: 100%; + top: 0px; + } + + + +#spinbox3::up-button{ + subcontrol-origin: border; + subcontrol-position: top left; + } + + +#spinbox4 { padding: 20px 1px; } +#spinbox4::up-button{ + subcontrol-origin: border; + subcontrol-position: top center; + width:100%; + height: 20px; + } +#spinbox4::down-button { + subcontrol-origin: border; + subcontrol-position: bottom center; + width:100%; + height: 20px; + } + +</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QSpinBox" name="spinbox1"/> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="spinbox2"/> + </item> + <item row="1" column="0"> + <widget class="QSpinBox" name="spinbox3"/> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="spinbox4"/> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> |