Skip to content

AbstractItemDelegateMixin

Base classes

Name Children Inherits
ObjectMixin
prettyqt.core.object

Subclasses

Class Module Description
AbstractItemDelegate prettyqt.widgets.abstractitemdelegate
ItemDelegate prettyqt.widgets.itemdelegate
StyledItemDelegate prettyqt.widgets.styleditemdelegate

⋔ Inheritance diagram

graph TD
  1473296344704["widgets.AbstractItemDelegateMixin"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473299815024 --> 1473296344704
  140713234304496 --> 1473299815024

🛈 DocStrings

Bases: ObjectMixin

Source code in prettyqt\widgets\abstractitemdelegate.py
class AbstractItemDelegateMixin(core.ObjectMixin):
    pass
    # this pattern doesnt work for PySide6 yet (cant pass kwargs for class definition)
    # _registry = {}

    # def __init_subclass__(cls, identifier=None, **kwargs):
    #     super().__init_subclass__(**kwargs)
    #     if identifier is not None:
    #         logger.debug(f"registering delegate {cls} {identifier!r}")
    #         if (
    #             identifier in cls._registry
    #             and cls._registry[identifier].__name__ != cls.__name__
    #         ):
    #             raise NameError(f"Delegate with id {identifier!r} already registered.")
    #         cls._registry[identifier] = cls

    @staticmethod
    def _data_for_index(
        index: core.ModelIndex, role: constants.ItemDataRole = constants.USER_ROLE
    ):
        # using index.data() sometimes casts stuff in PyQt6
        model = index.model()
        data = model.data(index, role)
        return data