hello All,

i'm tring to use QtPainter to display a QImage object
this is my paint event : 


    def paintEvent(self, event):
        painter = QPainter(self)
        painter.fillRect(event.rect(), QBrush(Qt.black))
        image = self.receiver.getimage()
        print image , 'passed'
        imm = image.scaled(image.size(), Qt.KeepAspectRatio)
        immPos = QPoint((self.width() - image.width())/2.0,
(self.height() - image.height())/2.0)
        painter.drawImage(immPos, imm)


####

    self.cmp = QImage()
    def paintEvent(self, event):
        painter = QPainter(self)
        painter.fillRect(event.rect(), QBrush(Qt.black))
        image = self.receiver.getimage()
        print image , 'passed'
        self.cmp.load(image)
        cmp = self.cmp.scaled(self.size(), Qt.KeepAspectRatio)
        cmpPos = QPoint((self.width() - cmp.width())/2.0, (self.height()
- cmp.height())/2.0)
        painter.drawImage(cmpPos, cmp)


the first function receive a QImage object as event, but gived me a
segfault,

while the second function works .. 
but receive as event a "string" that's the full path to a real file.


Have you any hints on how to display a QImage object inside a QtPainter
event ?

thankyou for any hints!

Massimo.




_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to