[PyQt] creating a QgraphicsView in MainWindow
Arnold Krille
arnold at arnoldarts.de
Thu Feb 26 10:40:53 GMT 2009
Hi,
On Thursday 26 February 2009 11:25:25 Phil Thompson wrote:
> On Thu, 26 Feb 2009 02:16:41 -0800 (PST), Mads Kofod Hansen
> <kofoden at yahoo.com> wrote:
> > I have a QMainWindow with a menu bar and I want to create a QGraphicsView
> > below the menu bar.
> > But this only displays the MainWindow with a menubar. How do I create the
> > GraphicsView in the MainWindow?
> You aren't keeping references to your view or scene so they are being
> garbage collected.
And the easiest way to do so (if you don't need a reference for your own
purpose) is to add the graphicsview to the mainwindow as the central widget
done via setCentralWidget. Which has the advantage that it automaticly adds
your graphicsview as the central widget in the mainwindow so it gets sized to
fill all available space and get resized when the mainwindow is resized...
Have fun,
Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090226/cb25153f/attachment.bin
More information about the PyQt
mailing list