#include#include int main() { QDialog dialog; QVBoxLayout layout(&dialog); dialog.setLayout(&layout); return dialog.exec(); }
#includeIn this example, we create a dialog with a QHBoxLayout and add a QLabel and a QPushButton to it. We then set the layout for the QDialog using setLayout(). The package library used for these examples is Qt, specifically the QDialog and QLayout classes.#include #include #include int main() { QDialog dialog; QHBoxLayout layout(&dialog); QLabel label("Welcome to my app!"); QPushButton button("OK"); layout.addWidget(&label); layout.addWidget(&button); dialog.setLayout(&layout); return dialog.exec(); }