NDEVR
API Documentation
ModelSelectionTree

A tree view widget for displaying and selecting Models from the scene. More...

Public Member Functions

 ModelSelectionTree (ProxyModelViewFilter *manager, bool owns_filter, QWidget *parent=nullptr)
 Constructs the tree view with a custom proxy filter.
 ModelSelectionTree (QTModelManager *manager, QWidget *parent=nullptr)
 Constructs the tree view with the given model manager.
 ModelSelectionTree (QWidget *parent=nullptr)
 Constructs the tree view with no initial model manager.
virtual ~ModelSelectionTree ()
 Destroys the tree view and optionally deletes the owned filter.
void checkStateChanged ()
 Emitted when the check state of any item changes.
bool event (QEvent *e) override
 Processes general Qt events, including tooltip and drag events.
void expandSelected ()
 Expands the tree to show all currently selected items.
ProxyModelViewFilterfilter () const
 Returns the proxy filter model used by this tree view.
Buffer< UUIDgetModelRoots () const
 Returns the UUIDs of all root-level models in the tree.
Buffer< UUIDgetSelectedModelRoots () const
 Returns the UUIDs of all checked root-level models.
QTModelManagermanager () const
 Returns the model manager associated with this tree view.
void resizeEvent (QResizeEvent *size) override
 Handles resize events to adjust column widths.
void selectAllVisible ()
 Selects all visible items in the tree view.
void setFilter (ProxyModelViewFilter *filter, bool owns_filter)
 Sets a custom proxy filter for the tree view.
void setHeader (const TranslatedString &header_title, const StringView &header_icon)
 Sets the header title and icon for the tree view.
void setModelManager (QTModelManager *manager)
 Sets the model manager and creates a default proxy filter.
void setSelectedModelRoots (const Buffer< UUID > &roots, bool only_visible_children)
 Sets the check state for the given root models and optionally their visible children.

Protected Member Functions

void clickedSlot (const QModelIndex &index)
 Slot called when a tree item is clicked.
void contextMenu (const QPoint &pos)
 Slot called to show the context menu at the given position.
void initialize ()
 Initializes common state such as context menu policy and column settings.
void onCollapsedSlot (const QModelIndex &index)
 Slot called when a tree item is collapsed.
void onExpandedSlot (const QModelIndex &index)
 Slot called when a tree item is expanded.
void selectionChanged (const QItemSelection &selected, const QItemSelection &) override
 Slot called when the tree selection changes, updating the scene selection.
void setupFilter (ProxyModelViewFilter *filter)
 Configures the proxy filter and connects its signals to the tree view.
void updateFocus (UUID id, bool focussed)
 Slot called to update the focus highlight for a model.
void updateModel (UUID id)
 Slot called when a model is updated, refreshing its tree display.
void updateSelection (UUID id, bool selected)
 Slot called when a model's selection state changes.

Detailed Description

A tree view widget for displaying and selecting Models from the scene.


Supports filtering, context menus, multi-selection, and synchronization with the scene selection state.

Definition at line 51 of file ModelSelectionTree.h.

Constructor & Destructor Documentation

◆ ModelSelectionTree() [1/3]

ModelSelectionTree::ModelSelectionTree ( QWidget * parent = nullptr)
explicit

Constructs the tree view with no initial model manager.

Parameters
[in]parentThe optional parent widget.

◆ ModelSelectionTree() [2/3]

ModelSelectionTree::ModelSelectionTree ( QTModelManager * manager,
QWidget * parent = nullptr )
explicit

Constructs the tree view with the given model manager.

Parameters
[in]managerThe model manager providing scene data.
[in]parentThe optional parent widget.

References manager().

◆ ModelSelectionTree() [3/3]

ModelSelectionTree::ModelSelectionTree ( ProxyModelViewFilter * manager,
bool owns_filter,
QWidget * parent = nullptr )
explicit

Constructs the tree view with a custom proxy filter.

Parameters
[in]managerThe proxy filter model for displaying filtered models.
[in]owns_filterWhether this widget owns and will delete the filter.
[in]parentThe optional parent widget.

References manager().

Member Function Documentation

◆ clickedSlot()

void ModelSelectionTree::clickedSlot ( const QModelIndex & index)
protected

Slot called when a tree item is clicked.

Parameters
[in]indexThe model index of the clicked item.

◆ contextMenu()

void ModelSelectionTree::contextMenu ( const QPoint & pos)
protected

Slot called to show the context menu at the given position.

Parameters
[in]posThe position in tree view coordinates.

◆ event()

bool ModelSelectionTree::event ( QEvent * e)
override

Processes general Qt events, including tooltip and drag events.

Parameters
[in]eThe event to process.
Returns
True if the event was handled.

◆ filter()

ProxyModelViewFilter * ModelSelectionTree::filter ( ) const

Returns the proxy filter model used by this tree view.

Returns
A pointer to the ProxyModelViewFilter.

Referenced by setFilter(), and setupFilter().

◆ getModelRoots()

Buffer< UUID > ModelSelectionTree::getModelRoots ( ) const

Returns the UUIDs of all root-level models in the tree.

Returns
A buffer of root model UUIDs.

◆ getSelectedModelRoots()

Buffer< UUID > ModelSelectionTree::getSelectedModelRoots ( ) const

Returns the UUIDs of all checked root-level models.

Returns
A buffer of selected root model UUIDs.

◆ manager()

QTModelManager * ModelSelectionTree::manager ( ) const

Returns the model manager associated with this tree view.

Returns
A pointer to the QTModelManager.

Referenced by ModelSelectionTree(), ModelSelectionTree(), and setModelManager().

◆ onCollapsedSlot()

void ModelSelectionTree::onCollapsedSlot ( const QModelIndex & index)
protected

Slot called when a tree item is collapsed.

Parameters
[in]indexThe model index of the collapsed item.

◆ onExpandedSlot()

void ModelSelectionTree::onExpandedSlot ( const QModelIndex & index)
protected

Slot called when a tree item is expanded.

Parameters
[in]indexThe model index of the expanded item.

◆ resizeEvent()

void ModelSelectionTree::resizeEvent ( QResizeEvent * size)
override

Handles resize events to adjust column widths.

Parameters
[in]sizeThe resize event.

◆ selectionChanged()

void ModelSelectionTree::selectionChanged ( const QItemSelection & selected,
const QItemSelection &  )
overrideprotected

Slot called when the tree selection changes, updating the scene selection.

Parameters
[in]selectedThe newly selected items.

◆ setFilter()

void ModelSelectionTree::setFilter ( ProxyModelViewFilter * filter,
bool owns_filter )

Sets a custom proxy filter for the tree view.

Parameters
[in]filterThe proxy filter model.
[in]owns_filterWhether this widget owns and will delete the filter.

References filter().

◆ setHeader()

void ModelSelectionTree::setHeader ( const TranslatedString & header_title,
const StringView & header_icon )

Sets the header title and icon for the tree view.

Parameters
[in]header_titleThe translated header text.
[in]header_iconThe icon resource name.

◆ setModelManager()

void ModelSelectionTree::setModelManager ( QTModelManager * manager)

Sets the model manager and creates a default proxy filter.

Parameters
[in]managerThe model manager to use.

References manager().

◆ setSelectedModelRoots()

void ModelSelectionTree::setSelectedModelRoots ( const Buffer< UUID > & roots,
bool only_visible_children )

Sets the check state for the given root models and optionally their visible children.

Parameters
[in]rootsThe UUIDs of root models to select.
[in]only_visible_childrenWhether to only select visible children.

◆ setupFilter()

void ModelSelectionTree::setupFilter ( ProxyModelViewFilter * filter)
protected

Configures the proxy filter and connects its signals to the tree view.

Parameters
[in]filterThe proxy filter to set up.

References filter().

◆ updateFocus()

void ModelSelectionTree::updateFocus ( UUID id,
bool focussed )
protected

Slot called to update the focus highlight for a model.

Parameters
[in]idThe UUID of the model.
[in]focussedWhether the model should be focussed.

◆ updateModel()

void ModelSelectionTree::updateModel ( UUID id)
protected

Slot called when a model is updated, refreshing its tree display.

Parameters
[in]idThe UUID of the updated model.

◆ updateSelection()

void ModelSelectionTree::updateSelection ( UUID id,
bool selected )
protected

Slot called when a model's selection state changes.

Parameters
[in]idThe UUID of the model.
[in]selectedWhether the model is now selected.

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