Changed a lot of code to reduce boilerplate on models in the future.

So, I changed a lot of code to reduce boilerplate on models in the
future. Currently we do not have a lot of models, but this can increase
quite rapdly. There's a second TreeModel in the works, the Yearly
Statistics, this patch will save around 250 LOC for this new model,
and more and more models will give us a greater saving.

Iwll do that for the table models in the future too - I did the tree
models now because they are the most complex case and I didn't wanted
to create a second tree model without this.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-06-17 18:59:50 -03:00
parent 14ccbbf6e8
commit ae68ae38bb
5 changed files with 165 additions and 154 deletions

View file

@ -26,7 +26,7 @@ void StarWidgetsDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
if (!index.isValid())
return;
QVariant value = index.model()->data(index, TreeItemDT::STAR_ROLE);
QVariant value = index.model()->data(index, DiveTripModel::STAR_ROLE);
if (!value.isValid())
return;