summaryrefslogtreecommitdiffstats
path: root/src/gui/styles
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2010-06-10 11:13:48 (GMT)
committerSami Merila <sami.merila@nokia.com>2010-06-10 11:13:48 (GMT)
commit2bd88e81fc70b694f65efbde2866cc5262f09da2 (patch)
tree958e3f54a375330c179d58ebabd7a9a237860f89 /src/gui/styles
parent84bb6afc5c9e6ffa9b2a2913ba3849020ec35abe (diff)
downloadQt-2bd88e81fc70b694f65efbde2866cc5262f09da2.zip
Qt-2bd88e81fc70b694f65efbde2866cc5262f09da2.tar.gz
Qt-2bd88e81fc70b694f65efbde2866cc5262f09da2.tar.bz2
QS60Style: QComboBox displays checkboxes for items
QComboMenuDelegate claims that all combobox menu items should be checkable even if they aren't. In all the other styles, it has been circumvented in the style code that this particular setting from QComboMenuDelegate is ignored. :) Adding the same workaround to QS60Style as well. Task-number: QTBUG-11322 Reviewed-by: Alessandro Portale
Diffstat (limited to 'src/gui/styles')
-rw-r--r--src/gui/styles/qs60style.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index d28e1d9..4992e34 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -1750,6 +1750,12 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
}
const bool enabled = optionMenuItem.state & State_Enabled;
const bool checkable = optionMenuItem.checkType != QStyleOptionMenuItem::NotCheckable;
+ bool ignoreCheckMark = false;
+
+#ifndef QT_NO_COMBOBOX
+ if (qobject_cast<const QComboBox*>(widget))
+ ignoreCheckMark = true; //ignore the checkmarks provided by the QComboMenuDelegate
+#endif
uint text_flags = Qt::AlignLeading | Qt::TextShowMnemonic | Qt::TextDontClip
| Qt::TextSingleLine | Qt::AlignVCenter;
@@ -1787,7 +1793,8 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
iconRect.translate(-optionCheckBox.rect.width() - vSpacing, 0);
optionCheckBox.rect.translate(textRect.width() + iconRect.width(), 0);
}
- drawPrimitive(PE_IndicatorMenuCheckMark, &optionCheckBox, painter, widget);
+ if (!ignoreCheckMark)
+ drawPrimitive(PE_IndicatorMenuCheckMark, &optionCheckBox, painter, widget);
}
//draw icon and/or checkState
QPixmap pix = menuItem->icon.pixmap(pixelMetric(PM_SmallIconSize),