33#include <NDEVR/QTModelManager.h>
35#include <NDEVR/Model.h>
36#include <QAbstractItemModel>
68 friend class ProxyModelViewFilter;
76 virtual int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
77 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
78 bool setData(
const QModelIndex& index,
const QVariant& value,
int role = Qt::EditRole)
override;
79 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
80 Qt::ItemFlags flags(
const QModelIndex& index)
const override;
81 QVariant headerData(
int column, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
82 QModelIndex index(
int row,
int column,
const QModelIndex& parent = QModelIndex())
const override;
83 QModelIndex parent(
const QModelIndex& index)
const override;
159 QVariant
data(
const UUID&
id,
int role,
int column)
const;
185 QIcon::Mode
iconMode(
const QModelIndex& index)
const;
The equivelent of std::vector but with a bit more control.
A hash-based key-value store, useful for quick associative lookups.
A core class that represents a node on model hierarchy.
ModelCache createCache(const Model &model, bool recursive, bool parent_visible, bool add_id) const
Creates a cache entry for a model.
void postMaterialImageRequest(const UUID &id) const
Posts a request to generate a material preview image.
Buffer< UUID > m_index_ids
Flat list mapping cache indices to UUIDs.
void modelDeleted(Buffer< UUID > id)
Handles model deletion events.
const Buffer< UUID > & rootModels() const
Retrieves the current root model UUIDs.
Buffer< UUID > m_root_models
UUIDs of the root models displayed in the view.
UUID m_tree_capture_id
UUID of the tree capture request.
void modelAdded(Buffer< UUID > id)
Handles model addition events.
bool hasCached(const UUID &id) const
Checks whether cached data exists for a given model UUID.
QTModelManager & manager()
Retrieves the underlying model manager.
Model model(uint04 row, const QModelIndex &parent) const
Retrieves a Model object by row and parent index.
void setupCache(const Model &model, bool recursive, bool parent_visible, bool add_id) const
Populates the cache for a model and optionally its children.
void updateModel3DVisible(const UUID &id, bool visible)
Updates the 3D visibility state of a cached model.
Dictionary< UUID, QIcon > m_cached_material_images
Cached material preview icons.
QVariant data(const UUID &id, int role, int column) const
Retrieves display data for a specific model by UUID, role, and column.
void clearAll()
Clears all cached data and resets the view.
void modelUpdatedSlot(const Buffer< UUID > &updated_ids)
Handles model update events.
void emitIndexUpdated(const UUID &id, const QList< int > &roles=QList< int >())
Emits data-changed signals for a specific model index.
QTModelManager * m_manager
The underlying model manager.
void addModel(UUID id)
Adds a model to the view and cache.
Dictionary< UUID, ModelCache > m_cached_model_indices
Cached display data per model.
void modelFocussed(UUID id, bool selected)
Handles model focus change events.
void materialUpdatedSlot(const Buffer< UUID > &updated_ids)
Handles material update events.
QTModelManagerView(QTModelManager *manager, QObject *parent=nullptr)
Constructs a model manager view for the given manager.
void topLevelChanged(Buffer< UUID > id)
Handles top-level parent change events for models.
UUID m_project_id
UUID of the currently active project.
void refreshAll()
Refreshes the entire view by rebuilding all caches.
void objectSelected(Buffer< UUID > id, bool selected)
Handles object selection change events.
Model model(const QModelIndex &model_index) const
Retrieves a Model object for a given QModelIndex.
QIcon::Mode iconMode(const QModelIndex &index) const
Determines the icon display mode for the given index.
QModelIndex getIndex(const UUID &id, int column) const
Retrieves the QModelIndex for a model UUID at a specific column.
void setRootModels(const Buffer< UUID > &roots)
Sets the root models displayed in the view.
Dictionary< UUID, Set< UUID > > m_cached_material_indices
Map of materials to the models using them.
QModelIndex getIndex(const Model &model, int column) const
Retrieves the QModelIndex for a model at a specific column.
void setIsRootFilter(const std::function< bool(const Model &)> &filter)
Sets a filter function that determines which models are treated as roots.
void recursiveCacheRemove(const UUID &id)
Recursively removes a model and its children from the cache.
void projectChanged(UUID id)
Handles project change events.
UUID getMaterialID(const QModelIndex &model_index) const
Retrieves the material UUID for a given QModelIndex.
bool m_include_materials
Whether to show materials as child items.
std::function< bool(const Model &)> m_root_filter
Optional filter for determining root models.
UUID getModelID(const QModelIndex &model_index) const
Retrieves the model UUID for a given QModelIndex.
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
Represents a color in the RGB space with optional alpha transparency.
The core String class for the NDEVR API.
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...
Cached data for a single model entry in the tree view, storing display properties to avoid repeated l...
bool is_selected
Whether this model is currently selected.
String icon
Icon identifier for the model.
QString material_name
Display name of the associated material.
bool is_visible
Whether this model is individually visible.
bool is_visible_recursive
Whether this model is visible considering parent visibility.
uint04 cache_index
Index into the flat index ID list.
Buffer< UUID > children
UUIDs of child models.
QString tooltip
Tooltip text for the model.
String material_icon
Icon identifier for the material.
UUID material
UUID of the associated material.
RGBColor icon_color
Tint color for the icon.
UUID parent
UUID of the parent model.
QString name
Display name of the model.