Skip to content

HoverIconEventFilter

Qt Base Class: QObject

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

Base classes

Name Children Inherits
BaseEventFilter
prettyqt.eventfilters.baseeventfilter

⋔ Inheritance diagram

graph TD
  1473367061856["eventfilters.HoverIconEventFilter"]
  1473367044288["eventfilters.BaseEventFilter"]
  1473299782816["core.Object"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473288842240["QtCore.QObject"]
  1473291690208["Shiboken.Object"]
  1473367044288 --> 1473367061856
  1473299782816 --> 1473367044288
  1473299815024 --> 1473299782816
  140713234304496 --> 1473299815024
  1473288842240 --> 1473299782816
  1473291690208 --> 1473288842240
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: BaseEventFilter

Source code in prettyqt\eventfilters\hovericoneventfilter.py
class HoverIconEventFilter(eventfilters.BaseEventFilter):
    def __init__(self, normal, hover, pressed=None, parent=None):
        super().__init__(parent)
        self.normal = normal
        self.hover = hover
        self.pressed = pressed

    def eventFilter(self, obj, event: core.Event) -> bool:
        # if obj is not self.parent():
        #     return super().eventFilter(obj, event)
        match event.type():
            case core.Event.Type.Enter | core.Event.Type.MouseButtonRelease if self.hover:
                obj.set_icon(self.hover)
            case core.Event.Type.Leave:
                obj.set_icon(self.normal)
            case core.Event.Type.MouseButtonPress if self.pressed:
                obj.set_icon(self.pressed)
        return super().eventFilter(obj, event)

⌗ Property table

Qt Property Type Doc
objectName QString