cpp
#include <QtWidgets>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// Create the main window
QWidget window;
window.setWindowTitle("Main Window");
// Create a layout to hold all the widgets
QVBoxLayout *mainLayout = new QVBoxLayout;
// Create a slider to adjust a parameter
QSlider *slider = new QSlider(Qt::Horizontal);
slider->setRange(0, 10);
slider->setValue(5);
// Connect the slider to a slot
QObject::connect(slider, &QSlider::valueChanged, [](int value) {
qDebug() << "Slider value changed to" << value;
});
// Add the slider to the layout
mainLayout->addWidget(slider);
// Set the layout of the main window
window.setLayout(mainLayout);
// Show the window
window.show();
return a.exec();
}