class MainWidget ( QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.ui = Ui_Form() self.ui.setupUi(self) self.scene = customScene() #self.scene.FigureSelected.connect(self.recall) #self.scene.DirectionSelected.connect(self.recall_dir) self.ui.graphicsView.setScene(self.scene) image = QtGui.QImage("GUI/img/field_background.png") pixmap = QtGui.QGraphicsPixmapItem(QtGui.QPixmap.fromImage(image).scaled(590,590)) self.scene.addItem(pixmap) self.setMouseTracking(True) self.ui.graphicsView.setMouseTracking(True) pass def recall(self, x,y): print ('Clicked figure at %s/%s.' % (x,y)) pass def recall_dir(self, x,y,dir): print ('Move figure at %s/%s %s.' % (x,y,dir)) pass
def __init__(self): QtGui.QWidget.__init__(self) self.ui = Ui_Form() self.ui.setupUi(self) self.scene = customScene() #self.scene.FigureSelected.connect(self.recall) #self.scene.DirectionSelected.connect(self.recall_dir) self.ui.graphicsView.setScene(self.scene) image = QtGui.QImage("GUI/img/field_background.png") pixmap = QtGui.QGraphicsPixmapItem(QtGui.QPixmap.fromImage(image).scaled(590,590)) self.scene.addItem(pixmap) self.setMouseTracking(True) self.ui.graphicsView.setMouseTracking(True) pass