109 QVBoxLayout * vlayout =
new QVBoxLayout;
110 vlayout->setSpacing(0);
111 vlayout->setMargin(0);
113 QHBoxLayout * labellayout =
new QHBoxLayout;
114 labellayout->setSpacing(0);
115 labellayout->addWidget(
new QLabel(
"No collections in event."),0,Qt::AlignLeft);
116 labellayout->addStretch(1);
117 vlayout->addLayout(labellayout);
120 QSet<QString> sections;
122 sections.insert(
col->section());
123 QList<QString> sectionsSorted = sections.values();
124 std::sort(sectionsSorted.begin(), sectionsSorted.end());
127 const bool nosectionlabels = sectionsSorted.count() == 1 && sectionsSorted.at(0).isEmpty();
129 int maxFirstColumnCheckBoxWidth(0);
130 QList<QCheckBox*> firstColumnCheckBoxes;
133 for (QString
section : sectionsSorted) {
135 QLabel * sectionlabel(0);
136 if (!nosectionlabels) {
137 QHBoxLayout * labellayout =
new QHBoxLayout;
138 labellayout->setSpacing(0);
139 sectionlabel =
new QLabel;
140 sectionlabel->setTextFormat(Qt::RichText);
141 sectionlabel->setText(
"<b>"+
section+
"</b>");
142 labellayout->addWidget(sectionlabel,0,Qt::AlignLeft);
143 labellayout->addStretch(1);
144 vlayout->addLayout(labellayout);
147 QGridLayout * gridLayout =
new QGridLayout;
148 gridLayout->setHorizontalSpacing(6);
149 gridLayout->setVerticalSpacing(0);
150 gridLayout->setMargin(0);
151 if (!nosectionlabels)
152 gridLayout->addItem(
new QSpacerItem(10, 1, QSizePolicy::Fixed, QSizePolicy::Fixed),0,0);
153 vlayout->addLayout(gridLayout);
158 if (!
col->sectionToolTip().isEmpty())
159 sectionlabel->setToolTip(
col->sectionToolTip());
162 int newrow = gridLayout->rowCount();
164 for (QWidget*
w :
col->widgetsForGuiRow()) {
166 theclass->
message(
"WARNING: Ignoring null widget provided by widgetsForGuiRow() (perhaps due to a VP1StdCollection you didn't init()?)");
173 int maxheight =
static_cast<int>(0.5+QFontMetricsF(
f).height()*1.05+2);
174 w->setMaximumHeight(maxheight);
177 mb->setDimension(maxheight);
179 QCheckBox * cb =
dynamic_cast<QCheckBox *
>(
w);
181 firstColumnCheckBoxes << cb;
182 if (maxFirstColumnCheckBoxWidth<cb->sizeHint().width())
183 maxFirstColumnCheckBoxWidth = cb->sizeHint().width();
189 gridLayout->addWidget(
w, newrow,
i++);
191 gridLayout->addItem(
new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding),newrow,
i);
193 if (gridmargins==0) {
194 int left,
top, right, bottom;
195 gridLayout->getContentsMargins ( &left, &
top, &right, &bottom );
196 gridmargins = left+right;
200 if (maxFirstColumnCheckBoxWidth>0) {
201 for (QCheckBox *cb : firstColumnCheckBoxes)
202 cb->setMinimumWidth(maxFirstColumnCheckBoxWidth);
205 vlayout->addStretch(1);
207 QHBoxLayout * hlayout =
new QHBoxLayout;
208 hlayout->setMargin(0);
209 hlayout->setSpacing(0);
210 hlayout->addLayout(vlayout);
211 hlayout->addStretch(1);
216 QHBoxLayout * hlayoutPageCol =
new QHBoxLayout;
219 theclass->setLayout(hlayoutPageCol);
220 theclass->setContentsMargins(0,0,0,0);
222 hlayoutPageCol->setContentsMargins(0,0,0,0);
225 theclass->setContentsMargins(0,0,0,0);