#includeint main(int argc, char *argv[]) { QApplication app(argc, argv); QFrame frame; frame.show(); return app.exec(); }
#includeThis code creates a QFrame widget with a vertical layout and two child QPushButton widgets. The layout is set on the frame, which contains the child widgets. Package Library: Qt5 Widgets.#include #include int main(int argc, char *argv[]) { QApplication app(argc, argv); QFrame frame; QVBoxLayout *layout = new QVBoxLayout; QPushButton *button1 = new QPushButton("Button 1"); QPushButton *button2 = new QPushButton("Button 2"); layout->addWidget(button1); layout->addWidget(button2); frame.setLayout(layout); frame.show(); return app.exec(); }