Skip to content

StringListModel

Qt Base Class: QStringListModel

Signature: QStringListModel(self, parent: Optional[PySide6.QtCore.QObject] = None) -> None QStringListModel(self, strings: Sequence[str], parent: Optional[PySide6.QtCore.QObject] = None) -> None

Base classes

Name Children Inherits
StringListModelMixin
prettyqt.core.stringlistmodel
QStringListModel
PySide6.QtCore
QStringListModel(self, parent: Optional[PySide6.QtCore.QObject] \= None) -> None

Subclasses

Class Module Description
IconModel prettyqt.custom_widgets.iconbrowser

⋔ Inheritance diagram

graph TD
  1473299897008["core.StringListModel"]
  1473299896032["core.StringListModelMixin"]
  1473299894080["core.AbstractListModelMixin"]
  1473299890176["core.AbstractItemModelMixin"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473289051104["QtCore.QStringListModel"]
  1473289043296["QtCore.QAbstractListModel"]
  1473289050128["QtCore.QAbstractItemModel"]
  1473288842240["QtCore.QObject"]
  1473291690208["Shiboken.Object"]
  1473299896032 --> 1473299897008
  1473299894080 --> 1473299896032
  1473299890176 --> 1473299894080
  1473299815024 --> 1473299890176
  140713234304496 --> 1473299815024
  1473289051104 --> 1473299897008
  1473289043296 --> 1473289051104
  1473289050128 --> 1473289043296
  1473288842240 --> 1473289050128
  1473291690208 --> 1473288842240
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: StringListModelMixin, QStringListModel

Model that supplies strings to views.

Source code in prettyqt\core\stringlistmodel.py
class StringListModel(StringListModelMixin, core.QStringListModel):
    """Model that supplies strings to views."""

    def __repr__(self):
        return f"{type(self).__name__}: ({self.rowCount()})"

    def columnCount(self, parent: core.ModelIndex | None = None) -> int:
        # columnCount is private for StringListModel, but we need it
        # to avoid workarounds (for example in our Slice proxies).
        # So lets just return 1.
        return 1

    @classmethod
    def supports(cls, instance) -> bool:
        match instance:
            case (str(), *_):
                return True
            case _:
                return False

⌗ Property table

Qt Property Type Doc
objectName QString