summaryrefslogtreecommitdiffstats
path: root/qt-ui/modeldelegates.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-02 17:01:35 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-02 17:02:55 -0700
commitff2ce399702d3a487316bfcc4b1fff01dbb8d309 (patch)
tree709b497e1981873b5301c68c0a906b874b7dd635 /qt-ui/modeldelegates.cpp
parent021ef8ad09295a0ad4b5a3450a651637eea8672d (diff)
parent696c9ccacd24392ea63477c5ec8a25d6649aedf7 (diff)
downloadsubsurface-ff2ce399702d3a487316bfcc4b1fff01dbb8d309.tar.gz
Merge branch 'tomaz-css' into Qt
Tomaz' code does a much better job of shading the dive list! Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/modeldelegates.cpp')
-rw-r--r--qt-ui/modeldelegates.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp
index 2adaaebc7..be47198e2 100644
--- a/qt-ui/modeldelegates.cpp
+++ b/qt-ui/modeldelegates.cpp
@@ -7,18 +7,24 @@
#include <QtDebug>
#include <QPainter>
#include <QSortFilterProxyModel>
+#include <QStyle>
+#include <QStyleOption>
+
+StarWidgetsDelegate::StarWidgetsDelegate(QWidget* parent):
+ QStyledItemDelegate(parent),
+ parentWidget(parent)
+{
+
+}
void StarWidgetsDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
+ QStyledItemDelegate::paint(painter, option, index);
+
if (!index.isValid())
return;
- 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>());
+ QVariant value = index.model()->data(index, TreeItemDT::STAR_ROLE);
if (!value.isValid())
return;