I think you are drawing your pixmap off the edge of the scene. Try the
following:

scene = QtGui.QGraphicsScene()

#scene.setSceneRect(-600,-600, 600,600)
scene.setSceneRect(-600, -600, 1200, 1200)

pic = QtGui.QPixmap(":/images/triangle.png")
scene.addItem(QtGui.QGraphicsPixmapItem(pic))
view = self.gv
view.setScene(scene)
view.setRenderHint(QtGui.QPainter.Antialiasing)
view.show()

Adam

On 7/21/07, kib2 <[EMAIL PROTECTED]> wrote:
Hi,

This is the first time I'm playing with QGraphicsView.
My aim was simply to display a png image inside it (I need something
more convenient than a QLabel).

Here's some part of my code (self.gv is just a QGraphicsView instance
and a directory "images" has been created inside my script dir
containing the image "triangle.png"):

----->----->----->----->
scene = QtGui.QGraphicsScene()
scene.setSceneRect(-600,-600, 600,600)
pic = QtGui.QPixmap(":/images/triangle.png")
scene.addItem(QtGui.QGraphicsPixmapItem(pic))
view = self.gv
view.setScene(scene)
view.setRenderHint(QtGui.QPainter.Antialiasing)
view.show()
----->----->----->----->

Result : only a black area.
Did I miss something ?
Thanks.
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to