QGraphicsRectItem移动QGraphicsScene

时间:2014-08-14 03:34:54

标签: python pyqt

此代码http://pastebin.com/XGWDyRd1

在场景上绘制一个矩形。 当我移动它时,它不移动光标,并跳到某处。 我做错了什么?

1 个答案:

答案 0 :(得分:0)

错字

class MyRect(QtGui.QGraphicsRectItem):
    def mousePressEvent(self, event):
        print 'press event'    
        super(MyRect, self).mousePressEvent(event)

    def mouseReleaseEvent(self, event):
        print 'press release'  
        super(MyRect, self).mouseReleaseEvent(event)