Skip to content

BaseXmlModel

Sub classes

Name Children Inherits
XmlModel
prettyqt.itemmodels.xmlmodel
Xml model for the builtin ElementTree. Child items are created lazily.

    Base classes

    Name Children Inherits
    ColumnItemModel
    prettyqt.itemmodels.columnitemmodel
    TreeModel with columns defined by ColumnItem classes.

    ⋔ Inheritance diagram

    graph TD
      2676970995["itemmodels.BaseXmlModel"]
      3096575510["itemmodels.ColumnItemModel"]
      1030521844["itemmodels.ColumnItemModelMixin"]
      2751680898["builtins.object"]
      2846913429["itemmodels.TreeModel"]
      874904086["core.AbstractItemModel"]
      3882849576["core.AbstractItemModelMixin"]
      3227531497["core.ObjectMixin"]
      1898060022["QtCore.QAbstractItemModel"]
      3984060476["QtCore.QObject"]
      37984305["Shiboken.Object"]
      3096575510 --> 2676970995
      1030521844 --> 3096575510
      2751680898 --> 1030521844
      2846913429 --> 3096575510
      874904086 --> 2846913429
      3882849576 --> 874904086
      3227531497 --> 3882849576
      2751680898 --> 3227531497
      2751680898 --> 3882849576
      1898060022 --> 874904086
      3984060476 --> 1898060022
      37984305 --> 3984060476
      2751680898 --> 37984305

    🛈 DocStrings

    Bases: ColumnItemModel

    Source code in prettyqt/itemmodels/xmlmodel.py
    class BaseXmlModel(itemmodels.ColumnItemModel):
        ICON = "mdi.xml"
        COLUMNS: ClassVar = [TagColumn, TextColumn, TailColumn, AttributeColumn]
    
        def __init__(self, obj, show_root: bool = True, **kwargs):
            super().__init__(obj=obj, columns=self.COLUMNS, show_root=show_root, **kwargs)
    
        class Roles(enum.IntEnum):
            NodeRole = constants.USER_ROLE + 24245
    
        def _has_children(self, item: XmlModel.TreeItem) -> bool:
            return len(item.obj) > 0
    
        def _fetch_object_children(self, item: XmlModel.TreeItem) -> list[XmlModel.TreeItem]:
            return [self.TreeItem(obj=i) for i in item.obj]
    

    :fa-brands-github: Show source on GitHub