|
VR-Engage
2.3
|
DtVreStationListModel provides a flat list model where each item represents a VR-Engage station. The model displays station names and their current assignment status (entity and role).
The model consumes DtVreAssignmentTracker for assignment state and automatically refreshes when the tracker emits assignmentStateChanged().
#include <vreStationListModel.h>
Classes | |
| struct | EntityIcons |
Public Slots | |
| virtual void | refresh () |
Signals | |
| void | stationSelected (const std::string &stationId) |
Public Member Functions | |
| DtVreStationListModel (DtVreAssignmentTracker &tracker, QObject *parent=nullptr) | |
| virtual | ~DtVreStationListModel () override |
Query Methods | |
Methods for querying station information from model indices. | |
| virtual std::string | stationId (const QModelIndex &index) const |
| virtual std::string | stationName (const QModelIndex &index) const |
| virtual StationAssignmentStatus | assignmentStatus (const QModelIndex &index) const |
| virtual QModelIndex | indexForStation (const std::string &stationId) const |
Filtering | |
Methods for filtering the displayed stations. | |
| virtual void | setFilterPattern (const std::string &pattern) |
| virtual std::string | filterPattern () const |
| virtual void | setShowOnlyUnassigned (bool showOnly) |
| virtual bool | showOnlyUnassigned () const |
| virtual void | setShowOnlyAssigned (bool showOnly) |
| virtual bool | showOnlyAssigned () const |
| virtual void | setShowOnlyConflicts (bool showOnly) |
| virtual bool | showOnlyConflicts () const |
Entity Name Mapping | |
Methods for mapping entity UUIDs to display names. | |
| virtual void | setEntityName (const DtUUID &entityUUID, const std::string &displayName) |
| virtual void | removeEntityName (const DtUUID &entityUUID) |
| virtual void | clearEntityNames () |
| virtual std::string | entityDisplayName (const DtUUID &entityUUID) const |
| virtual std::string | entityObjectName (const DtUUID &entityUUID) const |
| std::string | assignmentEntityLabel (const std::string &stationId, const DtUUID &entityUUID) const |
| virtual void | setEntityIcon (const DtUUID &entityUUID, const QIcon &icon) |
| virtual void | setEntityIcon (const DtUUID &entityUUID, const QIcon &filledIcon, const QIcon &outlineIcon) |
| virtual void | clearEntityIcon (const DtUUID &entityUUID) |
QAbstractListModel Interface | |
Standard Qt model interface implementation. | |
| virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
| virtual QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
| virtual Qt::ItemFlags | flags (const QModelIndex &index) const override |
| virtual Qt::DropActions | supportedDragActions () const override |
| virtual QStringList | mimeTypes () const override |
| virtual QMimeData * | mimeData (const QModelIndexList &indexes) const override |
| virtual Qt::DropActions | supportedDropActions () const override |
| virtual bool | canDropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override |
| virtual bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override |
Protected Member Functions | |
| virtual bool | passesFilter (const std::string &stationId) const |
| virtual std::vector< std::string > | visibleStationIds () const |
Protected Attributes | |
| DtVreAssignmentTracker & | myTracker |
| std::vector< std::string > | myStationIds |
| std::map< DtUUID, std::string > | myEntityNames |
| std::map< DtUUID, EntityIcons > | myEntityIconCache |
| std::string | myFilterPattern |
| bool | myShowOnlyUnassigned = false |
| bool | myShowOnlyAssigned = false |
| bool | myShowOnlyConflicts = false |
Private Member Functions | |
| DtVreStationListModel (const DtVreStationListModel &)=delete | |
| DtVreStationListModel & | operator= (const DtVreStationListModel &)=delete |
| makVre::DtVreStationListModel::DtVreStationListModel | ( | DtVreAssignmentTracker & | tracker, |
| QObject * | parent = nullptr ) |
Constructor.
| tracker | Reference to the assignment tracker for state |
| parent | Optional parent QObject for Qt memory management |
Referenced by DtVreStationListModel(), and operator=().
|
overridevirtual |
Destructor.
|
privatedelete |
Copy constructor (deleted)
References DtVreStationListModel().
|
virtual |
Gets the station ID for a model index.
| index | The model index |
Referenced by assignmentEntityLabel(), indexForStation(), passesFilter(), and stationSelected().
|
virtual |
Gets the station name for a model index.
| index | The model index |
|
virtual |
Gets the assignment status for a station.
| index | The model index |
|
virtual |
Gets the model index for a station ID.
| stationId | The station ID to find |
References stationId().
|
virtual |
Sets the filter pattern for station names.
| pattern | Case-insensitive substring to filter by (empty shows all) |
Only stations whose name contains the pattern will be shown.
|
virtual |
Gets the current filter pattern.
|
virtual |
Sets whether to show only unassigned stations.
| showOnly | If true, hide stations with assignments |
|
virtual |
Gets whether showing only unassigned stations.
|
virtual |
Sets whether to show only assigned stations.
| showOnly | If true, hide stations without any assignment |
|
virtual |
Gets whether showing only assigned stations.
|
virtual |
Sets whether to show only stations involved in conflicts.
| showOnly | If true, only show stations with unresolved conflicts |
|
virtual |
Gets whether showing only conflict stations.
|
virtual |
Sets the entity name for a UUID.
| entityUUID | The entity UUID |
| displayName | The display name (VR-Forces objectName, with DIS marking text as a silent fallback) |
Used to display entity names in station assignment text. Call this when entities are added to the exercise.
|
virtual |
Removes the entity name mapping.
| entityUUID | The entity UUID to remove |
Call this when entities are removed from the exercise.
|
virtual |
Clears all entity name mappings.
|
virtual |
Gets the entity display name for a UUID.
| entityUUID | The entity UUID |
|
virtual |
Gets the tracked object name for a UUID, or empty if unknown.
| entityUUID | The entity UUID |
Unlike entityDisplayName(), this never substitutes a truncated UUID, so it is safe to persist: an entity whose name is not (yet) known is stored with an empty object name — the UUID remains the identifier — rather than a truncated-UUID string that would later be shown as if it were the name.
| std::string makVre::DtVreStationListModel::assignmentEntityLabel | ( | const std::string & | stationId, |
| const DtUUID & | entityUUID ) const |
Builds the entity label shown for a station's assignment.
| stationId | The station ID |
| entityUUID | The assigned entity UUID |
Offline placeholders prefer their persisted object name so the card shows a readable label even when the saved UUID does not reconstruct to a resolvable DtUUID.
References stationId().
|
virtual |
Stores the display icon for an entity UUID.
| entityUUID | UUID of the entity |
| icon | Icon to display when this entity is assigned to a station |
Called by DtVreManagerWidget whenever an entity is added to the tree. A subsequent dataChanged emission is NOT required here — the icon will be picked up on the next repaint triggered by assignment state changes.
This single-icon overload is a thin shim that copies icon into both the filled and outline cache slots; pending-state rows will therefore show the same filled glyph. Prefer the two-icon overload below to get distinct outline-only rendering for pending assignments (Phase 6).
|
virtual |
Stores both the filled and outline-only display icons for an entity.
| entityUUID | UUID of the entity |
| filledIcon | Icon used for confirmed and conflicting assignments |
| outlineIcon | Icon used for pending and pending-unassignment rows |
Phase 6: pending-assignment rows in the station list render the entity symbol outline-only (no force-color fill) to distinguish them from confirmed assignments. The two icons are produced once at ingestion by DtVrfGuiSymbolMapper::getIcon(..., fillMilStdSymbol = true / false) and cached together so paint never triggers a synchronous mapper call.
|
virtual |
Removes the cached icon for an entity UUID.
| entityUUID | UUID of the entity to remove |
Called by DtVreManagerWidget when an entity is removed from the tree.
|
overridevirtual |
Returns the number of rows in the model.
| parent | Parent index (unused for list models) |
|
overridevirtual |
Returns data for the given index and role.
| index | The model index |
| role | The data role |
Referenced by canDropMimeData(), and dropMimeData().
|
overridevirtual |
Returns item flags for the given index.
| index | The model index |
|
overridevirtual |
Returns supported drag actions.
|
overridevirtual |
Returns MIME types for drag and drop.
|
overridevirtual |
Creates MIME data for drag.
| indexes | Indexes to encode in MIME data |
|
overridevirtual |
Returns supported drop actions.
|
overridevirtual |
Checks whether dropped role data can be accepted.
References data().
|
overridevirtual |
Handles dropped role data to create a pending assignment.
References data().
|
virtualslot |
Refreshes the model from the tracker.
Called when the tracker's assignment state changes. Rebuilds the station list and emits appropriate change signals.
|
signal |
Emitted when a station is selected.
| stationId | The selected station ID |
References stationId().
|
protectedvirtual |
Checks if a station passes the current filters.
| stationId | Station ID to check |
References stationId().
|
protectedvirtual |
Gets the visible station IDs.
|
privatedelete |
Assignment operator (deleted)
References DtVreStationListModel().
|
protected |
Reference to the assignment tracker.
|
protected |
Cached list of station IDs (for stable ordering)
|
protected |
Map of entity UUID to display name.
|
protected |
Map of entity UUID to its display icons (filled + outline)
Populated by setEntityIcon() when entities are discovered and cleared by clearEntityIcon() when entities are removed. Used in data() to return entity-specific icons for the assignment indicator column.
|
protected |
Current filter pattern (lowercase)
|
protected |
Whether to show only unassigned stations.
|
protected |
|
protected |