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:
myQMainWindow->setWindowModality(Qt::WindowModal);
myQMainWindow->setGeometry(geometry());
myQMainWindow
->move
(QPoint(100,
100));
myQMainWindow->setLayout(layout);
myQMainWindow->show();
QMainWindow* myQMainWindow = new QMainWindow(this);
myQMainWindow->setWindowModality(Qt::WindowModal);
myQMainWindow->setGeometry(geometry());
myQMainWindow->move(QPoint(100, 100));
QVBoxLayout *layout = new QVBoxLayout(myQMainWindow->centralWidget());
myQMainWindow->setLayout(layout);
QPushButton* pushButton = new QPushButton("hello", myQMainWindow->centralWidget());
myQMainWindow->show();
To copy to clipboard, switch view to plain text mode
The window appears but the button with text "hello" doesn't shown. Why?
Regards.
Bookmarks