SGSolve
SGPayoffTableModel Class Reference

Derived class for payoff table models. More...

#include <sgpayofftablemodel.hpp>

Inheritance diagram for SGPayoffTableModel:
Collaboration diagram for SGPayoffTableModel:

Public Member Functions

 SGPayoffTableModel (SGGame *_game, int _state)
 Constructor.
 
QVariant data (const QModelIndex &index, int role) const Q_DECL_OVERRIDE
 Returns formatted data. More...
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE
 Returns formatted header data. More...
 
bool setData (const QModelIndex &index, const QVariant &value, int role)
 Sets data. More...
 
- Public Member Functions inherited from SGTableModel
 SGTableModel (SGGame *_game, int _state)
 Constructor.
 
Qt::ItemFlags flags (const QModelIndex &index) const
 Returns flags. More...
 
int rowCount (const QModelIndex &parent=QModelIndex()) const Q_DECL_OVERRIDE
 Returns the number of row player actions.
 
int columnCount (const QModelIndex &parent=QModelIndex()) const Q_DECL_OVERRIDE
 Returns the number of column player actions.
 
void emitLayoutChanged ()
 Emits layoutChanged signal.
 
bool setState (int newState)
 Sets the state to newState.
 

Additional Inherited Members

- Protected Attributes inherited from SGTableModel
int state
 The state that the model is associated with.
 
SGGamegame
 Pointer to the associated game.
 

Detailed Description

Derived class for payoff table models.

This class handles the interface between SGTableView and the payoff matrices in SGGameHandler::game. Adds functionality for header data (using the row player action/ column player action conventions. Also reimplements the data() method to display an ordered pair of the two players' payoffs.

Member Function Documentation

◆ data()

QVariant SGPayoffTableModel::data ( const QModelIndex &  index,
int  role 
) const

Returns formatted data.

Returns an ordered pair of the two players' payoffs for the action profile specified in index. Reads this data from the game object using SGGame::getPayoffs.

◆ headerData()

QVariant SGPayoffTableModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const

Returns formatted header data.

Returns header data formatted to indicate the appropriate row/ column action.

◆ setData()

bool SGPayoffTableModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role 
)

Sets data.

Parses the data in value to set a new pair of payoffs. Sets the data using SGGame::setData.


The documentation for this class was generated from the following files: