15 const QObject* stateChangeReceiver,
const char* stateChangeSlot)
18 QGroupBox* widget =
new QGroupBox;
20 widget->setCheckable(
true);
21 widget->setChecked(
true);
25 widget->setStyleSheet(R
"(
26 QGroupBox::indicator:checked {
27 image: url(:/icons/TriangleBlackDown.svg);
29 QGroupBox::indicator:unchecked {
30 image: url(:/icons/TriangleBlackRight.svg);
35 QHBoxLayout* layout = new QHBoxLayout;
36 widget->setLayout(layout);
37 layout->setContentsMargins(0, 0, 0, 0);
39 QWidget* holder =
new QWidget;
40 layout->addWidget(holder);
42 QObject::connect(widget, SIGNAL(clicked(
bool)), holder, SLOT(setVisible(
bool)));
44 if (desc.children.size() > 0)
47 QVBoxLayout* layout =
new QVBoxLayout;
48 holder->setLayout(layout);
49 layout->setContentsMargins(9, 0, 0, 0);
50 for (
const auto& child : desc.children)
52 layout->addWidget(createChild(child));
56 widget->setChecked(!desc.collapsed);
57 holder->setVisible(!desc.collapsed);
66 const QObject* stateChangeReceiver,
const char* stateChangeSlot)
71 QVBoxLayout* layout =
new QVBoxLayout(widget);
72 widget->setLayout(layout);
73 layout->setContentsMargins(0, 0, 0, 0);
76 QWidget* childWidget = createChild(child);
77 layout->addWidget(childWidget);
87 const QObject* stateChangeReceiver,
const char* stateChangeSlot)
92 QHBoxLayout* layout =
new QHBoxLayout(widget);
93 widget->setLayout(layout);
94 layout->setContentsMargins(0, 0, 0, 0);
97 QWidget* childWidget = createChild(child);
98 layout->addWidget(childWidget);
107 const QObject* stateChangeReceiver,
const char* stateChangeSlot)
111 switch (desc.children.size())
116 return createChild(desc.children.front());
122 QHBoxLayout* layout =
new QHBoxLayout(widget);
123 widget->setLayout(layout);
124 layout->setContentsMargins(0, 0, 0, 0);
127 QWidget* childWidget = createChild(child);
128 layout->addWidget(childWidget);
138 const QObject* stateChangeReceiver,
const char* stateChangeSlot)
143 QGridLayout* layout =
new QGridLayout(widget);
144 widget->setLayout(layout);
145 layout->setContentsMargins(0, 0, 0, 0);
151 QWidget* childWidget = createChild(child);
153 if (
auto spc = SimpleGridLayoutSpanningChildPtr::dynamicCast(child); spc)
155 colspan =
std::max(1, spc->columns);
157 layout->addWidget(childWidget, row, col, 1, colspan);
159 if (col + colspan >= desc.columns)
178 const QObject* stateChangeReceiver,
const char* stateChangeSlot)
183 QGridLayout* layout =
new QGridLayout(widget);
184 widget->setLayout(layout);
185 layout->setContentsMargins(0, 0, 0, 0);
187 for (std::size_t i = 0; i < desc.children.size(); ++i)
191 QWidget* childWidget = createChild(child);
194 if (i < desc.childrenLayoutInfo.size())
196 l = desc.childrenLayoutInfo.at(i);
205 maxrow =
std::max(maxrow, l.row + l.spanRow);
206 layout->addWidget(childWidget, l.row, l.col, l.spanRow, l.spanCol);