5 #include <QAbstractTableModel>
9 class PlayersModel : public QAbstractTableModel
12 PlayersModel(sqlite3 *db);
14 int rowCount(const QModelIndex &parent) const override
16 return players.size();
18 int columnCount(const QModelIndex &column) const override
22 QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
23 QVariant data(const QModelIndex &index, int role) const override;
25 int get_player_id(unsigned row) const {
26 return players[row].player_id;
28 std::string get_player_gender(unsigned row) const {
29 return players[row].gender;
31 std::string get_player_name_by_id(unsigned player_id);
32 std::string get_player_gender_by_id(unsigned player_id);
33 QModelIndex get_row_start_qt(unsigned row) const {
34 return createIndex(row, 0);
36 QModelIndex get_row_end_qt(unsigned row) const {
37 return createIndex(row, 2);
47 std::vector<Player> players;
54 #endif // !defined(_PLAYERS_H)