Model Related Classes¶
models module contains QT Models and model related classes that
are useful when building MVC setups and when you need to filter data in
Inherited from a
QSortFilterProxyModel, this class implements filtering across all levels of a hierarchy in a hierarchical (tree-based) model and provides a simple interface for derived classes so that all they need to do is filter a single item as requested.
Parameters: parent (
QWidget) – The parent QObject to use for this instance
Allow control over enabling/disabling of the accepted cache used to accelerate filtering. Can be used for debug purposes to ensure the caching isn’t the cause of incorrect filtering/sorting or instability!
Parameters: enable – True if caching should be enabled, False if it should be disabled.
_is_row_accepted(src_row, src_parent_idx, parent_accepted)¶
Override this method to decide if the specified row should be accepted or not by the filter.
This should be overridden instead of filterAcceptsRow in derived classes
- src_row – The row in the source model to filter
- src_parent_idx – The parent QModelIndex instance to filter
- parent_accepted – True if a parent item has been accepted by the filter
True if this index should be accepted, otherwise False
A sort/filter proxy model that handles sorting and filtering data in a ShotgunModel by given Shotgun fields on the entities stored therein.
Initializes a new ShotgunSortFilterProxyModel.
Parameters: parent – The Qt parent of the proxy model.
Returns True if “left” is less than “right”, otherwise False. This sort is handled based on the data pulled from Shotgun for the current sort_by_field registered with this proxy model.
- left – The QModelIndex of the left-hand item to compare.
- right – The QModelIndex of the right-hand item to compare against.
Whether “left” is less than “right”.
Returns True if the model index should be shown, and False if it should not. This is determined based on whether the proxy model’s filter is found in the Shotgun data for the fields specified in the filter_by_fields list registered with the proxy model.
- row – The row being processed.
- source_parent – The parent index from the source model.
Whether the row is accepted.