Created
December 24, 2018 18:23
-
-
Save eyllanesc/c418868f79a7452716a82c18deba604f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt5 import QtCore, QtWidgets | |
class MainWindow(QtWidgets.QMainWindow): | |
def __init__(self, parent=None): | |
super(MainWindow, self).__init__(parent) | |
self._gv = QtWidgets.QGraphicsView() | |
self.setCentralWidget(self._gv) | |
self._gv.viewport().installEventFilter(self) | |
def eventFilter(self, obj, event): | |
if obj is self._gv.viewport() and event.type() == QtCore.QEvent.MouseButtonDblClick: | |
print(obj, event) | |
return super(MainWindow, self).eventFilter(obj, event) | |
if __name__ == '__main__': | |
import sys | |
app = QtWidgets.QApplication(sys.argv) | |
w = MainWindow() | |
w.show() | |
sys.exit(app.exec_()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment