insarviz.view.schema.Schema module
- class insarviz.view.schema.Schema.Schema[source]
Bases:
objectAbtract class for schemas.
When creating an item model for Qt (to show in QAbstractItemViews), you need to provide a way to represent an underlying data structure as a QAbstractItemModel.
A schema is a sort of translation layer between a Python structure (a list, a class, or a plain data type) and a QAbstractItemModel. It describes the shape of the structure in a way that Qt can navigate.
Qt’s tree model is rather simple, albeit a bit cumbersome for complex structures : every level of a tree is a node that can provide some data (through the ‘data’ function), and may contain sub-nodes. A QModelIndex is a sort of pointer into such a tree. From a given QModelIndex, Qt should be able to access its data, parent, and children, which allows it access to the whole structure.
A schema, at its core, simply takes values of some type, and for each value creates a ‘Node’ object that provides all the above information for that value.
- class Node(item_model: QAbstractItemModel, schema: Parent)[source]
Bases:
QObject,GenericThe base Schema.Node class.
This class provides all the default behaviour of an empty QAbstractItemModel tree, as needed by the SchemaItemModel and SchemaItemDelegate classes.
TODO_DOC
- beginInsertRows
- beginRemoveRows
- beginReplaceRows
- property cached_children
- can_mime_import_child(__mimeData__, __action__, __row__, __column__, /, **kwargs) bool[source]
Check whether the data can be inserted as a child of this node
- can_mime_import_self(mimeData: QMimeData, __action__: DropAction, **kwargs) bool[source]
Check whether the data is in a suitable format for importing into this node
- dataChanged
- endInsertRows
- endRemoveRows
- endReplaceRows
- mime_export() QMimeData | None[source]
Produce a QMimeData containing a serialized representation of the model, or None if the model can’t be dragged
- mime_import_child(__mimeData__, __action__, __row__, __column__, /, **kwargs) bool[source]
Insert the given data as a child of this node. Return True if the import succeeded
- mime_import_self(mimeData: QMimeData, __action__: DropAction, **kwargs) bool[source]
Import the given data into the model. Return True if the import succeeded
- model: Model
- requestModelChange
- set_model(model: Any)[source]
Change the underlying model for this node.
May be reimplemented by subclasses, depending on whether the node needs to be connected/disconnected to signals from the model.
Usually, when resetting the model, you’d first disconnect from the previous model, then call super().set_model(model), and finally connect to the new model.
- staticMetaObject = PySide6.QtCore.QMetaObject("Node" inherits "QObject": Methods: #4 type=Signal, signature=requestModelChange(PyObject), parameters=PyObject #5 type=Signal, signature=dataChanged(QVariantList), parameters=QVariantList #6 type=Signal, signature=beginRemoveRows(int,int), parameters=int, int #7 type=Signal, signature=endRemoveRows(int,int), parameters=int, int #8 type=Signal, signature=beginInsertRows(int,int), parameters=int, int #9 type=Signal, signature=endInsertRows(int,int), parameters=int, int #10 type=Signal, signature=beginReplaceRows(int,int), parameters=int, int #11 type=Signal, signature=endReplaceRows(int,int), parameters=int, int #12 type=Slot, signature=_on_data_changed(QVariantList), parameters=QVariantList #13 type=Slot, signature=_on_begin_remove_rows(int,int), parameters=int, int #14 type=Slot, signature=_on_end_remove_rows(int,int), parameters=int, int #15 type=Slot, signature=_on_begin_insert_rows(int,int), parameters=int, int #16 type=Slot, signature=_on_end_insert_rows(int,int), parameters=int, int )