Create QMainWindow in runtime
Hi all,
I want to create a QMainWindow when I click in a QPushButton.
I have this code in the SLOT of the QPushButton that is called when the clicked() SIGNAL is emitted:
Code:
myQMainWindow->setWindowModality(Qt::WindowModal);
myQMainWindow->setGeometry(geometry());
myQMainWindow
->move
(QPoint(100,
100));
myQMainWindow->setLayout(layout);
myQMainWindow->show();
The window appears but the button with text "hello" doesn't shown. Why?
Regards.
Re: Create QMainWindow in runtime
Maybe you have to add button to layout?
Re: Create QMainWindow in runtime
I have solved it.
I have created a QWidget and I have called to QMainWindow::setCentralWidget() method.
Regards.