diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-01 23:51:34 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-01 23:51:34 -0300 |
commit | 764a863082f9337156fc4bcf5c0ecc6ae3d149d6 (patch) | |
tree | d071c10611ea3c31f28e7994db67baf3650e3f7b /qt-ui/modeldelegates.cpp | |
parent | 0be521bb25cf6210ad47e42eb7a8eb7638c32442 (diff) | |
download | subsurface-764a863082f9337156fc4bcf5c0ecc6ae3d149d6.tar.gz |
Added Support for the Trips and Dives on the DiveList model.
Now the list and dives will work in the same way that the GTK
version does. The code got changed heavly because the old one
was just looking at the dives and didn't worked like a tree.
small adaptations on the list view and model delegates because
of the changes done on this model.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/modeldelegates.cpp')
-rw-r--r-- | qt-ui/modeldelegates.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp index 1ac2f46c6..00f10092d 100644 --- a/qt-ui/modeldelegates.cpp +++ b/qt-ui/modeldelegates.cpp @@ -14,10 +14,16 @@ void StarWidgetsDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o return; } - int rating = index.model()->data(index, Qt::DisplayRole).toInt(); + QVariant value = index.model()->data(index, Qt::DisplayRole); - if (option.state & QStyle::State_Selected) - painter->fillRect(option.rect, option.palette.highlight()); + 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); |