#includeIn this example, we create a QHBoxLayout and add two QPushButton objects to it. Then, we create a widget and set the horizontal layout as its layout. Finally, we show the widget. Package library: QtGui.#include int main(int argc, char *argv[]) { QApplication a(argc, argv); // Create buttons QPushButton *button1 = new QPushButton("Button 1"); QPushButton *button2 = new QPushButton("Button 2"); // Create horizontal layout QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(button1); layout->addWidget(button2); // Create widget and set layout QWidget *widget = new QWidget; widget->setLayout(layout); // Show window widget->show(); return a.exec(); }