BCESolve
|
Model for Objective Weights in the BCEViewer. More...
#include <bceobjweightstablemodel.hpp>
Public Member Functions | |
BCEObjWeightsTableModel (BCEGame *_game) | |
Constructor. More... | |
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. | |
QVariant | data (const QModelIndex &index, int role) const Q_DECL_OVERRIDE |
Reimplements the data method. More... | |
bool | setData (const QModelIndex &index, const QVariant &value, int role) |
Reimplements the setData method. More... | |
QVariant | headerData (int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE |
Returns formatted header data. More... | |
void | addObjective (int position) |
Adds an objective to the weight data vector. | |
void | removeObjective (int position) |
Removes an objective from the weight data and label vectors. More... | |
const vector< double > | getSolverData () |
Returns a reference to the weight data vector. | |
const vector< vector< double > > | getMapBoundaryData () |
Returns a reference to the weight data vector. | |
void | resetObjectiveWeights () |
Resets weights on objectives. | |
Protected Attributes | |
BCEGame * | game |
Pointer to the associated game. | |
Private Member Functions | |
void | setWeightData (vector< int > cellLocation, double value) |
Sets data in the objective weights vectors. | |
Model for Objective Weights in the BCEViewer.
Specializes QAbstractTableModel for the BCEViewer program. Sets flags, reimplements the rowCount method to return the numbers of objectives.
Also contains two data members, mainObjWeights and secondaryObjWeights, that store the objective weights set by the user in the game tab. Interfacing with the game occurs through the add and remove objective functions in the bcegamehandler.
|
inline |
Constructor.
Sets the size of the weightData vector equal to the number of objectives in the game. Sets default weight data to .5 on player 0 and player 1's objectives. Gets any existing objective labels from the game.
QVariant BCEObjWeightsTableModel::data | ( | const QModelIndex & | index, |
int | role | ||
) | const |
Reimplements the data method.
Retrieves the current weight set for a specified objective.
|
inline |
Returns flags.
Returns flags that indicate the model is enabled, can be edited, and can be selected.
QVariant BCEObjWeightsTableModel::headerData | ( | int | section, |
Qt::Orientation | orientation, | ||
int | role | ||
) | const |
Returns formatted header data.
Returns header data formatted to indicate the appropriate objective labels.
|
inline |
Removes an objective from the weight data and label vectors.
Note that BCEGameHandler performs the check to determine if the vector has at least 1 element.
bool BCEObjWeightsTableModel::setData | ( | const QModelIndex & | index, |
const QVariant & | value, | ||
int | role | ||
) |
Reimplements the setData method.
Sets the weight on the specified objective.