[PyQt] Problem with QGraphics
Andreas Pakulat
apaku at gmx.de
Mon Nov 10 08:25:53 GMT 2008
On 09.11.08 22:05:47, Luigi Curzi wrote:
> hello.
> i have a problem whit qgraphics: i wrote these lines:
> pixmap = QtGui.QPixmap("/media/glorious/datiVari/progettiProgrammazione/bitslaiser/f.jpg")
> scene = QtGui.QGraphicsScene(QtCore.QRectF(0.0, 0.0, 300.0, 300.0))
> scene.addPixmap(pixmap)
> scene.addText("Hello, world!")
> self.ui.graphicsView.setScene(scene)
> self.ui.graphicsView.show()
>
> graphicsView is a view created whit qt4 designer;
> i don't receive any error, but it doesn't appear anything.
> in the gui's code i have these lines:
> self.graphicsView = QtGui.QGraphicsView(self.centralwidget)
> self.graphicsView.setGeometry(QtCore.QRect(50,100,741,431))
> self.graphicsView.setObjectName("graphicsView")
>
> do i forget something? what can i do?
Yes, you didn't call setupUi() anywhere. I suggest to have a look at the
designer manual, it explains how ui-files in Qt4 work. You need to create a
QWidget yourself and apply the ui to it to see something. Also the
self.ui.graphicsView.show() is not needed.
Andreas
--
You will become rich and famous unless you don't.
More information about the PyQt
mailing list