aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2012-08-13 23:37:15 +0000
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2012-08-13 23:37:15 +0000
commitcc7ac224e5d97acf32e79d5188bac5f184a1ef77 (patch)
tree79c20430632cd937d6ade77ffa9e7570b04f0987 /ui/qt
parenta6935525c0e098b25a4f3798dc18e92e26936537 (diff)
Use the right color on Windows when selected.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@44479 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/sparkline_delegate.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/ui/qt/sparkline_delegate.cpp b/ui/qt/sparkline_delegate.cpp
index 996d4b3e75..2c725d6b39 100644
--- a/ui/qt/sparkline_delegate.cpp
+++ b/ui/qt/sparkline_delegate.cpp
@@ -62,16 +62,29 @@ void SparkLineDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt
idx = idx + 1;
}
+ QStyleOptionViewItemV4 optv4 = option;
+ QStyledItemDelegate::initStyleOption(&optv4, index);
+
painter->save();
- painter->setRenderHint(QPainter::Antialiasing, true);
- painter->translate(option.rect.x() + SL_MARGIN + 0.5, option.rect.y() + SL_MARGIN + 0.5);
- // XXX Handle disabled and Windows
- if (option.state & QStyle::State_Selected) {
- painter->setPen(option.palette.color(QPalette::HighlightedText));
+#ifdef Q_WS_WIN
+ // QWindowsVistaStyle::drawControl does this internally. Unfortunately there
+ // doesn't appear to be a way to do this dynamically.
+ optv4.palette.setColor(QPalette::All, QPalette::HighlightedText, optv4.palette.color(QPalette::Active, QPalette::Text));
+#endif
+
+ QPalette::ColorGroup cg = optv4.state & QStyle::State_Enabled
+ ? QPalette::Normal : QPalette::Disabled;
+ if (cg == QPalette::Normal && !(optv4.state & QStyle::State_Active))
+ cg = QPalette::Inactive;
+ if (optv4.state & QStyle::State_Selected) {
+ painter->setPen(optv4.palette.color(cg, QPalette::HighlightedText));
} else {
- painter->setPen(option.palette.color(QPalette::WindowText));
+ painter->setPen(optv4.palette.color(cg, QPalette::Text));
}
+
+ painter->setRenderHint(QPainter::Antialiasing, true);
+ painter->translate(option.rect.x() + SL_MARGIN + 0.5, option.rect.y() + SL_MARGIN + 0.5);
painter->drawPolyline(QPolygonF(fpoints));
// painter->setPen(Qt::NoPen);