33#include <NDEVR/QTModelManager.h>
34#include <NDEVR/QCustomComboBox.h>
113 lib_assert(
m_manager !=
nullptr,
"Need to set Model Manager");
173 lib_assert(
m_allow_add_new,
"Tried to set to new when new not enabled");
191 for (
uint04 i = 0; i < exclusion_list.size(); i++)
202 id = Constant<UUID>::Invalid;
269 void _removeID(
const UUID&
id);
274 void _addModel(
const Model& m);
The equivelent of std::vector but with a bit more control.
constexpr decltype(auto) get(t_property_type property) const
Retrieves a property value from the database, cast to the requested type.
A hash-based key-value store, useful for quick associative lookups.
void addModel(const Model &m)
Adds a model to the combo box if it passes the current filters.
bool m_include_path
Whether to include the full path in display labels.
bool isNewSelected() const
Checks whether the "New Model" entry is currently selected.
QTModelManager * manager() const
Returns the model manager associated with this combo box.
bool isModelAllowed(const Model &model)
Checks whether the model passes the current type and custom filters.
Dictionary< UUID, Buffer< UUID > > m_model_parents
Maps model UUIDs to their parent chain.
void removeID(const UUID &id)
Removes a model identified by UUID from the combo box.
Buffer< String > m_model_types
Model type names used for filtering.
std::function< TranslatedString(const Model &)> m_display_name_callback
Custom callback for generating display names.
void modelSelectedSignal(UUID id)
Emitted when a model is selected in the combo box.
void onObjectAddedSlot(const Buffer< UUID > &ids)
Slot called when objects are added to the scene, potentially adding them to the combo box.
bool m_include_parent_name
Whether to include the parent name in display labels.
void refreshFromManager()
Refreshes the combo box contents from the model manager.
void setToNew()
Sets the combo box selection to the "New Model" entry.
String m_parent_type
Parent type name used for display name generation.
void setAllowNew(bool allow_new, const TranslatedString &new_title)
Enables or disables a "New Model" entry in the combo box.
void setModelParentID(const UUID &parent)
Filters the combo box to only show children of the specified parent model.
ModelChooserCombo(QWidget *parent=nullptr)
Constructs the model chooser combo box.
void addID(const UUID &id)
Adds a model identified by UUID to the combo box.
void onObjectsDeletedSlot()
Slot called when objects are deleted from the scene, removing them from the combo box.
virtual void onSorted(const Buffer< uint04 > &sorted_indices)
Called when the combo box items are sorted, to update internal state.
void setDisplayNameCallback(std::function< TranslatedString(const Model &)> &callback)
Sets a custom callback for generating model display names.
void onEdited()
Slot called when the user edits the combo box selection.
void setExclusionList(const Buffer< UUID > &exclusion_list)
Sets a list of model UUIDs to exclude from the combo box.
Set< UUID > m_exclusion_list
Set of model UUIDs excluded from the combo box.
void setCurrentSelection(UUID id)
Sets the current combo box selection to the model with the given UUID.
void setModelFilter(const std::function< bool(const Model &)> &model_filter)
Sets a custom filter function for determining which models to include.
void newModelSelectedSignal()
Emitted when the "New Model" entry is selected.
void onObjectUpdatedSlot(Buffer< UUID > ids)
Slot called when objects are updated, refreshing their display names.
void setModelType(const StringView &type)
Sets a single model type filter, replacing any existing type filters.
void setIncludeParentName(bool include_parent_name, const StringView &parent_type=String())
Configures whether the parent model name is shown in display labels.
void setIDs(const Buffer< UUID > &ids)
Populates the combo box with models identified by the given UUIDs.
UUID selectedID() const
Returns the UUID of the currently selected model, or Invalid if "New Model" is selected.
QTModelManager * m_manager
The model manager providing scene data.
void setModels(const Buffer< Model > &models)
Replaces the combo box contents with the given models.
Dictionary< UUID, uint04 > m_models
Maps model UUIDs to their combo box indices.
bool m_allow_add_new
Whether the "New Model" entry is enabled.
void addModels(const Buffer< Model > &models)
Adds multiple models to the combo box.
void setIncludePath(bool include_parent_name, const StringView &parent_type=String())
Configures whether the full model path is shown in display labels.
void setManager(QTModelManager *manager)
Sets the model manager used to query models for the combo box.
TranslatedString displayName(const Model &m)
Returns the translated display name for the given model.
bool canAddModel(const Model &model)
Checks whether a model can be added to the combo box.
void addModelType(const StringView &type)
Adds an additional model type to the type filter list.
UUID m_model_parent
Optional parent model UUID for filtering.
std::function< bool(const Model &)> m_model_filter
Custom filter predicate for model inclusion.
A core class that represents a node on model hierarchy.
void setValue(const t_type &t_value)
Sets the current value of the combo box.
QCustomComboBox(QWidget *parent=nullptr)
Constructs a QCustomComboBox with the given parent widget.
void refreshWidget()
Rebuilds the widget contents from the internal value and display buffers.
t_type getAs() const
Returns the current value converted to the requested type.
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
Container that stores unique elements in no particular order, and which allow for fast retrieval or i...
The core String View class for the NDEVR API.
The core String class for the NDEVR API.
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
@ guid
A 128-bit globally unique identifier for the object.