From 2bd88e81fc70b694f65efbde2866cc5262f09da2 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 10 Jun 2010 14:13:48 +0300 Subject: 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 --- src/gui/styles/qs60style.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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(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), -- cgit v0.12