2 * Copyright (C) 2009 Sakari Poussa
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, version 2.
10 #include <QAbstractItemModel>
12 #include "tree-item.h"
14 class ScoreTreeModel : public QAbstractItemModel
21 enum Roles {Type=Qt::UserRole, Rounds, Total, TotalIn, TotalOut, ScoreBest, ScoreAvg };
23 ScoreTreeModel(QList <Score *> &scoreList, QObject *parent = 0);
24 int rowCount(const QModelIndex & parent) const;
25 int columnCount(const QModelIndex & parent) const;
26 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
27 QModelIndex parent(const QModelIndex &index) const;
28 QVariant data(const QModelIndex & index, int role) const;
29 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
31 void setupModelData(QList<Score *> &scoreList, TreeItem *parent);
34 TreeItem *itemFromIndex(const QModelIndex &index) const;