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:
DtEntityRoleTreeDelegate(QObject *parent=nullptr)
Constructor.
#include <entityRoleTreeDelegate.h>
|
| | 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 |
| |
◆ DtEntityRoleTreeDelegate()
| makVre::DtEntityRoleTreeDelegate::DtEntityRoleTreeDelegate |
( |
QObject * | parent = nullptr | ) |
|
|
explicit |
Constructor.
- Parameters
-
| parent | Optional parent QObject |
◆ ~DtEntityRoleTreeDelegate()
| virtual makVre::DtEntityRoleTreeDelegate::~DtEntityRoleTreeDelegate |
( |
| ) |
|
|
overridevirtual |
◆ 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
-
| painter | The active painter |
| option | Style options (rect, palette, state) |
| index | The 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
-
| option | Style options for the item |
| index | The 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
-
| index | Model 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: