NDEVR
API Documentation
SceneTree

Shows all objects in a QTModelManager in a tree hierarchy view that allows for user interaction. More...

Public Member Functions

 SceneTree (QTModelManager *manager, QWidget *parent=nullptr)
 Constructs a scene tree from a model manager.
 SceneTree (QTModelManagerView *view, QWidget *parent=nullptr)
 Constructs a scene tree from a model manager view.
void contextMenu (const QPoint &pos)
 Opens a context menu at the given position.
void createContextMenu (const Buffer< UUID > &ids, const QPoint &pos)
 Creates and displays a context menu for the given objects at the specified position.
void initialize ()
 Initializes the tree view, connecting signals and setting up delegates.
QTModelManagermanager () const
 Retrieves the model manager used by this tree.
Buffer< UUIDselectedObjects () const
 Retrieves the UUIDs of all currently selected objects.
void setCustomHeader (const TranslatedString &header_title, const StringView &header_icon=StringView(), bool allow_click=true)
 Sets a custom header for the tree view.
void setCustomSizeHint (const QSize &size)
 Sets a custom size hint for the tree widget.
void setIsRootFilter (const std::function< bool(const Model &)> &filter)
 Sets a filter function that determines which models appear as root nodes.
void setRootModels (const Buffer< UUID > &ids)
 Sets the root models displayed in the tree.
void setShowMaterials (bool show_materials)
 Sets whether materials are shown as child items in the tree.
void setVisibleFilter (const std::function< bool(const Model &)> &filter)
 Sets a filter function that determines which models are visible in the tree.
void updateExpanded (const QModelIndex &index)
 Updates the expanded state for a given index.
void updateFocus (UUID id, bool focussed)
 Updates the focus state of an object in the tree.
void updateModel (UUID id)
 Updates the display of a model in the tree.
void updateSelection (Buffer< UUID > ids, bool selected)
 Updates the selection state of objects in the tree.

Protected Member Functions

void onCollapsedSlot (const QModelIndex &index)
 Handles item collapse events.
void onExpandedSlot (const QModelIndex &index)
 Handles item expansion events.
void setup ()
 Sets up the tree view connections and model.

Detailed Description

Shows all objects in a QTModelManager in a tree hierarchy view that allows for user interaction.


Definition at line 53 of file SceneTree.h.

Constructor & Destructor Documentation

◆ SceneTree() [1/2]

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

Constructs a scene tree from a model manager.

Parameters
[in]managerThe model manager to display.
[in]parentThe parent widget.

References manager().

◆ SceneTree() [2/2]

SceneTree::SceneTree ( QTModelManagerView * view,
QWidget * parent = nullptr )
explicit

Constructs a scene tree from a model manager view.

Parameters
[in]viewThe model manager view to display.
[in]parentThe parent widget.

Member Function Documentation

◆ contextMenu()

void SceneTree::contextMenu ( const QPoint & pos)

Opens a context menu at the given position.

Parameters
[in]posThe position for the context menu.

◆ createContextMenu()

void SceneTree::createContextMenu ( const Buffer< UUID > & ids,
const QPoint & pos )

Creates and displays a context menu for the given objects at the specified position.

Parameters
[in]idsThe UUIDs of the selected objects.
[in]posThe screen position for the menu.

◆ manager()

QTModelManager * SceneTree::manager ( ) const

Retrieves the model manager used by this tree.

Returns
A pointer to the QTModelManager.

Referenced by SceneTree(), and BuildActionProgramLogic::setTreeWidgetsForSelection().

◆ onCollapsedSlot()

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

Handles item collapse events.

Parameters
[in]indexThe collapsed index.

◆ onExpandedSlot()

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

Handles item expansion events.

Parameters
[in]indexThe expanded index.

◆ selectedObjects()

Buffer< UUID > SceneTree::selectedObjects ( ) const

Retrieves the UUIDs of all currently selected objects.

Returns
A buffer of selected object UUIDs.

◆ setCustomHeader()

void SceneTree::setCustomHeader ( const TranslatedString & header_title,
const StringView & header_icon = StringView(),
bool allow_click = true )

Sets a custom header for the tree view.

Parameters
[in]header_titleThe translated title for the header.
[in]header_iconThe icon identifier for the header.
[in]allow_clickWhether clicking the header triggers an action.

◆ setCustomSizeHint()

void SceneTree::setCustomSizeHint ( const QSize & size)

Sets a custom size hint for the tree widget.

Parameters
[in]sizeThe custom size hint.

◆ setIsRootFilter()

void SceneTree::setIsRootFilter ( const std::function< bool(const Model &)> & filter)

Sets a filter function that determines which models appear as root nodes.

Parameters
[in]filterA function returning true for models that should be roots.

◆ setRootModels()

void SceneTree::setRootModels ( const Buffer< UUID > & ids)

Sets the root models displayed in the tree.

Parameters
[in]idsThe UUIDs of the root models.

◆ setShowMaterials()

void SceneTree::setShowMaterials ( bool show_materials)

Sets whether materials are shown as child items in the tree.

Parameters
[in]show_materialsWhether to show materials.

◆ setVisibleFilter()

void SceneTree::setVisibleFilter ( const std::function< bool(const Model &)> & filter)

Sets a filter function that determines which models are visible in the tree.

Parameters
[in]filterA function returning true for models that should be shown.

◆ updateExpanded()

void SceneTree::updateExpanded ( const QModelIndex & index)

Updates the expanded state for a given index.

Parameters
[in]indexThe model index to update.

◆ updateFocus()

void SceneTree::updateFocus ( UUID id,
bool focussed )

Updates the focus state of an object in the tree.

Parameters
[in]idThe UUID of the object.
[in]focussedWhether the object gained focus.

◆ updateModel()

void SceneTree::updateModel ( UUID id)

Updates the display of a model in the tree.

Parameters
[in]idThe UUID of the model to update.

◆ updateSelection()

void SceneTree::updateSelection ( Buffer< UUID > ids,
bool selected )

Updates the selection state of objects in the tree.

Parameters
[in]idsThe UUIDs of the affected objects.
[in]selectedWhether the objects were selected or deselected.

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