31template <
typename Array,
typename... Args>
struct SectionLoader<Array, std::tuple<Args...>> {
35 initSection<Args...>(ui);
39 template <
typename W,
typename Z,
typename... Secs>
void initSection(Ui::ProjectConfigPrivate& ui)
42 initSection<Z, Secs...>(ui);
45 template <
typename T>
void initSection(Ui::ProjectConfigPrivate& ui)
47 constexpr size_t ndx =
section_ndx<T, std::tuple<Args...>>::value;
49 static_assert(ndx < std::tuple_size<std::remove_reference_t<
decltype(_widgets)>>::value,
"Index out of bounds");
51 auto pb =
new QCheckBox(T::sectionName(), ui.frame);
52 pb->setLayoutDirection(Qt::RightToLeft);
53 pb->setStyleSheet(QString(
"spacing: ") + QString::number(T::spacing()) +
"px;");
54 pb->setProperty(
"type",
"sectionHeader");
56 ui.verticalLayout->addWidget(pb);
58 auto wdg =
new QWidget(ui.frame);
59 wdg->setProperty(
"type",
"sectionWidget");
60 auto wdgLayout =
new QVBoxLayout(wdg);
61 wdgLayout->setSpacing(10);
62 wdgLayout->setContentsMargins(0, 0, 0, 0);
63 ui.verticalLayout->addWidget(wdg);
66 QObject::connect(pb, &QPushButton::toggled, wdg, &QWidget::setVisible);
82 auto spacer =
new QSpacerItem(17, 410, QSizePolicy::Minimum, QSizePolicy::Expanding);
83 ui.verticalLayout->addItem(spacer);
88 addWidget<Args...>(bg);
93 for (
auto wdg : _widgets) {
95 while ((item = wdg->layout()->takeAt(0)) !=
nullptr) {
96 delete item->widget();
103 template <
typename T>
void addWidget(
const QColor& bg)
107 static_assert(ndx < std::tuple_size<
decltype(_widgets)>::value,
"Index out of bounds");
110 _widgets[ndx]->layout()->addWidget(
new IconLabel(T::name, T::PluginType::sectionColor(), bg));
116 template <
typename W,
typename Z,
typename... Plugs>
void addWidget(
const QColor& bg)
119 addWidget<Z, Plugs...>(bg);
122 std::array<QWidget*, std::tuple_size<S>::value> _widgets {};