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>
This commit is contained in:
Tomaz Canabrava 2013-05-01 23:51:34 -03:00
parent 0be521bb25
commit 764a863082
4 changed files with 285 additions and 217 deletions

View file

@ -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);