SGSolve
sgactioncombomodel.hpp
1 // This file is part of the SGSolve library for stochastic games
2 // Copyright (C) 2019 Benjamin A. Brooks
3 //
4 // SGSolve free software: you can redistribute it and/or modify it
5 // under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // SGSolve is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see
16 // <http://www.gnu.org/licenses/>.
17 //
18 // Benjamin A. Brooks
19 // ben@benjaminbrooks.net
20 // Chicago, IL
21 
22 #ifndef SGACTIONCOMBOMODEL_V2_HPP
23 #define SGACTIONCOMBOMODEL_V2_HPP
24 
25 #include "sgplotcontroller.hpp"
26 #include <QAbstractListModel>
27 #include <QComboBox>
28 
30 
44 class SGActionComboModel : public QAbstractListModel
45 {
46  Q_OBJECT;
47 private:
50  int state = -1;
51 
52 public:
54  SGActionComboModel(SGPlotController * _controller);
55 
57  int rowCount(const QModelIndex & parent) const;
58 
60  QVariant data(const QModelIndex & index, int role) const;
61 
62 public slots:
64  void actionChanged(int index)
65  {
66  controller->setActionIndex(index-1);
67  }
69  void changeLayout();
70 
71 }; // SGActionComboModel
72 
73 #endif
SGPlotController
Handles the plot settings for SGSolutionHandler.
Definition: sgplotcontroller.hpp:41
SGActionComboModel::changeLayout
void changeLayout()
Signals to gui to change the layout.
Definition: sgactioncombomodel.cpp:69
SGActionComboModel::actionChanged
void actionChanged(int index)
Signals to the associated actionController to change the action.
Definition: sgactioncombomodel.hpp:64
SGActionComboModel::SGActionComboModel
SGActionComboModel(SGPlotController *_controller)
Constructor.
Definition: sgactioncombomodel.cpp:24
SGActionComboModel::rowCount
int rowCount(const QModelIndex &parent) const
Reimplement rowcount.
Definition: sgactioncombomodel.cpp:34
SGActionComboModel::controller
SGPlotController * controller
Pointer to the associated SGPlotController_V2 object.
Definition: sgactioncombomodel.hpp:46
SGActionComboModel::data
QVariant data(const QModelIndex &index, int role) const
Reimplement data.
Definition: sgactioncombomodel.cpp:46
SGActionComboModel
Model for the action select menu.
Definition: sgactioncombomodel.hpp:45
SGPlotController::setActionIndex
bool setActionIndex(int newActionIndex)
Sets the current action index.
Definition: sgplotcontroller.cpp:116