NDEVR
API Documentation
DesignObjectGallery

Shows a series of Buttons with large icons that represent DesignObjects that allow the user to choose one. More...

Inheritance diagram for DesignObjectGallery:
[legend]
Collaboration diagram for DesignObjectGallery:
[legend]

Public Types

enum  SelectionMode { e_no_selection , e_single_selection , e_multi_selection }
 Defines how user selection behaves in the gallery. More...

Public Member Functions

 DesignObjectGallery (QWidget *parent=nullptr)
 Constructs a DesignObjectGallery.
void clear () override
 Clears all gallery items and resets the selection.
void clear (bool keep_selection)
 Clears all gallery items, optionally preserving the current selection.
const Buffer< UUIDcurrentSelection () const
 Returns the currently selected UUIDs.
void fillWithMaterials (bool keep_selected)
 Populates the gallery with all available materials.
void fillWithMaterials (Model model, bool keep_selected)
 Populates the gallery with materials from a specific model.
void fillWithModels (bool keep_selected)
 Populates the gallery with all available models.
const Buffer< UUID > & ids () const
 Returns the ordered list of object UUIDs currently in the gallery.
void onSelectedSignal (Buffer< UUID > ids)
 Emitted when the selection changes for any reason.
void onUserSelectedSignal (Buffer< UUID > ids)
 Emitted when the user explicitly changes the selection via interaction.
void saveRequestedSignal (Buffer< UUID > ids)
 Emitted when the user requests that the selected objects be saved.
void scrollToSelected ()
 Scrolls the gallery view to make the currently selected item visible.
SelectionMode selectionMode () const
 Returns the current selection mode.
void setButtonVisible (const UUID &id, bool visible)
 Sets the visibility of a specific gallery button by its UUID.
void setIsMaterialGallery (bool is_material)
 Sets whether this gallery is being used as a material gallery.
void setLibrary (LibraryManager *manager)
 Sets the library manager used for library-based galleries.
void setManager (QTModelManager *manager)
 Sets the model manager used to look up design objects.
void setObjects (const Buffer< UUID > &objects, bool keep_selected)
 Populates the gallery with the given set of objects.
void setSelected (const Buffer< UUID > &id, bool scroll_to_selected=false)
 Sets the selected items in the gallery.
void setSelectionMode (SelectionMode selection_mode)
 Sets the selection mode for the gallery.
void sortByName ()
 Sorts the gallery items alphabetically by name.
Public Member Functions inherited from ButtonGallery
 ButtonGallery (QWidget *parent=nullptr)
 Constructs a ButtonGallery with an optional parent widget.
virtual void addButton (Button *button)
 Adds a button to the gallery.
const Buffer< QPointer< Button > > & buttons () const
 Returns the list of buttons currently in the gallery.
virtual void removeButton (Button *button)
 Removes a button from the gallery.
void setIconSizeMultiplier (fltp04 multiplier)
 Sets the icon size multiplier applied to all buttons in the gallery.
QSize sizeHint () const override
 Returns the recommended size for the gallery widget.
virtual void sortButtons ()
 Sorts buttons alphabetically.
virtual void sortButtons (const std::function< bool(Button *, Button *)> &sorter)
 Sorts buttons using a custom comparison function.
void updateGalleryLayout ()
 Updates the layout of buttons within the gallery after additions or removals.
Public Member Functions inherited from QCustomScrollArea
 QCustomScrollArea (QWidget *parent=nullptr)
 Constructs a custom scroll area widget.
bool eventFilter (QObject *, QEvent *event) override
 Filters events for the child widget to handle resize and layout updates.
void setUseFullScroll (bool use_full_scroll)
 Sets whether the scroll area uses full scroll mode, where the scroll area expands to accommodate the full content size in the size hint.
void setWidget (QWidget *w)
 Sets the scrollable child widget.
QSize sizeHint () const override
 Returns the recommended size for the scroll area.
QWidget * takeWidget ()
 Removes and returns the scrollable child widget without deleting it.
bool useFullScroll () const
 Returns whether full scroll mode is enabled.

Protected Member Functions

TranslatedString getObjectName (const UUID &id) const
 Retrieves the display name for a given object UUID.
const QTModelManagermanager ()
 Returns the current model manager.
void resizeEvent (QResizeEvent *resize_event) override
 Handles resize events to reflow gallery layout.
void updateFromLibrary (const UUID &id)
 Updates a gallery entry from the library manager.
void updateFromManager (const UUID &id)
 Updates a gallery entry from the model manager.
void updateObjectsSlot (Buffer< UUID > ids)
 Slot called to update gallery buttons when objects change.

Protected Attributes

Dictionary< UUID, DynamicPointer< CaptureRequest > > m_active_requests
 Active thumbnail capture requests.
Ribbonm_browser_ribbon = nullptr
 The ribbon widget used for browsing categories.
Dictionary< UUID, Button * > m_buttons
 Maps each object UUID to its gallery button.
UUID m_capture_id
 The UUID used for thumbnail capture requests.
Set< UUIDm_current_selection
 The set of currently selected object UUIDs.
bool m_is_material_gallery = false
 Whether this gallery displays materials.
LibraryManagerm_library_manager = nullptr
 The library manager for library-based galleries.
QTModelManagerm_manager = nullptr
 The model manager providing design objects.
Dictionary< UUID, TranslatedStringm_object_names
 Cached display names for objects.
Buffer< UUIDm_objects
 The ordered list of object UUIDs in the gallery.
SelectionMode m_selection_mode = SelectionMode::e_no_selection
 The current selection mode.
Protected Attributes inherited from ButtonGallery
RibbonSubGroupm_gallery
 The internal ribbon sub-group managing the button layout.
Protected Attributes inherited from QCustomScrollArea
bool m_use_full_scroll = false
 Whether the scroll area uses full scroll mode.

Detailed Description

Shows a series of Buttons with large icons that represent DesignObjects that allow the user to choose one.


Definition at line 45 of file DesignObjectGallery.h.

Member Enumeration Documentation

◆ SelectionMode

Defines how user selection behaves in the gallery.

Enumerator
e_no_selection 

User can click on an item but it does not become selected.

e_single_selection 

User can select a single object at a time.

e_multi_selection 

Allows multiple simultaneous selections.

Definition at line 52 of file DesignObjectGallery.h.

Constructor & Destructor Documentation

◆ DesignObjectGallery()

DesignObjectGallery::DesignObjectGallery ( QWidget * parent = nullptr)

Constructs a DesignObjectGallery.

Parameters
[in]parentThe parent widget.

References DesignObjectGallery().

Referenced by DesignObjectGallery().

Member Function Documentation

◆ clear()

void DesignObjectGallery::clear ( bool keep_selection)

Clears all gallery items, optionally preserving the current selection.

Parameters
[in]keep_selectionWhether to keep the current selection state.

◆ currentSelection()

const Buffer< UUID > DesignObjectGallery::currentSelection ( ) const
inline

Returns the currently selected UUIDs.

Returns
A buffer of the selected object UUIDs.

Definition at line 129 of file DesignObjectGallery.h.

References m_current_selection.

◆ fillWithMaterials() [1/2]

void DesignObjectGallery::fillWithMaterials ( bool keep_selected)

Populates the gallery with all available materials.

Parameters
[in]keep_selectedWhether to preserve the existing selection.

◆ fillWithMaterials() [2/2]

void DesignObjectGallery::fillWithMaterials ( Model model,
bool keep_selected )

Populates the gallery with materials from a specific model.

Parameters
[in]modelThe model whose materials to display.
[in]keep_selectedWhether to preserve the existing selection.

◆ fillWithModels()

void DesignObjectGallery::fillWithModels ( bool keep_selected)

Populates the gallery with all available models.

Parameters
[in]keep_selectedWhether to preserve the existing selection.

◆ getObjectName()

TranslatedString DesignObjectGallery::getObjectName ( const UUID & id) const
protected

Retrieves the display name for a given object UUID.

Parameters
[in]idThe UUID of the object.
Returns
The translated display name.

◆ ids()

const Buffer< UUID > & DesignObjectGallery::ids ( ) const

Returns the ordered list of object UUIDs currently in the gallery.

Returns
A const reference to the buffer of UUIDs.

Referenced by onSelectedSignal(), onUserSelectedSignal(), saveRequestedSignal(), and updateObjectsSlot().

◆ manager()

const QTModelManager * DesignObjectGallery::manager ( )
inlineprotected

Returns the current model manager.

Returns
A const pointer to the QTModelManager.

Definition at line 182 of file DesignObjectGallery.h.

References m_manager.

Referenced by setLibrary(), and setManager().

◆ onSelectedSignal()

void DesignObjectGallery::onSelectedSignal ( Buffer< UUID > ids)

Emitted when the selection changes for any reason.

Parameters
[in]idsThe currently selected UUIDs.

References ids().

◆ onUserSelectedSignal()

void DesignObjectGallery::onUserSelectedSignal ( Buffer< UUID > ids)

Emitted when the user explicitly changes the selection via interaction.

Parameters
[in]idsThe newly selected UUIDs.

References ids().

◆ resizeEvent()

void DesignObjectGallery::resizeEvent ( QResizeEvent * resize_event)
overrideprotected

Handles resize events to reflow gallery layout.

Parameters
[in]resize_eventThe resize event.

◆ saveRequestedSignal()

void DesignObjectGallery::saveRequestedSignal ( Buffer< UUID > ids)

Emitted when the user requests that the selected objects be saved.

Parameters
[in]idsThe UUIDs of the objects to save.

References ids().

◆ selectionMode()

SelectionMode DesignObjectGallery::selectionMode ( ) const

Returns the current selection mode.

Returns
The active SelectionMode.

◆ setButtonVisible()

void DesignObjectGallery::setButtonVisible ( const UUID & id,
bool visible )

Sets the visibility of a specific gallery button by its UUID.

Parameters
[in]idThe UUID of the object whose button visibility is being set.
[in]visibleWhether the button should be visible.

◆ setIsMaterialGallery()

void DesignObjectGallery::setIsMaterialGallery ( bool is_material)

Sets whether this gallery is being used as a material gallery.

Parameters
[in]is_materialTrue if this is a material gallery.

◆ setLibrary()

void DesignObjectGallery::setLibrary ( LibraryManager * manager)

Sets the library manager used for library-based galleries.

Parameters
[in]managerThe LibraryManager instance.

References manager().

◆ setManager()

void DesignObjectGallery::setManager ( QTModelManager * manager)

Sets the model manager used to look up design objects.

Parameters
[in]managerThe QTModelManager instance.

References manager().

◆ setObjects()

void DesignObjectGallery::setObjects ( const Buffer< UUID > & objects,
bool keep_selected )

Populates the gallery with the given set of objects.

Parameters
[in]objectsThe UUIDs of the objects to display.
[in]keep_selectedWhether to preserve the existing selection.

◆ setSelected()

void DesignObjectGallery::setSelected ( const Buffer< UUID > & id,
bool scroll_to_selected = false )

Sets the selected items in the gallery.

Parameters
[in]idThe UUIDs of the objects to select.
[in]scroll_to_selectedWhether to scroll the view to show the selected item.

◆ setSelectionMode()

void DesignObjectGallery::setSelectionMode ( SelectionMode selection_mode)

Sets the selection mode for the gallery.

Parameters
[in]selection_modeThe desired selection behavior.

◆ updateFromLibrary()

void DesignObjectGallery::updateFromLibrary ( const UUID & id)
protected

Updates a gallery entry from the library manager.

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

◆ updateFromManager()

void DesignObjectGallery::updateFromManager ( const UUID & id)
protected

Updates a gallery entry from the model manager.

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

◆ updateObjectsSlot()

void DesignObjectGallery::updateObjectsSlot ( Buffer< UUID > ids)
protected

Slot called to update gallery buttons when objects change.

Parameters
[in]idsThe UUIDs of the objects that were updated.

References ids().


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