NDEVR
API Documentation
ProxyModelViewFilter

Filters and sorts Models from a ModelManager for views such as in a table or in a tree view. More...

Public Member Functions

 ProxyModelViewFilter (QTModelManager *manager, QObject *parent=nullptr)
 Constructs a proxy filter using a model manager as the data source.
 ProxyModelViewFilter (QTModelManagerView *view, QObject *parent=nullptr)
 Constructs a proxy filter using a model manager view as the data source.
Qt::CheckState checkState (const Model &model) const
 Gets the check state of the given model.
void clearCheckStates ()
 Clears all check states to unchecked.
QModelIndex getIndex (const Model &model, int column) const
 Gets the proxy index for the given model and column.
QModelIndex getIndex (const UUID &id, int column) const
 Gets the proxy index for the given UUID and column.
UUID getMaterialID (const QModelIndex &index) const
 Gets the material UUID at the given proxy index.
UUID getModelID (const QModelIndex &index) const
 Gets the model UUID at the given proxy index.
Buffer< UUIDgetModelRoots () const
 Gets the UUIDs of all root models in the view.
Buffer< UUIDgetSelectedModelRoots () const
 Gets the UUIDs of all checked root models.
bool hasIndex (const UUID &id) const
 Checks whether the given UUID exists in the proxy model.
QIcon::Mode iconMode (const QModelIndex &index) const
 Gets the icon mode for the given proxy index based on the model state.
void invalidate ()
 Invalidates the current filter and triggers re-evaluation.
QTModelManagermanager () const
 Gets the model manager associated with this filter.
Model model (const QModelIndex &index) const
 Gets the Model object at the given proxy index.
void refreshAll ()
 Forces a complete refresh of all filtered data.
void selectAllVisible ()
 Sets all currently visible models to checked.
void setAllowEdits (bool allow)
 Sets whether editing model names is allowed in the view.
void setAllowSelections (bool allow)
 Sets whether checkbox selection is allowed.
void setCheckState (const Model &model, Qt::CheckState check_state)
 Sets the check state of a single model.
void setCheckStateAll (const std::function< bool(const Model &model)> &model_type, Qt::CheckState check_state)
 Sets the check state of all models matching a custom predicate.
void setCheckStateAll (const String &model_type, GeometryType type, Qt::CheckState check_state)
 Sets the check state of all models matching a model type and geometry type.
void setCheckStateAll (const String &model_type, Qt::CheckState check_state)
 Sets the check state of all models matching the given model type.
void setCheckStateAll (GeometryType type, Qt::CheckState check_state)
 Sets the check state of all models matching the given geometry type.
void setCheckStateAll (Qt::CheckState check_state)
 Sets the check state of all models.
void setCheckStateRecursive (const Model &model, Qt::CheckState check_state)
 Sets the check state of a model and all its descendants recursively.
void setCustomHeader (const TranslatedString &header_title, const StringView &header_icon)
 Sets a custom header title and icon for the view.
void setGreyHidden (bool grey_hidden)
 Sets whether hidden models should be displayed with greyed-out icons.
void setIsRootFilter (const std::function< bool(const Model &)> &filter)
 Sets a filter function that determines whether a model is treated as a root.
void setRootModels (const Buffer< UUID > &ids)
 Sets the root model UUIDs to display in the filtered view.
void setSelectedModelRoots (const Buffer< UUID > &roots, bool only_visible_children)
 Sets check states based on model root UUIDs with optional child visibility filtering.
void setShowMaterials (bool show_materials)
 Sets whether material entries are shown in the view.
void setShowSelected (bool show_selected)
 Sets whether to visually indicate selected models.
void setVisibleFilter (const std::function< bool(const Model &)> &filter)
 Sets a custom filter function that determines whether a model is visible.

Detailed Description

Filters and sorts Models from a ModelManager for views such as in a table or in a tree view.


Definition at line 46 of file ProxyModelViewFilter.h.

Constructor & Destructor Documentation

◆ ProxyModelViewFilter() [1/2]

ProxyModelViewFilter::ProxyModelViewFilter ( QTModelManager * manager,
QObject * parent = nullptr )
explicit

Constructs a proxy filter using a model manager as the data source.

Parameters
[in]managerThe model manager providing the data.
[in]parentThe parent QObject.

References manager().

◆ ProxyModelViewFilter() [2/2]

ProxyModelViewFilter::ProxyModelViewFilter ( QTModelManagerView * view,
QObject * parent = nullptr )
explicit

Constructs a proxy filter using a model manager view as the data source.

Parameters
[in]viewThe model manager view providing the data.
[in]parentThe parent QObject.

Member Function Documentation

◆ checkState()

Qt::CheckState ProxyModelViewFilter::checkState ( const Model & model) const

Gets the check state of the given model.

Parameters
[in]modelThe model to query.
Returns
The Qt check state for the model.

References model().

◆ getIndex() [1/2]

QModelIndex ProxyModelViewFilter::getIndex ( const Model & model,
int column ) const

Gets the proxy index for the given model and column.

Parameters
[in]modelThe model to look up.
[in]columnThe column index.
Returns
The QModelIndex for the model.

References model().

◆ getIndex() [2/2]

QModelIndex ProxyModelViewFilter::getIndex ( const UUID & id,
int column ) const

Gets the proxy index for the given UUID and column.

Parameters
[in]idThe UUID to look up.
[in]columnThe column index.
Returns
The QModelIndex for the UUID.

◆ getMaterialID()

UUID ProxyModelViewFilter::getMaterialID ( const QModelIndex & index) const

Gets the material UUID at the given proxy index.

Parameters
[in]indexThe proxy model index.
Returns
The UUID of the material at that index.

◆ getModelID()

UUID ProxyModelViewFilter::getModelID ( const QModelIndex & index) const

Gets the model UUID at the given proxy index.

Parameters
[in]indexThe proxy model index.
Returns
The UUID of the model at that index.

◆ getModelRoots()

Buffer< UUID > ProxyModelViewFilter::getModelRoots ( ) const

Gets the UUIDs of all root models in the view.

Returns
A buffer of root model UUIDs.

◆ getSelectedModelRoots()

Buffer< UUID > ProxyModelViewFilter::getSelectedModelRoots ( ) const

Gets the UUIDs of all checked root models.

Returns
A buffer of checked root model UUIDs.

◆ hasIndex()

bool ProxyModelViewFilter::hasIndex ( const UUID & id) const

Checks whether the given UUID exists in the proxy model.

Parameters
[in]idThe UUID to check.
Returns
True if the UUID has an index in the model.

◆ iconMode()

QIcon::Mode ProxyModelViewFilter::iconMode ( const QModelIndex & index) const

Gets the icon mode for the given proxy index based on the model state.

Parameters
[in]indexThe proxy model index.
Returns
The QIcon::Mode for the item.

◆ manager()

QTModelManager & ProxyModelViewFilter::manager ( ) const

Gets the model manager associated with this filter.

Returns
A reference to the QTModelManager.

Referenced by ProxyModelViewFilter().

◆ model()

Model ProxyModelViewFilter::model ( const QModelIndex & index) const

Gets the Model object at the given proxy index.

Parameters
[in]indexThe proxy model index.
Returns
The Model at that index.

Referenced by checkState(), getIndex(), setCheckState(), setCheckStateAll(), and setCheckStateRecursive().

◆ setAllowEdits()

void ProxyModelViewFilter::setAllowEdits ( bool allow)

Sets whether editing model names is allowed in the view.

Parameters
[in]allowWhether edits are allowed.

◆ setAllowSelections()

void ProxyModelViewFilter::setAllowSelections ( bool allow)

Sets whether checkbox selection is allowed.

Parameters
[in]allowWhether selections are allowed.

◆ setCheckState()

void ProxyModelViewFilter::setCheckState ( const Model & model,
Qt::CheckState check_state )

Sets the check state of a single model.

Parameters
[in]modelThe model to update.
[in]check_stateThe new check state.

References model().

◆ setCheckStateAll() [1/5]

void ProxyModelViewFilter::setCheckStateAll ( const std::function< bool(const Model &model)> & model_type,
Qt::CheckState check_state )

Sets the check state of all models matching a custom predicate.

Parameters
[in]model_typeThe predicate function returning true for matching models.
[in]check_stateThe check state to apply.

References model().

◆ setCheckStateAll() [2/5]

void ProxyModelViewFilter::setCheckStateAll ( const String & model_type,
GeometryType type,
Qt::CheckState check_state )

Sets the check state of all models matching a model type and geometry type.

Parameters
[in]model_typeThe model type string to match.
[in]typeThe geometry type to match.
[in]check_stateThe check state to apply.

◆ setCheckStateAll() [3/5]

void ProxyModelViewFilter::setCheckStateAll ( const String & model_type,
Qt::CheckState check_state )

Sets the check state of all models matching the given model type.

Parameters
[in]model_typeThe model type string to match.
[in]check_stateThe check state to apply.

◆ setCheckStateAll() [4/5]

void ProxyModelViewFilter::setCheckStateAll ( GeometryType type,
Qt::CheckState check_state )

Sets the check state of all models matching the given geometry type.

Parameters
[in]typeThe geometry type to match.
[in]check_stateThe check state to apply.

◆ setCheckStateAll() [5/5]

void ProxyModelViewFilter::setCheckStateAll ( Qt::CheckState check_state)

Sets the check state of all models.

Parameters
[in]check_stateThe check state to apply.

◆ setCheckStateRecursive()

void ProxyModelViewFilter::setCheckStateRecursive ( const Model & model,
Qt::CheckState check_state )

Sets the check state of a model and all its descendants recursively.

Parameters
[in]modelThe root model.
[in]check_stateThe check state to apply.

References model().

◆ setCustomHeader()

void ProxyModelViewFilter::setCustomHeader ( const TranslatedString & header_title,
const StringView & header_icon )

Sets a custom header title and icon for the view.

Parameters
[in]header_titleThe header title text.
[in]header_iconThe header icon resource name.

◆ setGreyHidden()

void ProxyModelViewFilter::setGreyHidden ( bool grey_hidden)

Sets whether hidden models should be displayed with greyed-out icons.

Parameters
[in]grey_hiddenWhether to grey out hidden models.

◆ setIsRootFilter()

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

Sets a filter function that determines whether a model is treated as a root.

Parameters
[in]filterThe filter function returning true for root models.

◆ setRootModels()

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

Sets the root model UUIDs to display in the filtered view.

Parameters
[in]idsThe UUIDs of the root models.

◆ setSelectedModelRoots()

void ProxyModelViewFilter::setSelectedModelRoots ( const Buffer< UUID > & roots,
bool only_visible_children )

Sets check states based on model root UUIDs with optional child visibility filtering.

Parameters
[in]rootsThe root model UUIDs to check.
[in]only_visible_childrenWhether to only check visible children.

◆ setShowMaterials()

void ProxyModelViewFilter::setShowMaterials ( bool show_materials)

Sets whether material entries are shown in the view.

Parameters
[in]show_materialsWhether to show materials.

◆ setShowSelected()

void ProxyModelViewFilter::setShowSelected ( bool show_selected)

Sets whether to visually indicate selected models.

Parameters
[in]show_selectedWhether to show selection indicators.

◆ setVisibleFilter()

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

Sets a custom filter function that determines whether a model is visible.

Parameters
[in]filterThe filter function returning true for visible models.

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