DataViewer::DataViewerSelectionManager
DataViewer::DataViewerSelectionManager
Manages entity selection state for the DataViewer widget. More…
#include <DataViewerSelectionManager.hpp>
Inherits from QObject
Public Signals
| Name | |
|---|---|
| void | selectionChanged(EntityId id, bool selected) Emitted when an entity’s selection state changes. |
| void | selectionCleared() Emitted when all selections are cleared. |
| void | selectionModified() Emitted when the selection set changes in any way. |
Public Functions
| Name | |
|---|---|
| DataViewerSelectionManager(QObject * parent =[nullptr]) | |
| ~DataViewerSelectionManager() override =default | |
| void | select(EntityId id) Select an entity. |
| void | deselect(EntityId id) Deselect an entity. |
| void | toggle(EntityId id) Toggle selection state of an entity. |
| void | clear() Clear all selections. |
| void | handleEntityClick(EntityId id, bool ctrl_pressed) Handle entity click with modifier key support. |
| bool | isSelected(EntityId id) const Check if an entity is currently selected. |
| std::unordered_set< EntityId > const & | selectedEntities() const Get all currently selected entities. |
| bool | hasSelection() const Check if any entities are currently selected. |
| size_t | selectionCount() const Get the number of selected entities. |
Detailed Description
class DataViewer::DataViewerSelectionManager;Manages entity selection state for the DataViewer widget.
Provides a clean API for selecting, deselecting, and querying entities. Supports both single-select and multi-select (Ctrl+click) modes.
Public Signals Documentation
signal selectionChanged
void selectionChanged(
EntityId id,
bool selected
)Emitted when an entity’s selection state changes.
Parameters:
- id The EntityId that changed
- selected true if now selected, false if now deselected
signal selectionCleared
void selectionCleared()Emitted when all selections are cleared.
This is emitted before individual selectionChanged signals for each previously selected entity.
signal selectionModified
void selectionModified()Emitted when the selection set changes in any way.
This is a convenience signal for observers that just need to know that something changed, without caring about specifics.
Public Functions Documentation
function DataViewerSelectionManager
explicit DataViewerSelectionManager(
QObject * parent =nullptr
)function ~DataViewerSelectionManager
~DataViewerSelectionManager() override =defaultfunction select
void select(
EntityId id
)Select an entity.
Parameters:
- id EntityId to select
Adds the entity to the selection set. If already selected, this is a no-op. Emits selectionChanged(id, true) if the entity was not previously selected.
function deselect
void deselect(
EntityId id
)Deselect an entity.
Parameters:
- id EntityId to deselect
Removes the entity from the selection set. If not selected, this is a no-op. Emits selectionChanged(id, false) if the entity was previously selected.
function toggle
void toggle(
EntityId id
)Toggle selection state of an entity.
Parameters:
- id EntityId to toggle
If the entity is selected, deselects it. If not selected, selects it. Emits selectionChanged with the new state.
function clear
void clear()Clear all selections.
Removes all entities from the selection set. Emits selectionCleared() followed by selectionChanged for each deselected entity.
function handleEntityClick
void handleEntityClick(
EntityId id,
bool ctrl_pressed
)Handle entity click with modifier key support.
Parameters:
- id EntityId that was clicked
- ctrl_pressed true if Ctrl key was held during click
Implements standard selection behavior:
- Ctrl+click: Toggle selection of clicked entity (multi-select)
- Plain click: Clear selection, then select clicked entity
function isSelected
bool isSelected(
EntityId id
) constCheck if an entity is currently selected.
Parameters:
- id EntityId to check
Return: true if the entity is in the selection set
function selectedEntities
std::unordered_set< EntityId > const & selectedEntities() constGet all currently selected entities.
Return: Const reference to the selection set
function hasSelection
bool hasSelection() constCheck if any entities are currently selected.
Return: true if at least one entity is selected
function selectionCount
size_t selectionCount() constGet the number of selected entities.
Return: Number of entities in the selection set
Updated on 2026-11-13 at 20:25:42 +0000