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

Detailed Description

This delegate provides a checkbox editor for toggling spectator mode in the VREngage Manager interface. It handles the creation, display, and manipulation of the checkbox editor for spectator mode cells in the manager's table view.

#include <spectatorItemDelegate.h>

Inheritance diagram for DtSpectatorItemDelegate:
[legend]

Public Member Functions

 DtSpectatorItemDelegate (QObject *parent=0)
 
virtual ~DtSpectatorItemDelegate () override
 
virtual QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
virtual void destroyEditor (QWidget *editor, const QModelIndex &index) const override
 
virtual void setEditorData (QWidget *editor, const QModelIndex &index) const override
 
virtual void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
 
virtual void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
virtual void updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 

Protected Slots

virtual void onStateChanged (int state)
 

Protected Attributes

QCheckBox * myEditor
 

Constructor & Destructor Documentation

◆ DtSpectatorItemDelegate()

DtSpectatorItemDelegate::DtSpectatorItemDelegate ( QObject * parent = 0)

Constructor.

Parameters
parentThe parent object

Initializes a new spectator item delegate with the specified parent.

◆ ~DtSpectatorItemDelegate()

virtual DtSpectatorItemDelegate::~DtSpectatorItemDelegate ( )
overridevirtual

Destructor.

Cleans up resources used by the spectator item delegate.

Member Function Documentation

◆ createEditor()

virtual QWidget * DtSpectatorItemDelegate::createEditor ( QWidget * parent,
const QStyleOptionViewItem & option,
const QModelIndex & index ) const
overridevirtual

Creates a checkbox editor for spectator mode selection.

Parameters
parentThe parent widget
optionThe style options to use when drawing the editor
indexThe model index of the item being edited
Returns
A checkbox widget configured for spectator mode selection

Creates and configures a checkbox editor for toggling spectator mode.

◆ destroyEditor()

virtual void DtSpectatorItemDelegate::destroyEditor ( QWidget * editor,
const QModelIndex & index ) const
overridevirtual

Destroys the editor when editing is finished.

Parameters
editorThe editor widget to destroy
indexThe model index of the item that was being edited

Handles cleanup of the editor widget when editing is complete.

◆ setEditorData()

virtual void DtSpectatorItemDelegate::setEditorData ( QWidget * editor,
const QModelIndex & index ) const
overridevirtual

Sets the editor data based on the model index.

Parameters
editorThe editor widget to update
indexThe model index containing the data to edit

Populates the checkbox with data from the model (checked/unchecked state).

◆ setModelData()

virtual void DtSpectatorItemDelegate::setModelData ( QWidget * editor,
QAbstractItemModel * model,
const QModelIndex & index ) const
overridevirtual

Updates the model with data from the editor.

Parameters
editorThe editor widget containing the updated data
modelThe model to update
indexThe model index to update

Transfers the checkbox state back to the model when editing is complete.

◆ paint()

virtual void DtSpectatorItemDelegate::paint ( QPainter * painter,
const QStyleOptionViewItem & option,
const QModelIndex & index ) const
overridevirtual

Custom painting for the checkbox in the view.

Parameters
painterThe painter to use for drawing
optionThe style options to use when drawing
indexThe model index of the item to draw

Handles custom drawing of the checkbox in the view when not being edited.

◆ updateEditorGeometry()

virtual void DtSpectatorItemDelegate::updateEditorGeometry ( QWidget * editor,
const QStyleOptionViewItem & option,
const QModelIndex & index ) const
overridevirtual

Updates the editor's geometry.

Parameters
editorThe editor widget to update
optionThe style options to use when positioning
indexThe model index of the item being edited

Positions the checkbox editor appropriately in the cell.

◆ onStateChanged

virtual void DtSpectatorItemDelegate::onStateChanged ( int state)
protectedvirtualslot

Handles checkbox state changes.

Parameters
stateThe new state of the checkbox

Called when the checkbox state changes between checked and unchecked.

Member Data Documentation

◆ myEditor

QCheckBox* DtSpectatorItemDelegate::myEditor
mutableprotected

The checkbox editor widget.

Maintains a reference to the currently active checkbox editor. Declared mutable to allow modification in const methods.


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