102{
106
108
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);
118 }
119
120 QSet<QString> sections;
122 sections.insert(col->section());
123 QList<QString> sectionsSorted = sections.values();
124 std::sort(sectionsSorted.begin(), sectionsSorted.end());
125 theclass->sortSections(sectionsSorted);
126
127 const bool nosectionlabels = sectionsSorted.count() == 1 && sectionsSorted.at(0).isEmpty();
128
129 int maxFirstColumnCheckBoxWidth(0);
130 QList<QCheckBox*> firstColumnCheckBoxes;
131
132 int gridmargins(0);
133 for (
const QString&
section : sectionsSorted) {
134
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);
145 }
146
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);
156 continue;
157 if (sectionlabel) {
158 if (!col->sectionToolTip().isEmpty())
159 sectionlabel->setToolTip(col->sectionToolTip());
160 sectionlabel = 0;
161 }
162 int newrow = gridLayout->rowCount();
164 for (QWidget*w : col->widgetsForGuiRow()) {
165 if (!w) {
166 theclass->message(
"WARNING: Ignoring null widget provided by widgetsForGuiRow() (perhaps due to a VP1StdCollection you didn't init()?)");
167 continue;
168 }
169
171
173 int maxheight = static_cast<int>(0.5+QFontMetricsF(f).height()*1.05+2);
174 w->setMaximumHeight(maxheight);
175 VP1MaterialButton *
mb =
dynamic_cast<VP1MaterialButton *
>(
w);
176 if (mb)
177 mb->setDimension(maxheight);
178 if (i==1) {
179 QCheckBox * cb =
dynamic_cast<QCheckBox *
>(
w);
180 if (cb) {
181 firstColumnCheckBoxes << cb;
182 if (maxFirstColumnCheckBoxWidth<cb->sizeHint().
width())
183 maxFirstColumnCheckBoxWidth = cb->sizeHint().width();
184 }
185 }
189 gridLayout->addWidget( w, newrow, i++);
190 }
191 gridLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding),newrow,i);
192 }
193 if (gridmargins==0) {
194 int left,
top, right, bottom;
195 gridLayout->getContentsMargins ( &left, &
top, &right, &bottom );
196 gridmargins = left+right;
197 }
198 }
199
200 if (maxFirstColumnCheckBoxWidth>0) {
201 for (QCheckBox *cb : firstColumnCheckBoxes)
202 cb->setMinimumWidth(maxFirstColumnCheckBoxWidth);
203 }
204
205 vlayout->addStretch(1);
206
207 QHBoxLayout * hlayout = new QHBoxLayout;
208 hlayout->setMargin(0);
209 hlayout->setSpacing(0);
210 hlayout->addLayout(vlayout);
211 hlayout->addStretch(1);
213
214
216 QHBoxLayout * hlayoutPageCol = new QHBoxLayout;
219 theclass->setLayout(hlayoutPageCol);
220 theclass->setContentsMargins(0,0,0,0);
222 hlayoutPageCol->setContentsMargins(0,0,0,0);
223
224
225 theclass->setContentsMargins(0,0,0,0);
228 +gridmargins;
229
232
233}
const double mb
1mb to cm2
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.