BCESolve
bceprobabilitytablemodel.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 BCEPROBABILITYTABLEMODEL_HPP
24#define BCEPROBABILITYTABLEMODEL_HPP
25
26#include <QtWidgets>
27#include <QAbstractTableModel>
28#include <QTableView>
29#include "bcegame.hpp"
30
32
38class BCEProbabilityTableModel : public QAbstractTableModel
39{
40 Q_OBJECT
41
42public:
45 game(_game)
46 { }
47
49
51 Qt::ItemFlags flags(const QModelIndex & index) const
52 { return Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable; }
53
55 int rowCount(const QModelIndex & parent = QModelIndex()) const Q_DECL_OVERRIDE
56 { return game->getNumStates(); }
58 int columnCount(const QModelIndex & parent = QModelIndex()) const Q_DECL_OVERRIDE
59 { return 1; }
60
63 { emit layoutChanged(); }
64
65protected:
68
69};
70
71
72
73
74
75#endif
int getNumStates() const
Returns the number of states.
Definition: bceabstractgame.hpp:247
The base class for games of incomplete information.
Definition: bcegame.hpp:40
Table models for BCEViewer.
Definition: bceprobabilitytablemodel.hpp:39
void emitLayoutChanged()
Emits layoutChanged signal.
Definition: bceprobabilitytablemodel.hpp:62
BCEGame * game
Pointer to the associated game.
Definition: bceprobabilitytablemodel.hpp:67
BCEProbabilityTableModel(BCEGame *_game)
Constructor.
Definition: bceprobabilitytablemodel.hpp:44
int rowCount(const QModelIndex &parent=QModelIndex()) const Q_DECL_OVERRIDE
Returns the number of row player actions.
Definition: bceprobabilitytablemodel.hpp:55
Qt::ItemFlags flags(const QModelIndex &index) const
Returns flags.
Definition: bceprobabilitytablemodel.hpp:51
int columnCount(const QModelIndex &parent=QModelIndex()) const Q_DECL_OVERRIDE
Returns the number of column player actions.
Definition: bceprobabilitytablemodel.hpp:58