summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qfusionstyle.cpp
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@digia.com>2012-10-21 19:12:20 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-25 06:01:43 +0100
commitdfc0fbabe1747e308a5daa8f6d41ff85aa5d86b5 (patch)
tree2f429da7cf7a853902ae9017d4caa7f3847175b3 /src/widgets/styles/qfusionstyle.cpp
parent55bac90295ac5cbdafeccf18000b8d379af69864 (diff)
Improved tri-state checkbox in Fusion style
This changes the tristate checkbox to look more distinct from the disabled checkbox. Task-number: QTBUG-27661 Change-Id: If0921c91d27b62552cbcf86563eed1b75e800478 Reviewed-by: Jonathan Liu <net147@gmail.com> Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/widgets/styles/qfusionstyle.cpp')
-rw-r--r--src/widgets/styles/qfusionstyle.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index c8b6154413..a480393ca1 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -746,11 +746,23 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
painter->setPen(QPen(highlightedOutline, 1));
painter->drawRect(rect);
- if (checkbox->state & (State_On | State_Sunken | State_NoChange)) {
- QColor checkMarkColor = option->palette.text().color().darker(120);
+ QColor checkMarkColor = option->palette.text().color().darker(120);
+
+ if (checkbox->state & State_NoChange) {
+ gradient = QLinearGradient(rect.topLeft(), rect.bottomLeft());
+ checkMarkColor.setAlpha(80);
+ gradient.setColorAt(0, checkMarkColor);
+ checkMarkColor.setAlpha(140);
+ gradient.setColorAt(1, checkMarkColor);
+ checkMarkColor.setAlpha(180);
+ painter->setPen(QPen(checkMarkColor, 1));
+ painter->setBrush(gradient);
+ painter->drawRect(rect.adjusted(3, 3, -3, -3));
+
+ } else if (checkbox->state & (State_On)) {
+ QPen checkPen = QPen(checkMarkColor, 1.8);
checkMarkColor.setAlpha(210);
painter->translate(-1, 0.5);
- QPen checkPen = QPen(checkMarkColor, 1.8);
painter->setPen(checkPen);
painter->setBrush(Qt::NoBrush);
painter->translate(0.2, 0.0);
@@ -761,13 +773,6 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
path.lineTo(rect.width() / 2.0 - 0, rect.height() - 3);
path.lineTo(rect.width() - 2.5, 3);
painter->drawPath(path.translated(rect.topLeft()));
-
- if (checkbox->state & State_NoChange) {
- QColor bgc = option->palette.background().color();
- bgc.setAlpha(127);
- painter->fillRect(rect.adjusted(1, 1, -1, -1), bgc);
- }
-
}
}
painter->restore();