I'm trying to connect Mouse Hover Event and QPushButtons. I want to change CheckStatus on the next when I hover over it after I pressed on one of the button.
I was able to connect this event with the buttons. But I can't understand how to connect it with press button event.
def __init__(self):
super().__init__()
uic.loadUi("my_file.ui", self)
self.gridLayout.installEventFilter(self)
for button in self.gridLayoutWidget.findChildren(QtWidgets.QAbstractButton):
button.clicked.connect(self.rangeButtonClicked)
button.setAttribute(Qt.WidgetAttribute.WA_Hover)
button.installEventFilter(self)
self.gridLayout.installEventFilter(self)
def eventFilter(self, obj, event):
if event.type() == QEvent.Type.HoverEnter:
sender = obj
sender.nextCheckState()
return super().eventFilter(obj, event)
Required actions:
- I press the button
- I move the mouse along the rest of the buttons
- The pressed button and those over which the mouse hover - change the status
