From 215d89c8900dbc41ef4b97252b52576dcf1850a7 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Sat, 4 Aug 2012 02:02:40 +0000 Subject: Draw selected items properly. svn path=/trunk/; revision=44259 --- ui/qt/sparkline_delegate.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'ui/qt/sparkline_delegate.cpp') diff --git a/ui/qt/sparkline_delegate.cpp b/ui/qt/sparkline_delegate.cpp index 178e8180c5..7047894c91 100644 --- a/ui/qt/sparkline_delegate.cpp +++ b/ui/qt/sparkline_delegate.cpp @@ -20,6 +20,8 @@ void SparkLineDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt qreal idx = 0.0; QVector fpoints; + QStyledItemDelegate::paint(painter, option, index); + if (!points || points->isEmpty() || content_w <= 0 || content_h <= 0) { return; } @@ -41,8 +43,13 @@ void SparkLineDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt painter->setRenderHint(QPainter::Antialiasing, true); painter->translate(option.rect.x() + SL_MARGIN, option.rect.y() + SL_MARGIN); - painter->setPen(Qt::ForegroundRole); - painter->setBrush(option.palette.foreground()); + // XXX Handle disabled + if (option.state & QStyle::State_Selected) { + painter->setPen(option.palette.color(QPalette::HighlightedText)); + qDebug() << "sel"; + } else { + painter->setPen(option.palette.color(QPalette::WindowText)); + } painter->drawPolyline(QPolygonF(fpoints)); // painter->setPen(Qt::NoPen); -- cgit v1.2.1