diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-06-11 10:07:50 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-06-11 10:58:06 (GMT) |
commit | f20f242c7d45ad675c6d955628d318ffecdfe517 (patch) | |
tree | 02e37e90a696f9522abf2254e5a601eb3cbc69f3 | |
parent | 713e52d9531277b8c13856246701729de16d4502 (diff) | |
download | Qt-f20f242c7d45ad675c6d955628d318ffecdfe517.zip Qt-f20f242c7d45ad675c6d955628d318ffecdfe517.tar.gz Qt-f20f242c7d45ad675c6d955628d318ffecdfe517.tar.bz2 |
Make sure custom arrow images works if we only specify it.
Include change for spinbox, combobox, and menu.
Task-number: 255849
Tested-by: Pierre
Reviewed-by: jbache
-rw-r--r-- | src/gui/styles/qstylesheetstyle.cpp | 18 | ||||
-rw-r--r-- | tests/auto/uiloader/baseline/css_task255849_downarrow.ui | 144 | ||||
-rw-r--r-- | tests/auto/uiloader/baseline/images/arrow-down.png | bin | 0 -> 1006 bytes | |||
-rw-r--r-- | tests/auto/uiloader/baseline/images/arrow-up.png | bin | 0 -> 927 bytes |
4 files changed, 158 insertions, 4 deletions
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 9a8f97e..fe0e53c 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -2850,7 +2850,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC rule.drawBackgroundImage(p, cmbOpt.rect); rule.configurePalette(&cmbOpt.palette, QPalette::ButtonText, QPalette::Button); bool customDropDown = (opt->subControls & QStyle::SC_ComboBoxArrow) - && hasStyleRule(w, PseudoElement_ComboBoxDropDown); + && (hasStyleRule(w, PseudoElement_ComboBoxDropDown) || hasStyleRule(w, PseudoElement_ComboBoxArrow)); if (customDropDown) cmbOpt.subControls &= ~QStyle::SC_ComboBoxArrow; if (rule.baseStyleCanDraw()) { @@ -2896,11 +2896,11 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC if (rule.hasNativeBorder() && !upRuleMatch && !downRuleMatch) { rule.drawBackgroundImage(p, spinOpt.rect); customUp = (opt->subControls & QStyle::SC_SpinBoxUp) - && hasStyleRule(w, PseudoElement_SpinBoxUpButton); + && (hasStyleRule(w, PseudoElement_SpinBoxUpButton) || hasStyleRule(w, PseudoElement_UpArrow)); if (customUp) spinOpt.subControls &= ~QStyle::SC_SpinBoxUp; customDown = (opt->subControls & QStyle::SC_SpinBoxDown) - && hasStyleRule(w, PseudoElement_SpinBoxDownButton); + && (hasStyleRule(w, PseudoElement_SpinBoxDownButton) || hasStyleRule(w, PseudoElement_DownArrow)); if (customDown) spinOpt.subControls &= ~QStyle::SC_SpinBoxDown; if (rule.baseStyleCanDraw()) { @@ -3573,7 +3573,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q mi.rect = positionRect(w, subRule, subRule2, PseudoElement_MenuRightArrow, opt->rect, mi.direction); drawPrimitive(arrow, &mi, p, w); } - } else if (hasStyleRule(w, PseudoElement_MenuCheckMark)) { + } else if (hasStyleRule(w, PseudoElement_MenuCheckMark) || hasStyleRule(w, PseudoElement_MenuRightArrow)) { QWindowsStyle::drawControl(ce, &mi, p, w); } else { if (rule.hasDrawable() && !subRule.hasDrawable() && !(opt->state & QStyle::State_Selected)) { @@ -4339,6 +4339,16 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op pseudoElement = PseudoElement_ScrollAreaCorner; break; + case PE_IndicatorSpinDown: + case PE_IndicatorSpinMinus: + pseudoElement = PseudoElement_SpinBoxDownArrow; + break; + + case PE_IndicatorSpinUp: + case PE_IndicatorSpinPlus: + pseudoElement = PseudoElement_SpinBoxUpArrow; + break; + default: break; } diff --git a/tests/auto/uiloader/baseline/css_task255849_downarrow.ui b/tests/auto/uiloader/baseline/css_task255849_downarrow.ui new file mode 100644 index 0000000..d3e99b1 --- /dev/null +++ b/tests/auto/uiloader/baseline/css_task255849_downarrow.ui @@ -0,0 +1,144 @@ +<?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>275</width> + <height>175</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <property name="styleSheet"> + <string notr="true">/* Some widget were not displaying the arrow if only the arrow was set */ +*::down-arrow { image: url("images/arrow-down.png") } +*::up-arrow { image: url("images/arrow-up.png") } + + +</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0" colspan="2"> + <widget class="QComboBox" name="comboBox"/> + </item> + <item row="0" column="2" rowspan="5"> + <widget class="QTreeWidget" name="treeWidget"> + <property name="sortingEnabled"> + <bool>true</bool> + </property> + <attribute name="headerShowSortIndicator" stdset="0"> + <bool>true</bool> + </attribute> + <attribute name="headerShowSortIndicator" stdset="0"> + <bool>true</bool> + </attribute> + <column> + <property name="text"> + <string>1</string> + </property> + </column> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + </widget> + </item> + <item row="1" column="0"> + <widget class="QSpinBox" name="spinBox"/> + </item> + <item row="1" column="1"> + <widget class="QToolButton" name="toolButton"> + <property name="text"> + <string>foo</string> + </property> + <property name="arrowType"> + <enum>Qt::DownArrow</enum> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QDoubleSpinBox" name="doubleSpinBox"/> + </item> + <item row="3" column="0" colspan="2"> + <widget class="QPushButton" name="pushButton"> + <property name="contextMenuPolicy"> + <enum>Qt::NoContextMenu</enum> + </property> + <property name="text"> + <string>PushButton</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/tests/auto/uiloader/baseline/images/arrow-down.png b/tests/auto/uiloader/baseline/images/arrow-down.png Binary files differnew file mode 100644 index 0000000..7c9274f --- /dev/null +++ b/tests/auto/uiloader/baseline/images/arrow-down.png diff --git a/tests/auto/uiloader/baseline/images/arrow-up.png b/tests/auto/uiloader/baseline/images/arrow-up.png Binary files differnew file mode 100644 index 0000000..758a0d1 --- /dev/null +++ b/tests/auto/uiloader/baseline/images/arrow-up.png |