[PyQt] Problem with QGraphics
luigi_curzi at yahoo.it
Mon Nov 10 09:23:03 GMT 2008
--- Lun 10/11/08, Andreas Pakulat <apaku at gmx.de> ha scritto:
> Da: Andreas Pakulat <apaku at gmx.de>
> Oggetto: Re: [PyQt] Problem with QGraphics
> A: pyqt at riverbankcomputing.com
> Data: Lunedì 10 novembre 2008, 09:25
> On 09.11.08 22:05:47, Luigi Curzi wrote:
> > hello.
> > i have a problem whit qgraphics: i wrote these lines:
> > pixmap =
> > 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 =
> > 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.
excuse me, i wasn't clear:
the lines i posted are in a function (that is in the main class) that is executed when i click on a button; the gui file, that i created with qt4-designer, contains setupUi and works, and also other functions connected with the gui items work.
the lines above don't work with or without "self.ui.graphicsView.show()"; i use qt/pyqt in debian testing and the file "f.jpg" exists.
Unisciti alla community di Io fotografo e video, il nuovo corso di fotografia di Gazzetta dello sport:
More information about the PyQt