BCESolve
bceconditionaltablemodel.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 BCECONDITIONALTABLEMODEL_HPP
24#define BCECONDITIONALTABLEMODEL_HPP
25
26#include <QtWidgets>
27#include <QAbstractTableModel>
28#include <QTableView>
29#include "bcegame.hpp"
30#include "bcetablemodel.hpp"
31
33
41{
42 Q_OBJECT
43
44public:
46 BCEConditionalTableModel(BCEGame * _game,int _state):
47 // 1 is the index for a conditional table model
48 BCETableModel(_game,_state)
49 { }
50
52
54 QVariant data(const QModelIndex & index,
55 int role) const Q_DECL_OVERRIDE;
56
58
59 bool setData(const QModelIndex & index, const QVariant & value, int role);
60
62 QVariant headerData(int section,
63 Qt::Orientation orientation,
64 int role) const;
65
67 int rowCount(const QModelIndex & parent = QModelIndex()) const Q_DECL_OVERRIDE {
68 return game->getNumTypes()[0];
69 }
70
72 int columnCount(const QModelIndex & parent = QModelIndex()) const Q_DECL_OVERRIDE {
73 return game->getNumTypes()[1];
74 }
75
76};
77
78
79
80
81
82#endif
const vector< int > & getNumTypes() const
Returns a vector of the numbers of types.
Definition: bceabstractgame.hpp:251
Table models for BCEViewer.
Definition: bceconditionaltablemodel.hpp:41
int rowCount(const QModelIndex &parent=QModelIndex()) const Q_DECL_OVERRIDE
Returns the number of row player types.
Definition: bceconditionaltablemodel.hpp:67
QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE
Reimplements the data method.
Definition: bceconditionaltablemodel.cpp:26
BCEConditionalTableModel(BCEGame *_game, int _state)
Constructor.
Definition: bceconditionaltablemodel.hpp:46
QVariant headerData(int section, Qt::Orientation orientation, int role) const
Labels Rows and Columns in the Conditional Distn Table.
Definition: bceconditionaltablemodel.cpp:45
int columnCount(const QModelIndex &parent=QModelIndex()) const Q_DECL_OVERRIDE
Returns the number of column player types.
Definition: bceconditionaltablemodel.hpp:72
bool setData(const QModelIndex &index, const QVariant &value, int role)
Reimplements the setData method.
Definition: bceconditionaltablemodel.cpp:66
The base class for games of incomplete information.
Definition: bcegame.hpp:40
Table models for BCEViewer.
Definition: bcetablemodel.hpp:40
BCEGame * game
Pointer to the associated game.
Definition: bcetablemodel.hpp:73