Skip to content

Instantly share code, notes, and snippets.

@eyllanesc
Created December 24, 2018 18:23
Show Gist options
  • Save eyllanesc/c418868f79a7452716a82c18deba604f to your computer and use it in GitHub Desktop.
Save eyllanesc/c418868f79a7452716a82c18deba604f to your computer and use it in GitHub Desktop.
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