![]() |
NDEVR
API Documentation
|
Provides the ability to pull data from a DesignObjectLookup for display in tables within the NDEVR API and filter and sort it. More...
Public Member Functions | |
| DesignSortFilterProxyModel (DesignTableModel *model, QObject *parent=nullptr) | |
| Constructs a DesignSortFilterProxyModel wrapping the given table model. | |
| ModelTableColumnSpec | columnSpec (const QModelIndex &index) |
| Returns the column specification for the given proxy index. | |
| Model | getModel (const QModelIndex &index) |
| Returns the Model for the row of the given proxy index. | |
| UUID | getUUID (const QModelIndex &index) |
| Returns the UUID for the row of the given proxy index. | |
| bool | isEditable () const |
| Returns whether the table is currently editable. | |
| bool | isMaterialIndex (const QModelIndex &index) const |
| Returns whether the given proxy index represents a material column. | |
| bool | isSpecialCallbackIndex (const QModelIndex &index) const |
| Returns whether the given proxy index represents a custom callback column. | |
| DesignTableModel * | model () |
| Returns the underlying DesignTableModel. | |
| QTModelManager * | modelManager () const |
| Returns the model manager from the underlying table model. | |
| void | onSelected (const QModelIndex &index, const QRect &rect) |
| Handles a row selection event on the proxy model. | |
| void | searchByParameterChangedSignal () |
| Emitted when the search-by parameter changes. | |
| TranslatedString | searchByTitle () const |
| Returns the display title of the current search parameter. | |
| const std::function< void(Model, PopupInfo)> & | selectedCallback () const |
| Returns the current selection callback. | |
| void | setColumnEditable (uint04 column, bool is_editable) |
| Sets whether a specific column is editable. | |
| void | setIsEditable (bool is_editable) |
| Sets whether the table is editable. | |
| void | setSearchParameter (const ModelTableColumnSpec &search_parameter) |
| Sets the column parameter used for search filtering. | |
| void | setSearchString (const StringView &search_string) |
| Sets the search string used for filtering rows. | |
| void | setSelectedCallback (const std::function< void(Model, PopupInfo)> &callback) |
| Sets the callback invoked when a row is selected. | |
| void | setSortCallback (const std::function< bool(const Model &a, const Model &b)> &callback) |
| Sets a custom sort comparison callback for ordering rows. | |
| void | sort (int column, Qt::SortOrder order=Qt::DescendingOrder) override |
| Sorts the table by the given column. | |
| void | sort (Qt::SortOrder order=Qt::DescendingOrder) |
| Sorts the table using the current sort specifications. | |
| void | sortBy (const Buffer< ModelTableColumnSpec > &specs, Qt::SortOrder order=Qt::DescendingOrder) |
| Sorts the table by multiple column specifications as tiebreakers. | |
| void | sortBy (ModelTableColumnSpec spec, Qt::SortOrder order=Qt::DescendingOrder) |
| Sorts the table by a single column specification. | |
| void | sortBy (NDPO property, Qt::SortOrder order=Qt::DescendingOrder) |
| Sorts the table by the given NDPO property. | |
Protected Member Functions | |
| ModelTableColumnSpec | currentSearchParameter () const |
| Returns the currently active search parameter column specification. | |
| virtual bool | filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override |
| Returns whether the row at the given source index passes the current filter. | |
| virtual bool | lessThan (const QModelIndex &left, const QModelIndex &right) const override |
| Compares two source model indices for sorting. | |
| bool | modelIsShown (const DynamicPointer< QTDesignObject > &a) const |
| Returns whether the given design object should be shown after filtering. | |
Protected Attributes | |
| ModelTableColumnSpec | m_current_search_parameter |
| The currently active search parameter. | |
| DesignTableModel * | m_design_model |
| The underlying DesignTableModel. | |
| ModelTableColumnSpec | m_search_parameter |
| The user-configured search parameter. | |
| String | m_search_string |
| The current search/filter text. | |
| std::function< void(Model, PopupInfo)> | m_selected_callback |
| Callback invoked when a row is selected. | |
| Buffer< ModelTableColumnSpec > | m_sort_by |
| The column specifications used for sorting. | |
| std::function< bool(const Model &a, const Model &b)> | m_sort_function |
| Custom sort comparison function. | |
Provides the ability to pull data from a DesignObjectLookup for display in tables within the NDEVR API and filter and sort it.
Definition at line 522 of file DesignTableModel.h.
|
explicit |
Constructs a DesignSortFilterProxyModel wrapping the given table model.
| [in] | model | The underlying DesignTableModel. |
| [in] | parent | The parent QObject. |
References model().
| ModelTableColumnSpec DesignSortFilterProxyModel::columnSpec | ( | const QModelIndex & | index | ) |
Returns the column specification for the given proxy index.
| [in] | index | The proxy model index. |
|
protected |
Returns the currently active search parameter column specification.
|
overrideprotectedvirtual |
Returns whether the row at the given source index passes the current filter.
| [in] | sourceRow | The row in the source model. |
| [in] | sourceParent | The parent index in the source model. |
| Model DesignSortFilterProxyModel::getModel | ( | const QModelIndex & | index | ) |
| UUID DesignSortFilterProxyModel::getUUID | ( | const QModelIndex & | index | ) |
| bool DesignSortFilterProxyModel::isEditable | ( | ) | const |
Returns whether the table is currently editable.
|
nodiscard |
Returns whether the given proxy index represents a material column.
| [in] | index | The proxy model index. |
|
nodiscard |
Returns whether the given proxy index represents a custom callback column.
| [in] | index | The proxy model index. |
|
overrideprotectedvirtual |
Compares two source model indices for sorting.
| [in] | left | The left source index. |
| [in] | right | The right source index. |
| DesignTableModel * DesignSortFilterProxyModel::model | ( | ) |
Returns the underlying DesignTableModel.
Referenced by DesignSortFilterProxyModel().
|
protected |
Returns whether the given design object should be shown after filtering.
| [in] | a | The design object to check. |
|
inlinenodiscard |
Returns the model manager from the underlying table model.
Definition at line 637 of file DesignTableModel.h.
References m_design_model.
| void DesignSortFilterProxyModel::onSelected | ( | const QModelIndex & | index, |
| const QRect & | rect ) |
Handles a row selection event on the proxy model.
| [in] | index | The proxy model index of the selected row. |
| [in] | rect | The bounding rectangle of the selected cell. |
| TranslatedString DesignSortFilterProxyModel::searchByTitle | ( | ) | const |
Returns the display title of the current search parameter.
|
inlinenodiscard |
Returns the current selection callback.
Definition at line 652 of file DesignTableModel.h.
References m_selected_callback.
| void DesignSortFilterProxyModel::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. |
| void DesignSortFilterProxyModel::setIsEditable | ( | bool | is_editable | ) |
Sets whether the table is editable.
| [in] | is_editable | Whether editing is allowed. |
| void DesignSortFilterProxyModel::setSearchParameter | ( | const ModelTableColumnSpec & | search_parameter | ) |
Sets the column parameter used for search filtering.
| [in] | search_parameter | The column spec to search against. |
| void DesignSortFilterProxyModel::setSearchString | ( | const StringView & | search_string | ) |
Sets the search string used for filtering rows.
| [in] | search_string | The text to filter by. |
|
inline |
Sets the callback invoked when a row is selected.
| [in] | callback | The callback receiving the selected Model and popup info. |
Definition at line 642 of file DesignTableModel.h.
References m_selected_callback.
| void DesignSortFilterProxyModel::setSortCallback | ( | const std::function< bool(const Model &a, const Model &b)> & | callback | ) |
Sets a custom sort comparison callback for ordering rows.
| [in] | callback | A comparison function returning true if a should appear before b. |
|
override |
Sorts the table by the given column.
| [in] | column | The column index to sort by. |
| [in] | order | The sort order. |
| void DesignSortFilterProxyModel::sort | ( | Qt::SortOrder | order = Qt::DescendingOrder | ) |
Sorts the table using the current sort specifications.
| [in] | order | The sort order. |
| void DesignSortFilterProxyModel::sortBy | ( | const Buffer< ModelTableColumnSpec > & | specs, |
| Qt::SortOrder | order = Qt::DescendingOrder ) |
Sorts the table by multiple column specifications as tiebreakers.
| [in] | specs | The column specifications to sort by in order of priority. |
| [in] | order | The sort order. |
| void DesignSortFilterProxyModel::sortBy | ( | ModelTableColumnSpec | spec, |
| Qt::SortOrder | order = Qt::DescendingOrder ) |
Sorts the table by a single column specification.
| [in] | spec | The column specification to sort by. |
| [in] | order | The sort order. |
| void DesignSortFilterProxyModel::sortBy | ( | NDPO | property, |
| Qt::SortOrder | order = Qt::DescendingOrder ) |
Sorts the table by the given NDPO property.
| [in] | property | The property to sort by. |
| [in] | order | The sort order. |