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.
9 #include <QAbstractTableModel>
18 void setYear(QString &year) { m_year = year.toInt(); }
19 int year() { return m_year; }
21 void setRounds(int n) { m_rounds = n; }
22 int rounds() { return m_rounds; }
24 void setAverage(int n) { m_average = n; }
25 int average() { return m_average; }
27 void setMin(int n) { m_min = n; }
28 int min() { return m_min; }
30 void setMax(int n) { m_max = n; }
31 int max() { return m_max; }
33 void setBirdies(int n) { m_birdies = n; }
34 int birdies() { return m_birdies; }
36 void setPars(int n) { m_pars = n; }
37 int pars() { return m_pars; }
39 void setBogeys(int n) { m_bogeys = n; }
40 int bogeys() { return m_bogeys; }
42 void setMore(int n) { m_more = n; }
43 int more() { return m_more; }
58 class StatModel : public QAbstractTableModel
63 StatModel(QList<Club *> &clubList, QList<Score *> &scoreList);
65 int rowCount(const QModelIndex & parent) const;
66 int columnCount(const QModelIndex & parent) const;
67 QVariant data(const QModelIndex & index, int role) const;
68 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
73 Course *findCourse(const QString &clubName,
74 const QString &courseName);
76 enum { ROWS = 8, COLS = 4 };
77 enum { ROW_ROUNDS = 0,
87 COL_1ST_YEAR, // Latest year
88 COL_2ND_YEAR, // One before latest
89 COL_3RD_YEAR // Two before latest
93 QList<Club *> &clubList;
94 QList<Score *> &scoreList;
96 QList<StatItem *> stat;