[Qt-interest] Does QMainWindow::setCentralWidget(QWidget *) destroy the old central widget?
Matt Rogers
mattr at kde.org
Fri Feb 27 19:22:50 CET 2009
On Friday 27 February 2009 12:03:10 Kermit Mei wrote:
> Hello, I have more then three Widgets, and they monopolizes the whole
> MainWindow separately during different duration.
> My idear is to use setCentralWidget() set them as central widget of the
> MainWindow when I need.
>
> The widgets are QWidget's sub-classes, and they are all controlled as
> pointer. When I set another widget as central widget of the mainwindow,
> I found that the old Central Widget will be destroyed automatically.
>
> Is there any better way to do it?
>
> Thanks.
>
Use a widget stack, set it as the central widget and then use the widget stack
functionality to switch between your three main widgets. See the API docs for
QWidgetStack for more information.
Hope this helps.
--
Matt
More information about the Qt-interest-old
mailing list