#!/usr/bin/env python import sys from PyQt4 import QtGui, QtCore class MainView(QtGui.QGraphicsView): def __init__(self, *val): QtGui.QGraphicsView.__init__(self, *val) self.connect(self, QtCore.SIGNAL("pressed(QEvent)"), self.slotPressEvent) def mousePressEvent(self, event): print "mousePressEvent" #self.emit(QtCore.SIGNAL('pressed'), (event)) QtGui.QGraphicsView.mousePressEvent(self, event) def slotPressEvent(self, event): print "slotPressEvent" class Window(QtGui.QMainWindow): def __init__(self, *val): QtGui.QMainWindow.__init__(self, *val) self.scene = QtGui.QGraphicsScene() self.view = MainView(self.scene) self.setCentralWidget(self.view) if __name__ == "__main__": app = QtGui.QApplication(sys.argv) window = Window() window.show() sys.exit(app.exec_())
Friday, April 27, 2012
test syntaxhighlighter
Labels:
test
Subscribe to:
Posts (Atom)