VR-Engage  2.2
Loading...
Searching...
No Matches
DtVreTableModel Class Reference

Detailed Description

This class implements a Qt table model for displaying and editing VREngage application information, including application names, assigned entities, station roles, and spectator mode settings.

#include <vreTableModel.h>

Inheritance diagram for DtVreTableModel:
[legend]

Public Types

using VreRecord
 
using VreTable = std::vector<VreRecord>
 

Public Member Functions

 DtVreTableModel (QObject *parent)
 
virtual ~DtVreTableModel () override
 
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
virtual int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
virtual bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
virtual QVariant headerData (int section, Qt::Orientation orientation, int role) const override
 
virtual Qt::ItemFlags flags (const QModelIndex &index) const override
 
virtual void addEntry (const VreRecord &vreRecord)
 
virtual void removeEntry (unsigned long id)
 
virtual void updateEntry (unsigned long id, const VreRecord &vreRecord)
 
virtual unsigned long id (int row) const
 
virtual std::string entityUUID (int row) const
 
virtual bool isDirty (int row) const
 
virtual void setDirty (int row, bool flag)
 
virtual bool tableIsDirty () const
 
virtual void clearDirtyFlags ()
 

Protected Attributes

VreTable myData
 

Member Typedef Documentation

◆ VreRecord

Initial value:
struct VreRecord
{
unsigned long myId;
std::string myName;
std::string myEntityUUID;
std::string myMarkingText;
std::string myStationName;
bool mySpectator;
bool myDirty;
QStringList myStationNameList;
}
struct VreRecord { unsigned long myId; std::string myName; std::string myEntityUUID; std::string myMarkingText; std::string myStationName; bool mySpectator; bool myDirty; QStringList myStationNameList; } VreRecord
Structure containing VREngage application status information.
Definition vreTableModel.h:40

Structure containing VREngage application status information.

Contains all the information about a VREngage application's identity and current configuration settings displayed in the manager table.

◆ VreTable

using DtVreTableModel::VreTable = std::vector<VreRecord>

Type definition for the table data container.

Vector of VREngage application records that makes up the table data.

Constructor & Destructor Documentation

◆ DtVreTableModel()

DtVreTableModel::DtVreTableModel ( QObject * parent)

Constructor.

Parameters
parentThe parent QObject

Initializes a new table model for VREngage application data.

◆ ~DtVreTableModel()

virtual DtVreTableModel::~DtVreTableModel ( )
overridevirtual

Destructor.

Cleans up resources used by the table model.

Member Function Documentation

◆ rowCount()

virtual int DtVreTableModel::rowCount ( const QModelIndex & parent = QModelIndex()) const
overridevirtual

Gets the number of rows in the model.

Parameters
parentThe parent model index
Returns
The number of VREngage applications in the table

Returns the number of rows (VREngage applications) in the table model.

◆ columnCount()

virtual int DtVreTableModel::columnCount ( const QModelIndex & parent = QModelIndex()) const
overridevirtual

Gets the number of columns in the model.

Parameters
parentThe parent model index
Returns
The number of data columns in the table

Returns the number of columns (data fields) in the table model.

◆ data()

virtual QVariant DtVreTableModel::data ( const QModelIndex & index,
int role = Qt::DisplayRole ) const
overridevirtual

Gets data for a cell in the table.

Parameters
indexThe model index of the cell
roleThe data role (display, edit, etc.)
Returns
The requested data as a QVariant

Returns the data for the specified cell and role. Handles display formatting, editor setup, and other data presentation aspects.

◆ setData()

virtual bool DtVreTableModel::setData ( const QModelIndex & index,
const QVariant & value,
int role = Qt::EditRole )
overridevirtual

Sets data for a cell in the table.

Parameters
indexThe model index of the cell to modify
valueThe new value to set
roleThe data role (usually Qt::EditRole)
Returns
True if successful, false otherwise

Updates the data for the specified cell and marks the record as dirty to indicate that changes need to be saved.

◆ headerData()

virtual QVariant DtVreTableModel::headerData ( int section,
Qt::Orientation orientation,
int role ) const
overridevirtual

Gets header data for the table.

Parameters
sectionThe row or column number
orientationThe header orientation (horizontal or vertical)
roleThe data role
Returns
The header data as a QVariant

Returns header labels for the table columns.

◆ flags()

virtual Qt::ItemFlags DtVreTableModel::flags ( const QModelIndex & index) const
overridevirtual

Gets flags for an item in the table.

Parameters
indexThe model index of the item
Returns
The item flags

Returns the flags for the specified item, including whether it's editable, selectable, enabled, etc.

◆ addEntry()

virtual void DtVreTableModel::addEntry ( const VreRecord & vreRecord)
virtual

Adds a new VREngage application entry to the table.

Parameters
vreRecordThe record to add

Adds a new VREngage application record to the table model and notifies views that the model has changed.

◆ removeEntry()

virtual void DtVreTableModel::removeEntry ( unsigned long id)
virtual

Removes a VREngage application entry from the table.

Parameters
idThe unique identifier of the application to remove

Removes the VREngage application with the specified ID from the table model and notifies views that the model has changed.

◆ updateEntry()

virtual void DtVreTableModel::updateEntry ( unsigned long id,
const VreRecord & vreRecord )
virtual

Updates an existing VREngage application entry.

Parameters
idThe unique identifier of the application to update
vreRecordThe new record data

Updates the data for the VREngage application with the specified ID and notifies views that the model has changed.

◆ id()

virtual unsigned long DtVreTableModel::id ( int row) const
virtual

Gets the ID of a VREngage application by row.

Parameters
rowThe row index
Returns
The unique identifier of the application

Returns the unique identifier of the VREngage application at the specified row. TODO – make these official columns and hide them

◆ entityUUID()

virtual std::string DtVreTableModel::entityUUID ( int row) const
virtual

Gets the entity UUID for a row.

Parameters
rowThe row index
Returns
The UUID of the entity assigned to the application

Returns the UUID of the entity assigned to the VREngage application at the specified row.

◆ isDirty()

virtual bool DtVreTableModel::isDirty ( int row) const
virtual

Checks if a row has unsaved changes.

Parameters
rowThe row index
Returns
True if the row has unsaved changes, false otherwise

Returns whether the VREngage application record at the specified row has unsaved changes.

◆ setDirty()

virtual void DtVreTableModel::setDirty ( int row,
bool flag )
virtual

Sets the dirty flag for a row.

Parameters
rowThe row index
flagThe new dirty state

Sets whether the VREngage application record at the specified row has unsaved changes.

◆ tableIsDirty()

virtual bool DtVreTableModel::tableIsDirty ( ) const
virtual

Checks if any rows in the table have unsaved changes.

Returns
True if any row has unsaved changes, false otherwise

Returns whether any VREngage application records in the table have unsaved changes.

◆ clearDirtyFlags()

virtual void DtVreTableModel::clearDirtyFlags ( )
virtual

Clears all dirty flags in the table.

Marks all VREngage application records in the table as clean (no unsaved changes). Called after changes have been saved or reverted.

Member Data Documentation

◆ myData

VreTable DtVreTableModel::myData
protected

The table data.

Container for all VREngage application records in the table.


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