Skip to content

Instantly share code, notes, and snippets.

@Ono-Sendai
Created August 19, 2016 23:54
Show Gist options
  • Save Ono-Sendai/706658362a09bbc44f40e1ef352898fa to your computer and use it in GitHub Desktop.
Save Ono-Sendai/706658362a09bbc44f40e1ef352898fa to your computer and use it in GitHub Desktop.
#include <QtWidgets/QApplication>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QSlider>
#include <QtWidgets/QScrollArea>
#include <utils/FileUtils.h>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QMainWindow main_window;
// Make central widget for main window
QWidget* central_widget = new QWidget(&main_window);
central_widget->setLayout(new QVBoxLayout(central_widget));
main_window.setCentralWidget(central_widget);
// Make scroll area in central widget
QScrollArea* scroll_area = new QScrollArea(central_widget);
scroll_area->setLayout(new QVBoxLayout(scroll_area));
scroll_area->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
scroll_area->setWidgetResizable(true);
central_widget->layout()->addWidget(scroll_area);
// Add some misc. widgets to scroll area
for(int i=0; i<10; ++i)
{
QSlider* slider = new QSlider(Qt::Orientation::Horizontal, scroll_area);
scroll_area->layout()->addWidget(slider);
}
main_window.show();
return app.exec();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment