Hello. Sorry for my bad english..
How can I call setCetralWidget() that previous widget wasn't deleted?
it is the realization of setCentralWidget():
void QMainWindow::setCentralWidget(QWidget *widget)
- {
- Q_D(QMainWindow);
- if (d->layout->centralWidget() && d->layout->centralWidget() != widget) {
- d->layout->centralWidget()->hide();
- d->layout->centralWidget()->deleteLater();
- }
- d->layout->setCentralWidget(widget);
- }
so, setCentralWidget always call method deleteLater().
There is some ways to do it, for example:
centralWidget()->setParent(NULL);
//then we can use setCentralWidget()
1) Is there some other ways to do it?
2) Hmm.. can I redefenition deleteLater() in centralWidget()?
Bookmarks