diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-05-02 14:19:15 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-02 14:52:26 -0700 |
commit | 021ef8ad09295a0ad4b5a3450a651637eea8672d (patch) | |
tree | 1daa2b476a2ed711f84c30b327321ef4e77e22f3 /qt-ui/modeldelegates.cpp | |
parent | c4e2c322a3f6505880b9330e577129e0110ed2ba (diff) | |
download | subsurface-021ef8ad09295a0ad4b5a3450a651637eea8672d.tar.gz |
Alternate background colors for dive list
This was written with massive hand-holding by Tomaz - actually, this was
mostly proposed via IRC by Tomaz and then implemented by me...
Right now because of the list-of-lists nature of the model we have the
small issue that every trip starts with a dark background dive, even if
the trip itself has a dark background.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/modeldelegates.cpp')
-rw-r--r-- | qt-ui/modeldelegates.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp index 87629bd1b..2adaaebc7 100644 --- a/qt-ui/modeldelegates.cpp +++ b/qt-ui/modeldelegates.cpp @@ -15,14 +15,16 @@ void StarWidgetsDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o QVariant value = index.model()->data(index, Qt::DisplayRole); + if(option.state & QStyle::State_Selected) + painter->fillRect(option.rect, option.palette.highlight()); + else + painter->fillRect(option.rect, index.model()->data(index, Qt::BackgroundRole).value<QBrush>()); + if (!value.isValid()) return; int rating = value.toInt(); - if(option.state & QStyle::State_Selected) - painter->fillRect(option.rect, option.palette.highlight()); - painter->save(); painter->setRenderHint(QPainter::Antialiasing, true); |