NDEVR
API Documentation
DesignObjectChooser

Provides a screen of buttons that allow the user to pick a Model for an action. More...

Collaboration diagram for DesignObjectChooser:
[legend]

Public Member Functions

 DesignObjectChooser (LibraryManager *manager, QWidget *parent=nullptr)
 Constructs a DesignObjectChooser using the given library manager.
 DesignObjectChooser (QTModelManager *manager, QWidget *parent=nullptr)
 Constructs a DesignObjectChooser using the given model manager.
 DesignObjectChooser (QWidget *parent=nullptr)
 Constructs a DesignObjectChooser with no manager.
LibraryManageractiveLibrary ()
 Returns the active library manager.
void addButton (Button *button)
 Adds a custom button to the chooser toolbar.
void addCategory (const StringView &name, const Buffer< UUID > &items)
 Adds a named category with the specified items to the chooser.
bool assignToModel (UUID id, Model &model)
 Assigns the design object with the given UUID to the specified model.
bool assignToSelection (Model &model)
 Assigns the current selection to the specified model.
void clear ()
 Clears all categories and items from the chooser.
void contextMenuChangedSignal ()
 Emitted when the context menu configuration changes.
Buffer< UUIDcurrentSelection () const
 Returns the UUIDs of the currently selected design objects.
void filter (const String &keyword_search)
 Filters the displayed items by a keyword search string.
void filterFromArchive ()
 Filters the displayed items using data from the archive.
void filterFromManager ()
 Filters the displayed items using data from the model manager.
void onSelectedSignal (Buffer< UUID > id)
 Emitted when the selection changes.
void onUserSelectedSignal (Buffer< UUID > id)
 Emitted when the user explicitly selects objects (as opposed to programmatic selection).
void removeCategory (const StringView &name)
 Removes a category by name from the chooser.
void setCategory (const String &category)
 Sets the active category by name.
void setLibraryManager (LibraryManager *manager)
 Sets the library manager used to populate archived objects.
void setModelManager (QTModelManager *manager)
 Sets the model manager used to populate design objects.
void setSelected (const Buffer< UUID > &id)
 Sets the currently selected items by their UUIDs.
void setSelectionMode (DesignObjectGallery::SelectionMode selection_mode)
 Sets the selection mode for the gallery (single or multi-select).
void showActiveMaterialsCategory (bool show)
 Sets whether the active materials category is shown.
void showActiveModelsCategory (bool show)
 Sets whether the active models category is shown.
QSize sizeHint () const override
 Returns the recommended size for this widget.
void updateFromArchive (bool refresh_archive_files)
 Updates the chooser contents from the archive.
void updateFromArchive (bool show_active_models, bool show_active_materials, bool refresh_archive_files)
 Updates the chooser contents from the archive with full control over categories.

Protected Member Functions

void exportImages ()
 Exports images of the selected design objects.
void init ()
 Initializes the UI layout and connects signals.
void initContextMenu (Button *button)
 Initializes the context menu for a button.
void onCategoryChanged ()
 Slot called when the active category is changed by the user.
void setSaveSelection (bool multiselection)
 Configures the chooser for save-selection mode.
void showFileMenu (bool is_save, const Buffer< UUID > &ids=Buffer< UUID >())
 Shows the file import/export menu.

Protected Attributes

Dictionary< String, Buffer< UUID > > m_categories
 Category-to-UUID mapping for category filtering.
Buffer< Stringm_category_list
 Ordered list of category names.
DesignObjectGallery::SelectionMode m_default_mode = DesignObjectGallery::SelectionMode::e_single_selection
 The default gallery selection mode.
bool m_is_library = false
 Whether this chooser is sourcing from a library archive.
bool m_is_material_chooser
 Whether this chooser is configured for materials.
bool m_is_model_chooser
 Whether this chooser is configured for models.
bool m_is_save_selection = false
 Whether save-selection mode is active.
String m_keyword_search
 The current keyword search filter.
Dictionary< String, Buffer< UUID > > m_keywords
 Keyword-to-UUID mapping for search filtering.
LibraryManagerm_library_manager
 The library manager providing archived objects.
QTModelManagerm_manager
 The model manager providing scene data.
Ui::DesignObjectChooserUI * ui
 Pointer to the auto-generated UI form.

Detailed Description

Provides a screen of buttons that allow the user to pick a Model for an action.


Definition at line 44 of file DesignObjectChooser.h.

Constructor & Destructor Documentation

◆ DesignObjectChooser() [1/3]

DesignObjectChooser::DesignObjectChooser ( QWidget * parent = nullptr)

Constructs a DesignObjectChooser with no manager.

Parameters
[in]parentThe parent widget.

◆ DesignObjectChooser() [2/3]

DesignObjectChooser::DesignObjectChooser ( QTModelManager * manager,
QWidget * parent = nullptr )

Constructs a DesignObjectChooser using the given model manager.

Parameters
[in]managerThe model manager providing design objects.
[in]parentThe parent widget.

◆ DesignObjectChooser() [3/3]

DesignObjectChooser::DesignObjectChooser ( LibraryManager * manager,
QWidget * parent = nullptr )

Constructs a DesignObjectChooser using the given library manager.

Parameters
[in]managerThe library manager providing archived objects.
[in]parentThe parent widget.

Member Function Documentation

◆ activeLibrary()

LibraryManager * DesignObjectChooser::activeLibrary ( )

Returns the active library manager.

Returns
Pointer to the active LibraryManager.

◆ addButton()

void DesignObjectChooser::addButton ( Button * button)

Adds a custom button to the chooser toolbar.

Parameters
[in]buttonThe button to add.

◆ addCategory()

void DesignObjectChooser::addCategory ( const StringView & name,
const Buffer< UUID > & items )

Adds a named category with the specified items to the chooser.

Parameters
[in]nameThe display name of the category.
[in]itemsThe UUIDs of design objects in this category.

◆ assignToModel()

bool DesignObjectChooser::assignToModel ( UUID id,
Model & model )

Assigns the design object with the given UUID to the specified model.

Parameters
[in]idThe UUID of the design object to assign.
[in]modelThe target model to receive the assignment.
Returns
True if the assignment was successful.

◆ assignToSelection()

bool DesignObjectChooser::assignToSelection ( Model & model)

Assigns the current selection to the specified model.

Parameters
[in]modelThe target model to receive the selection.
Returns
True if the assignment was successful.

◆ currentSelection()

Buffer< UUID > DesignObjectChooser::currentSelection ( ) const

Returns the UUIDs of the currently selected design objects.

Returns
A buffer of selected UUIDs.

◆ filter()

void DesignObjectChooser::filter ( const String & keyword_search)

Filters the displayed items by a keyword search string.

Parameters
[in]keyword_searchThe search string to filter by.

◆ initContextMenu()

void DesignObjectChooser::initContextMenu ( Button * button)
protected

Initializes the context menu for a button.

Parameters
[in]buttonThe button to attach the context menu to.

◆ onSelectedSignal()

void DesignObjectChooser::onSelectedSignal ( Buffer< UUID > id)

Emitted when the selection changes.

Parameters
[in]idThe UUIDs of the newly selected objects.

◆ onUserSelectedSignal()

void DesignObjectChooser::onUserSelectedSignal ( Buffer< UUID > id)

Emitted when the user explicitly selects objects (as opposed to programmatic selection).

Parameters
[in]idThe UUIDs of the user-selected objects.

◆ removeCategory()

void DesignObjectChooser::removeCategory ( const StringView & name)

Removes a category by name from the chooser.

Parameters
[in]nameThe name of the category to remove.

◆ setCategory()

void DesignObjectChooser::setCategory ( const String & category)

Sets the active category by name.

Parameters
[in]categoryThe name of the category to display.

◆ setLibraryManager()

void DesignObjectChooser::setLibraryManager ( LibraryManager * manager)

Sets the library manager used to populate archived objects.

Parameters
[in]managerThe library manager to use.

◆ setModelManager()

void DesignObjectChooser::setModelManager ( QTModelManager * manager)

Sets the model manager used to populate design objects.

Parameters
[in]managerThe model manager to use.

◆ setSaveSelection()

void DesignObjectChooser::setSaveSelection ( bool multiselection)
protected

Configures the chooser for save-selection mode.

Parameters
[in]multiselectionTrue to enable multi-selection for saving.

◆ setSelected()

void DesignObjectChooser::setSelected ( const Buffer< UUID > & id)

Sets the currently selected items by their UUIDs.

Parameters
[in]idThe UUIDs to select.

◆ setSelectionMode()

void DesignObjectChooser::setSelectionMode ( DesignObjectGallery::SelectionMode selection_mode)

Sets the selection mode for the gallery (single or multi-select).

Parameters
[in]selection_modeThe selection mode to apply.

◆ showActiveMaterialsCategory()

void DesignObjectChooser::showActiveMaterialsCategory ( bool show)

Sets whether the active materials category is shown.

Parameters
[in]showTrue to show the active materials category.

◆ showActiveModelsCategory()

void DesignObjectChooser::showActiveModelsCategory ( bool show)

Sets whether the active models category is shown.

Parameters
[in]showTrue to show the active models category.

◆ showFileMenu()

void DesignObjectChooser::showFileMenu ( bool is_save,
const Buffer< UUID > & ids = BufferUUID >() )
protected

Shows the file import/export menu.

Parameters
[in]is_saveTrue if this is a save operation, false for load.
[in]idsThe UUIDs of design objects to operate on.

◆ sizeHint()

QSize DesignObjectChooser::sizeHint ( ) const
override

Returns the recommended size for this widget.

Returns
The preferred QSize.

◆ updateFromArchive() [1/2]

void DesignObjectChooser::updateFromArchive ( bool refresh_archive_files)

Updates the chooser contents from the archive.

Parameters
[in]refresh_archive_filesWhether to reload archive files from disk.

◆ updateFromArchive() [2/2]

void DesignObjectChooser::updateFromArchive ( bool show_active_models,
bool show_active_materials,
bool refresh_archive_files )

Updates the chooser contents from the archive with full control over categories.

Parameters
[in]show_active_modelsWhether to include active models from the scene.
[in]show_active_materialsWhether to include active materials from the scene.
[in]refresh_archive_filesWhether to reload archive files from disk.

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