use a layout

This commit is contained in:
Josh Holtrop 2015-03-17 18:19:40 -04:00
parent a2ed52c47f
commit ca753a42fe

18
main.cc
View File

@ -6,14 +6,18 @@ int main(int argc, char * argv[])
{
QApplication app(argc, argv);
QWidget window;
window.resize(600, 600);
window.show();
window.setWindowTitle("My Qt Application!");
QHBoxLayout * layout = new QHBoxLayout();
QPushButton * button = new QPushButton("Press me", &window);
button->move(100, 100);
button->show();
QPushButton * button = new QPushButton("Press me");
layout->addWidget(button);
QLabel * label = new QLabel("Label");
layout->addWidget(label);
QWidget window;
window.setLayout(layout);
window.setWindowTitle("My Qt Application!");
window.show();
return app.exec();
}