Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
MouseReleaseEvent gets called twice
So I have this minimal example reproducing my problem:
from PyQt5 import QtWidgets as qtw class Scene(qtw.QGraphicsScene): def mousePressEvent(self, event: qtw.QGraphicsSceneMouseEvent) -> None: print("pressed") def mouseReleaseEvent(self, event: qtw.QGraphicsSceneMouseEvent) -> None: print("released") class MainWindow(qtw.QMainWindow): def __init__(self, parent=None): super(MainWindow, self).__init__(parent) scene = Scene() view = qtw.QGraphicsView(scene) centralWidget = qtw.QWidget() centralLayout = qtw.QHBoxLayout(centralWidget) centralWidget.setLayout(centralLayout) centralLayout.addWidget(view) self.setCentralWidget(centralWidget) self.show() if __name__ == '__main__': import sys app = qtw.QApplication(sys.argv) mainWindow = MainWindow() sys.exit(app.exec())
When I run the programm, and doubletap the left mouse button fast, I get the output
pressed released released
Which is not what I expect it to do. It should rather print pressed, released, pressed, released.
Any idea? Im kinda stuck on this one
You should add:
- the PyQt5 version you are using
- the Qt version
- the OS
- the hardware for your double tap
- That should be 5.14.0 aswell
- Windows 10 Education
- Steelseries rival 100
A quick fix I found was to call the mousePressEvent in the mouseDoubleClickEvent method, but Im not sure if thats supposed to be like that
Pl45m4 last edited by
Steelseries rival 100
So it's actually just a "normal" doubleClick instead of tap?
"Tap" suggests, that you are using a touchscreen, which isn't the case :)
Do you face the same behavior, when you use a standard mouse?
Thomas Stein last edited by Thomas Stein
Yes sorry, my bad. I shouldve used click instead of tap, you are right. And yes, I do face the same behaviour
Pl45m4 last edited by
And yes, I do face the same behaviour
My idea was, that your (gaming) mouse has some software or special double click behavior which causes your weird debug output...
Well I tried double tapping my laptops touchpad, and it still get the same output