![]() |
NDEVR
API Documentation
|
Provides the ability to pull data from a DesignObjectLookup for display in tables within the NDEVR API. More...
Public Member Functions | |
| DesignTableModel (QObject *parent=nullptr) | |
| Constructs a DesignTableModel. | |
| uint04 | addColumn (const DesignParameter ¶meter, bool is_editable) |
| Adds a column displaying the given design parameter. | |
| uint04 | addColumn (const ModelTableColumnSpec &column) |
| Adds a column from a fully specified ModelTableColumnSpec. | |
| uint04 | addColumn (const TranslatedString &name, const StringView &icon, const std::function< void(UUID)> &callback) |
| Adds a button column with a label, icon, and click callback. | |
| uint04 | addColumn (NDPO property, bool is_editable) |
| Adds a column displaying the given NDPO property. | |
| uint04 | addGrandparentNameColumn (const TranslatedString &custom_column_name=TranslatedString()) |
| Adds a column showing the grandparent name of each object. | |
| uint04 | addMaterialDataColumn (const TranslatedString &custom_column_name=TranslatedString()) |
| Adds a column showing the material of each object. | |
| uint04 | addParentDataColumn (const DesignParameter ¶m, bool is_editable, const TranslatedString &custom_column_name=TranslatedString()) |
| Adds a column showing a parent design parameter value. | |
| uint04 | addParentPathColumn (const TranslatedString &custom_column_name=TranslatedString()) |
| Adds a column showing the parent path of each object. | |
| bool | canAddObject (const Model &object) const |
| Returns whether the given Model can be added to the table. | |
| int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
| Returns the number of columns in the table. | |
| QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
| Returns the data for the given index and role. | |
| Qt::ItemFlags | flags (const QModelIndex &index) const override |
| Returns the item flags for the given index. | |
| const ModelTableColumnSpec & | getColumnSpec (uint04 column) const |
| Returns the column specification for the given column index. | |
| DynamicPointer< QTDesignObject > | getDesignObject (QModelIndex index) const |
| Returns the QTDesignObject for the row of the given index. | |
| DynamicPointer< QTDesignObject > | getDesignObject (QModelIndex index, int row) const |
| Returns the QTDesignObject for the given row number. | |
| Model | getModel (QModelIndex index) const |
| Returns the Model for the row of the given index. | |
| DesignObject | getObject (QModelIndex index) const |
| Returns the DesignObject for the row of the given index. | |
| DesignObject | getObject (QModelIndex index, int row) const |
| Returns the DesignObject for the given row number. | |
| UUID | getUUID (QModelIndex index) const |
| Returns the UUID for the row of the given index. | |
| UUID | getUUID (QModelIndex index, int row) const |
| Returns the UUID for the given row number. | |
| QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
| Returns the header data for the given section, orientation, and role. | |
| bool | isEditable () const |
| Returns whether the table is currently editable. | |
| bool | isMaterialIndex (const QModelIndex &index) const |
| Returns whether the given index represents a material column. | |
| bool | isObjectAllowed (const Model &object) const |
| Returns whether the given Model passes the added filter. | |
| bool | isObjectAllowed (const UUID &object) const |
| Returns whether the given object UUID passes the added filter. | |
| bool | isSpecialCallbackIndex (const QModelIndex &index) const |
| Returns whether the given index represents a custom callback column. | |
| QTModelManager * | modelManager () const |
| Returns the model manager. | |
| virtual void | modelUpdated (const Buffer< UUID > &ids) |
| Called when existing design objects are updated. | |
| void | modelUpdatedSlot (const Buffer< UUID > &ids) |
| Slot connected to the model manager's model-updated signal. | |
| virtual void | objectAdded (const Buffer< UUID > &ids) |
| Called when new design objects are added to the model manager. | |
| void | objectAddedSlot (const Buffer< UUID > &ids) |
| Slot connected to the model manager's object-added signal. | |
| virtual void | objectDeleted (const Buffer< UUID > &ids) |
| Called when design objects are deleted from the model manager. | |
| void | objectDeletedSlot (const Buffer< UUID > &ids) |
| Slot connected to the model manager's object-deleted signal. | |
| void | onSelected (QModelIndex index, const QRect &rect) |
| Handles a row selection event, invoking the selected callback. | |
| void | refreshAll () |
| Forces a full refresh of all rows and columns. | |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
| Returns the number of rows in the table. | |
| void | setAddedFilter (const std::function< bool(const Model &)> &callback) |
| Sets a filter callback applied when objects are added to the table. | |
| void | setColumnEditable (uint04 column, bool is_editable) |
| Sets whether a specific column is editable. | |
| bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
| Sets data at the given index for the specified role. | |
| void | setIsEditable (bool is_editable) |
| Sets whether the table is editable. | |
| void | setList (const Buffer< UUID > &models) |
| Sets the list of object UUIDs to display as rows. | |
| void | setModelManager (QTModelManager *manager) |
| Sets the model manager and connects its signals. | |
| void | setup () |
| Performs initial setup, connecting to the model manager signals. | |
| QVariant | userData (const QModelIndex &index, int role) const |
| Returns custom user-role data for the given index. | |
Protected Member Functions | |
| void | updateColumn (uint04 index) |
| Updates a single column specification at the given index. | |
Protected Attributes | |
| std::function< bool(const Model &)> | m_added_filter |
| Filter callback for added/valid objects. | |
| QTResourceListener * | m_angle_listener = nullptr |
| Listener for angle unit changes. | |
| Buffer< BitFlag > | m_callback_clicked |
| Tracks which callback buttons have been clicked per row. | |
| Buffer< ModelTableColumnSpec > | m_columns |
| The column specifications for the table. | |
| QTResourceListener * | m_coord_listener = nullptr |
| Listener for coordinate unit changes. | |
| bool | m_is_editable |
| Whether the table is currently editable. | |
| QTModelManager * | m_manager |
| The model manager providing design objects. | |
| Buffer< UUID > | m_models |
| List of all model UUIDs displayed in the table. | |
| QTResourceListener * | m_orientation_listener = nullptr |
| Listener for orientation unit changes. | |
Provides the ability to pull data from a DesignObjectLookup for display in tables within the NDEVR API.
Definition at line 225 of file DesignTableModel.h.
|
explicit |
Constructs a DesignTableModel.
| [in] | parent | The parent QObject. |
References DesignTableModel().
Referenced by DesignTableModel().
| uint04 DesignTableModel::addColumn | ( | const DesignParameter & | parameter, |
| bool | is_editable ) |
Adds a column displaying the given design parameter.
| [in] | parameter | The design parameter. |
| [in] | is_editable | Whether the column allows editing. |
| uint04 DesignTableModel::addColumn | ( | const ModelTableColumnSpec & | column | ) |
Adds a column from a fully specified ModelTableColumnSpec.
| [in] | column | The column specification. |
| uint04 DesignTableModel::addColumn | ( | const TranslatedString & | name, |
| const StringView & | icon, | ||
| const std::function< void(UUID)> & | callback ) |
Adds a button column with a label, icon, and click callback.
| [in] | name | The column header name. |
| [in] | icon | The icon name. |
| [in] | callback | The function called with the object UUID when clicked. |
Adds a column displaying the given NDPO property.
| [in] | property | The property to display. |
| [in] | is_editable | Whether the column allows editing. |
| uint04 DesignTableModel::addGrandparentNameColumn | ( | const TranslatedString & | custom_column_name = TranslatedString() | ) |
Adds a column showing the grandparent name of each object.
| [in] | custom_column_name | An optional custom header name. |
| uint04 DesignTableModel::addMaterialDataColumn | ( | const TranslatedString & | custom_column_name = TranslatedString() | ) |
Adds a column showing the material of each object.
| [in] | custom_column_name | An optional custom header name. |
| uint04 DesignTableModel::addParentDataColumn | ( | const DesignParameter & | param, |
| bool | is_editable, | ||
| const TranslatedString & | custom_column_name = TranslatedString() ) |
Adds a column showing a parent design parameter value.
| [in] | param | The design parameter to display from the parent. |
| [in] | is_editable | Whether the column allows editing. |
| [in] | custom_column_name | An optional custom header name. |
| uint04 DesignTableModel::addParentPathColumn | ( | const TranslatedString & | custom_column_name = TranslatedString() | ) |
Adds a column showing the parent path of each object.
| [in] | custom_column_name | An optional custom header name. |
| bool DesignTableModel::canAddObject | ( | const Model & | object | ) | const |
Returns whether the given Model can be added to the table.
| [in] | object | The model to check. |
|
nodiscardoverride |
Returns the number of columns in the table.
| [in] | parent | The parent index (unused for flat tables). |
|
nodiscardoverride |
Returns the data for the given index and role.
| [in] | index | The model index. |
| [in] | role | The Qt data role. |
|
nodiscardoverride |
Returns the item flags for the given index.
| [in] | index | The model index. |
|
nodiscard |
Returns the column specification for the given column index.
| [in] | column | The column index. |
|
nodiscard |
Returns the QTDesignObject for the row of the given index.
| [in] | index | The model index. |
|
nodiscard |
Returns the QTDesignObject for the given row number.
| [in] | index | The model index (used for validation). |
| [in] | row | The row number. |
|
nodiscard |
|
nodiscard |
Returns the DesignObject for the row of the given index.
| [in] | index | The model index. |
|
nodiscard |
Returns the DesignObject for the given row number.
| [in] | index | The model index (used for validation). |
| [in] | row | The row number. |
|
nodiscard |
|
nodiscard |
|
nodiscardoverride |
Returns the header data for the given section, orientation, and role.
| [in] | section | The section (column or row) index. |
| [in] | orientation | The header orientation. |
| [in] | role | The Qt data role. |
| bool DesignTableModel::isEditable | ( | ) | const |
Returns whether the table is currently editable.
|
nodiscard |
Returns whether the given index represents a material column.
| [in] | index | The model index. |
| bool DesignTableModel::isObjectAllowed | ( | const Model & | object | ) | const |
Returns whether the given Model passes the added filter.
| [in] | object | The model to check. |
| bool DesignTableModel::isObjectAllowed | ( | const UUID & | object | ) | const |
|
nodiscard |
Returns whether the given index represents a custom callback column.
| [in] | index | The model index. |
|
inlinenodiscard |
Returns the model manager.
Definition at line 379 of file DesignTableModel.h.
References m_manager.
Called when existing design objects are updated.
| [in] | ids | The UUIDs of the updated objects. |
Slot connected to the model manager's model-updated signal.
| [in] | ids | The UUIDs of the updated objects. |
Called when new design objects are added to the model manager.
| [in] | ids | The UUIDs of the added objects. |
Slot connected to the model manager's object-added signal.
| [in] | ids | The UUIDs of the added objects. |
Called when design objects are deleted from the model manager.
| [in] | ids | The UUIDs of the deleted objects. |
Slot connected to the model manager's object-deleted signal.
| [in] | ids | The UUIDs of the deleted objects. |
| void DesignTableModel::onSelected | ( | QModelIndex | index, |
| const QRect & | rect ) |
Handles a row selection event, invoking the selected callback.
| [in] | index | The model index of the selected row. |
| [in] | rect | The bounding rectangle of the selected cell. |
|
nodiscardoverride |
Returns the number of rows in the table.
| [in] | parent | The parent index (unused for flat tables). |
|
inline |
Sets a filter callback applied when objects are added to the table.
| [in] | callback | A function returning true for models that should be included. |
Definition at line 307 of file DesignTableModel.h.
References m_added_filter.
| void DesignTableModel::setColumnEditable | ( | uint04 | column, |
| bool | is_editable ) |
Sets whether a specific column is editable.
| [in] | column | The column index. |
| [in] | is_editable | Whether editing is allowed for that column. |
|
nodiscardoverride |
Sets data at the given index for the specified role.
| [in] | index | The model index. |
| [in] | value | The new value. |
| [in] | role | The Qt data role. |
| void DesignTableModel::setIsEditable | ( | bool | is_editable | ) |
Sets whether the table is editable.
| [in] | is_editable | Whether editing is allowed. |
Sets the list of object UUIDs to display as rows.
| [in] | models | The UUIDs to display. |
| void DesignTableModel::setModelManager | ( | QTModelManager * | manager | ) |
Sets the model manager and connects its signals.
| [in] | manager | The QTModelManager instance. |
|
protected |
Updates a single column specification at the given index.
| [in] | index | The column index to update. |
|
nodiscard |
Returns custom user-role data for the given index.
| [in] | index | The model index. |
| [in] | role | The user data role. |