VR-Engage  2.3
Loading...
Searching...
No Matches
makVre::DtEntityRoleTreeDelegate Class Reference

Detailed Description

Paints the assignment-status column for every node type:

  • Role leaf nodes: entity icon (assigned / pending / conflict) or grey dashed outline circle (unassigned), followed by the assigned station name(s). The icon is rendered via DtStationItemDelegate::paintAssignmentIndicator so conflict (red border) and pending-unassign (orange border) states are handled consistently.
  • Entity / Force branching nodes: left-justified "<assigned>/<total>" count text rendered in the standard item font.

Install this delegate on column 1 only:

view->setItemDelegateForColumn(1, new DtEntityRoleTreeDelegate(view));
DtEntityRoleTreeDelegate(QObject *parent=nullptr)
Constructor.

#include <entityRoleTreeDelegate.h>

Inheritance diagram for makVre::DtEntityRoleTreeDelegate:
[legend]

Public Member Functions

 DtEntityRoleTreeDelegate (QObject *parent=nullptr)
 
virtual ~DtEntityRoleTreeDelegate () override
 
virtual void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
virtual QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const override
 

Static Private Member Functions

static StationAssignmentStatus assignmentStatusFromIndex (const QModelIndex &index)
 

Constructor & Destructor Documentation

◆ DtEntityRoleTreeDelegate()

makVre::DtEntityRoleTreeDelegate::DtEntityRoleTreeDelegate ( QObject * parent = nullptr)
explicit

Constructor.

Parameters
parentOptional parent QObject

◆ ~DtEntityRoleTreeDelegate()

virtual makVre::DtEntityRoleTreeDelegate::~DtEntityRoleTreeDelegate ( )
overridevirtual

Destructor.

Member Function Documentation

◆ paint()

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

Paints a column-1 cell.

For role leaf rows: draws the assignment-indicator icon to the left, then the station-name text. For branching rows: draws the count text left-aligned using the standard item font and colour.

Parameters
painterThe active painter
optionStyle options (rect, palette, state)
indexThe model index being painted (must be column 1)

◆ sizeHint()

virtual QSize makVre::DtEntityRoleTreeDelegate::sizeHint ( const QStyleOptionViewItem & option,
const QModelIndex & index ) const
overridevirtual

Returns the preferred size hint for a column-1 cell.

Parameters
optionStyle options for the item
indexThe model index being sized
Returns
Preferred cell size

◆ assignmentStatusFromIndex()

static StationAssignmentStatus makVre::DtEntityRoleTreeDelegate::assignmentStatusFromIndex ( const QModelIndex & index)
staticprivate

Derives the assignment status for a role node from its model data.

Parameters
indexModel index of a role-leaf cell (column irrelevant)
Returns
StationAssignmentStatus for use with paintAssignmentIndicator

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