spinetoolbox.mvcmodels.minimal_tree_model
¶
Models to represent items in a tree.
authors: |
|
---|---|
date: | 11.3.2019 |
Module Contents¶
-
class
spinetoolbox.mvcmodels.minimal_tree_model.
TreeItem
(model=None)[source]¶ A tree item that can fetch its children.
Initializes item.
Parameters: model (MinimalTreeModel, NoneType) – The model where the item belongs. -
child_item_type
[source]¶ Returns the type of child items. Reimplement in subclasses to return something more meaningfull.
-
find_children
(self, cond=lambda child: True)[source]¶ Returns children that meet condition expressed as a lambda function.
-
find_child
(self, cond=lambda child: True)[source]¶ Returns first child that meet condition expressed as a lambda function or None.
-
insert_children
(self, position, *children)[source]¶ Insert new children at given position. Returns a boolean depending on how it went.
Parameters: - position (int) – insert new items here
- children (iter) – insert items from this iterable
-
-
class
spinetoolbox.mvcmodels.minimal_tree_model.
MinimalTreeModel
(parent=None)[source]¶ Bases:
PySide2.QtCore.QAbstractItemModel
Base class for all tree models.
Init class.
Parameters: parent (DataStoreForm) – -
visit_all
(self, index=QModelIndex())[source]¶ Iterates all items in the model including and below the given index. Iterative implementation so we don’t need to worry about Python recursion limits.
-
index
(self, row, column, parent=QModelIndex())[source]¶ Returns the index of the item in the model specified by the given row, column and parent index.
-
data
(self, index, role=Qt.DisplayRole)[source]¶ Returns the data stored under the given role for the index.
-