SGNode
Qt Base Class: QSGNode
Signature: QSGNode(self) -> None
QSGNode(self, type: PySide6.QtQuick.QSGNode.NodeType) -> None
Base classes
Name |
Children |
Inherits |
QSGNode PySide6.QtQuick QSGNode(self) -> None |
|
|
⋔ Inheritance diagram
graph TD
1473374462320["quick.SGNode"]
1473572378432["QtQuick.QSGNode"]
1473291690208["Shiboken.Object"]
140713234304496["builtins.object"]
1473572378432 --> 1473374462320
1473291690208 --> 1473572378432
140713234304496 --> 1473291690208
🛈 DocStrings
Bases: QSGNode
The base class for all nodes in the scene graph.
Source code in prettyqt\quick\sgnode.py
| class SGNode(QtQuick.QSGNode):
"""The base class for all nodes in the scene graph."""
def __getitem__(self, index: int) -> QtQuick.QSGNode:
return self.childAtIndex(index)
def __delitem__(self, item: int | QtQuick.QSGNode):
if isinstance(item, int):
item = self.childAtIndex(item)
self.removeChildNode(item)
def get_type(self) -> NodeTypeStr:
"""Get the type of the node.
Returns:
Node type
"""
return NODE_TYPE.inverse[self.type()]
def get_flags(self) -> list[FlagStr]:
return FLAG.get_list(self.flags())
def get_children(self, recursive: bool = False) -> list[SGNode]:
"""Get children of this item.
recursive option is written iteratively to also support original QTreeWidgetItems.
"""
if not recursive:
return [self.childAtIndex(i) for i in range(self.childCount())]
results = []
nodes = [self]
while nodes:
items = []
for node in nodes:
results.append(node)
items.extend(node.childAtIndex(i) for i in range(node.childCount()))
nodes = items
return results[1:]
|
get_children(recursive: bool = False) -> list[SGNode]
Get children of this item.
recursive option is written iteratively to also support original QTreeWidgetItems.
Source code in prettyqt\quick\sgnode.py
| def get_children(self, recursive: bool = False) -> list[SGNode]:
"""Get children of this item.
recursive option is written iteratively to also support original QTreeWidgetItems.
"""
if not recursive:
return [self.childAtIndex(i) for i in range(self.childCount())]
results = []
nodes = [self]
while nodes:
items = []
for node in nodes:
results.append(node)
items.extend(node.childAtIndex(i) for i in range(node.childCount()))
nodes = items
return results[1:]
|
get_type() -> NodeTypeStr
Get the type of the node.
Source code in prettyqt\quick\sgnode.py
| def get_type(self) -> NodeTypeStr:
"""Get the type of the node.
Returns:
Node type
"""
return NODE_TYPE.inverse[self.type()]
|