From ca753a42fe8e340e9c4fbc51b0a0a4a4ba904049 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 17 Mar 2015 18:19:40 -0400 Subject: [PATCH] use a layout --- main.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/main.cc b/main.cc index 398d385..7597418 100644 --- a/main.cc +++ b/main.cc @@ -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(); }