Paint method of QtGui.QGraphicsWidget is not calling with(python 64Bit).



  • Hi ,

    I am Using python 2.7.2 (64-bit), i have override paint method of QGraphicsWidget class but whenever i move and change the item size , paint method doesn't call.

    But when i use python 32- bit it's working.

    could anyone help me to figure out the problem.
    here is my code.

    from PySide import QtCore, QtGui

    class Widget(QtGui.QGraphicsWidget):

    def init(self,*args):
    QtGui.QGraphicsWidget.init(self,*args)
    self.setGeometry(2,2,500,500)

    def paint(self,*args,**kwargs):
    print "calling paint method"

    if name == 'main':
    import sys
    app = QtGui.QApplication(sys.argv)
    scene = QtGui.QGraphicsScene()

    scene.setSceneRect(0, 0, 800, 480)
    minSize = QtCore.QSizeF(30, 100)

    prefSize = QtCore.QSizeF(210, 100)

    maxSize = QtCore.QSizeF(300, 100)
    l = QtGui.QGraphicsAnchorLayout()
    l.setSpacing(0)
    w = Widget(None, QtCore.Qt.Window)
    w.setPos(20, 20)
    w.setLayout(l)
    scene.addItem(w)
    scene.setBackgroundBrush(QtCore.Qt.darkGreen)
    view = QtGui.QGraphicsView(scene)
    view.show()
    sys.exit(app.exec_())


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.