use a layout
This commit is contained in:
parent
a2ed52c47f
commit
ca753a42fe
18
main.cc
18
main.cc
@ -6,14 +6,18 @@ int main(int argc, char * argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
QWidget window;
|
QHBoxLayout * layout = new QHBoxLayout();
|
||||||
window.resize(600, 600);
|
|
||||||
window.show();
|
|
||||||
window.setWindowTitle("My Qt Application!");
|
|
||||||
|
|
||||||
QPushButton * button = new QPushButton("Press me", &window);
|
QPushButton * button = new QPushButton("Press me");
|
||||||
button->move(100, 100);
|
layout->addWidget(button);
|
||||||
button->show();
|
|
||||||
|
QLabel * label = new QLabel("Label");
|
||||||
|
layout->addWidget(label);
|
||||||
|
|
||||||
|
QWidget window;
|
||||||
|
window.setLayout(layout);
|
||||||
|
window.setWindowTitle("My Qt Application!");
|
||||||
|
window.show();
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user