BCESolve
bcepayofftablemodel.hpp
1// This file is part of the BCESolve library for games of incomplete
2// information
3// Copyright (C) 2022 Benjamin A. Brooks
4//
5// BCESolve free software: you can redistribute it and/or modify it
6// under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// BCESolve is distributed in the hope that it will be useful, but
11// WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13// General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see
17// <http://www.gnu.org/licenses/>.
18//
19// Benjamin A. Brooks
20// ben@benjaminbrooks.net
21// Chicago, IL
22
23#ifndef BCEPAYOFFTABLEMODEL_HPP
24#define BCEPAYOFFTABLEMODEL_HPP
25
26#include <QtWidgets>
27#include <QMainWindow>
28#include <QAbstractTableModel>
29#include <QTableView>
30#include "bcegame.hpp"
31#include "bcetablemodel.hpp"
32
34
43{
44 Q_OBJECT
45
46public:
49 int _state):
50 BCETableModel(_game,_state)
51 {}
52
54
57 QVariant data(const QModelIndex & index,
58 int role) const Q_DECL_OVERRIDE;
59
61
63 QVariant headerData(int section,
64 Qt::Orientation orientation,
65 int role) const Q_DECL_OVERRIDE;
66
68
70 bool setData(const QModelIndex & index, const QVariant & value, int role);
71
73 int rowCount(const QModelIndex & parent = QModelIndex()) const Q_DECL_OVERRIDE {
74 return game->getNumActions()[0];
75 }
76
78 int columnCount(const QModelIndex & parent = QModelIndex()) const Q_DECL_OVERRIDE {
79 return game->getNumActions()[1];
80 }
81
82}; // BCEPayoffTableModel
83
84#endif
const vector< int > & getNumActions() const
Returns a vector of the numbers of actions.
Definition: bceabstractgame.hpp:249
The base class for games of incomplete information.
Definition: bcegame.hpp:40
Derived class for payoff table models.
Definition: bcepayofftablemodel.hpp:43
bool setData(const QModelIndex &index, const QVariant &value, int role)
Sets data.
Definition: bcepayofftablemodel.cpp:79
BCEPayoffTableModel(BCEGame *_game, int _state)
Constructor.
Definition: bcepayofftablemodel.hpp:48
int columnCount(const QModelIndex &parent=QModelIndex()) const Q_DECL_OVERRIDE
Returns the number of column player actions.
Definition: bcepayofftablemodel.hpp:78
QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE
Returns formatted header data.
Definition: bcepayofftablemodel.cpp:58
int rowCount(const QModelIndex &parent=QModelIndex()) const Q_DECL_OVERRIDE
Returns the number of row player actions.
Definition: bcepayofftablemodel.hpp:73
QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE
Returns formatted data.
Definition: bcepayofftablemodel.cpp:25
Table models for BCEViewer.
Definition: bcetablemodel.hpp:40
BCEGame * game
Pointer to the associated game.
Definition: bcetablemodel.hpp:73