aboutsummaryrefslogtreecommitdiff
path: root/plainqt
diff options
context:
space:
mode:
authorBernd Lamecker <Bernd.Lamecker@basyskom.de>2010-04-14 12:31:28 +0200
committerTorsten Rahn <Torsten.Rahn@basyskom.de>2010-04-22 15:43:21 +0200
commit4b5a28179e30ab87d390bf6f3bcf89968f023420 (patch)
treeec71eb4982806622fc2e8d74e109b4f1ebfdb8af /plainqt
parent3f06a79133ce4d6c555a71620226075764f7ee30 (diff)
Changes: CheckBox styling
RevBy: TrustMe
Diffstat (limited to 'plainqt')
-rw-r--r--plainqt/style/qtmaemo6style.cpp20
-rw-r--r--plainqt/style/qtmaemo6style_p.h7
2 files changed, 12 insertions, 15 deletions
diff --git a/plainqt/style/qtmaemo6style.cpp b/plainqt/style/qtmaemo6style.cpp
index bff4f206..c3934840 100644
--- a/plainqt/style/qtmaemo6style.cpp
+++ b/plainqt/style/qtmaemo6style.cpp
@@ -427,17 +427,18 @@ void QtMaemo6StylePrivate::drawCheckBox(QPainter *p,
const QString &text,
const QIcon &icon,
const QRect &rect,
- const QStyleOption *option,
- const QString &styleClass,
- const QString &styleObject /*= QString()*/) const
+ const QStyleOption *option) const
{
const MCheckboxStyle *style =
static_cast<const MCheckboxStyle *>(QtMaemo6StylePrivate::mStyle(option->state,
- styleClass.toLocal8Bit().constData(),
- styleObject,
- "checkbox"));
- // TODO: Fix regression due to introduction of MCheckBoxStyle
+ "MCheckboxStyle"));
drawBasicButton(p, text, icon, rect, option, style, style->font(), style->iconSize());
+ if(option->state & QStyle::State_On
+ && option->state & QStyle::State_Enabled
+ && style->checkmarkImage()) {
+ QSizeF pos = (rect.size() / 2) - (style->checkmarkImage()->size() / 2);
+ p->drawPixmap(pos.width() + rect.x(), pos.height() + rect.y(), *style->checkmarkImage());
+ }
}
void QtMaemo6StylePrivate::drawBasicButton(QPainter *p,
@@ -1232,7 +1233,7 @@ void QtMaemo6Style::drawControl(ControlElement element,
: SE_RadioButtonIndicator,
btn, widget);
- d->drawCheckBox(p, QString(), subopt.icon, subopt.rect, opt, "MButtonStyle");
+ d->drawCheckBox(p, QString(), subopt.icon, subopt.rect, opt);
subopt.rect = subElementRect(isCheckBox ? SE_CheckBoxContents
: SE_RadioButtonContents,
@@ -1753,8 +1754,7 @@ void QtMaemo6Style::drawComplexControl(ComplexControl control,
// Draw checkbox
if (groupBox->subControls & SC_GroupBoxCheckBox) {
- d->drawCheckBox(p, QString(), QIcon(), checkBoxRect,
- groupBox, "MButtonIconStyle");
+ d->drawCheckBox(p, QString(), QIcon(), checkBoxRect, groupBox);
}
}
diff --git a/plainqt/style/qtmaemo6style_p.h b/plainqt/style/qtmaemo6style_p.h
index b27d1a88..8b06215c 100644
--- a/plainqt/style/qtmaemo6style_p.h
+++ b/plainqt/style/qtmaemo6style_p.h
@@ -34,6 +34,7 @@ class QAction;
class QStatusBar;
class QMenuBar;
class QtMaemo6KineticScrolling;
+class QStyleOptionButton;
class QtMaemo6StylePrivate : public QtMaemo6TestStylePrivate
{
@@ -219,16 +220,12 @@ public:
* \param rect the rect in which the checkBox is drawn
* \param icon the icon on the button
* \param option the QStyleOption used to draw the checkBox
- * \param styleClass style class that should be used
- * \param styleObject style object that should be used
*/
void drawCheckBox(QPainter *painter,
const QString &text,
const QIcon &icon,
const QRect &rect,
- const QStyleOption *option,
- const QString &styleClass,
- const QString &styleObject = QString()) const;
+ const QStyleOption *option) const;
/*!
* calculates a rect the text and icon earn