20 #include <QSpacerItem> 
   21 #include <QGridLayout> 
   42   void clearGui(
bool deleteGuiElements);
 
   69   if (!deleteGuiElements) {
 
   87   if (deleteCollections) {
 
  103   theclass->setUpdatesEnabled(
false);
 
  107   collWidget = 
new QWidget();
 
  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());
 
  125   theclass->sortSections(sectionsSorted);
 
  127   const bool nosectionlabels = sectionsSorted.count() == 1 && sectionsSorted.at(0).isEmpty();
 
  129   int maxFirstColumnCheckBoxWidth(0);
 
  130   QList<QCheckBox*> firstColumnCheckBoxes;
 
  133   for  (
const 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();
 
  186     widgetsFromCollections << 
w;
 
  187     w->setParent(collWidget);
 
  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);
 
  212   collWidget->setLayout(hlayout);
 
  215   delete theclass->layout();
 
  216   QHBoxLayout * hlayoutPageCol = 
new QHBoxLayout;
 
  217   collWidget->setParent(theclass);
 
  218   hlayoutPageCol->addWidget(collWidget);
 
  219   theclass->setLayout(hlayoutPageCol);
 
  220   theclass->setContentsMargins(0,0,0,0);
 
  221   collWidget->setContentsMargins(0,0,0,0);
 
  222   hlayoutPageCol->setContentsMargins(0,0,0,0);
 
  225   theclass->setContentsMargins(0,0,0,0);
 
  226   collWidget->setContentsMargins(0,0,0,0);
 
  230   theclass->setUpdatesEnabled(
true);
 
  231   theclass->visibleContentsChanged();
 
  245   if (applySavedStates)
 
  264   if (applySavedStates)
 
  292   QMapIterator<QByteArray,QByteArray> 
it(newinfo);
 
  293   while (
it.hasNext()) {
 
  295     if (!overwritesExisting&&
m_d->
states.contains(
it.key()))
 
  299   if (overwritesExisting)
 
  316     vt.insert(stdcol->collTypeID());
 
  317   QList<qint32> vistypes = 
vt.values();
 
  318   std::sort(vistypes.begin(), vistypes.end());
 
  332   QList<VP1StdCollection*> 
l;
 
  334     if (stdcol->visible())
 
  363   QRegExp rx(
wildcard,Qt::CaseInsensitive,QRegExp::Wildcard);
 
  365   for (
const QString& 
str : strs)
 
  366     if (rx.exactMatch(
str))
 
  368   for (
const QString& 
str : 
l)
 
  370   for (
const QString& 
str : strs)
 
  379   QRegExp rx(
wildcard,Qt::CaseInsensitive,QRegExp::Wildcard);
 
  381   for(
const QString& 
str : strs)
 
  382     if (rx.exactMatch(
str))
 
  384   for (
const QString& 
str : 
l)