Logo Search packages:      
Sourcecode: caret version File versions  Download package

void GuiDisplayControlDialog::createAndUpdatePaintColumnPage (  )  [private]

create and update the paint columns

Create and update the paint page.

Definition at line 10778 of file GuiDisplayControlDialog.cxx.

References WuQWidgetGroup::addWidget(), GiftiNodeDataFile::getColumnName(), GiftiNodeDataFile::getNumberOfColumns(), numValidPaints, pagePaintColumnWidgetGroup, paintColumnButtonGroup, paintColumnCommentButtonGroup, paintColumnCommentPushButtons, paintColumnMetaDataButtonGroup, paintColumnMetaDataPushButtons, paintColumnNameLabels, paintColumnNameLineEdits, paintColumnRadioButtons, paintColumnSelectionGridLayout, paintPageLayout, and readPaintColumnSelections().

Referenced by updatePaintColumnPage().

{
   PaintFile* pf = theMainWindow->getBrainSet()->getPaintFile();
   numValidPaints = pf->getNumberOfColumns();
   
   const int numExistingPaints = static_cast<int>(paintColumnRadioButtons.size());
   
   const int nameMinimumWidth = 500;

   if (paintColumnSelectionGridLayout == NULL) {
      
      QWidget* paintSelectionWidget = new QWidget;
      paintColumnSelectionGridLayout = new QGridLayout(paintSelectionWidget);
      //paintSelectionGridLayout->setMargin(3);
      paintColumnSelectionGridLayout->setSpacing(3);
      paintColumnSelectionGridLayout->setColumnMinimumWidth(4, nameMinimumWidth+20);
      
      paintColumnSelectionGridLayout->addWidget(new QLabel("#"),
                                           0, 0, Qt::AlignRight);
      paintColumnSelectionGridLayout->addWidget(new QLabel("View"),
                                           0, 1, Qt::AlignHCenter);
      paintColumnSelectionGridLayout->addWidget(new QLabel("Cmt"),
                                           0, 2, Qt::AlignHCenter);
      paintColumnSelectionGridLayout->addWidget(new QLabel("MD"),
                                           0, 3, Qt::AlignHCenter);
      paintColumnSelectionGridLayout->addWidget(new QLabel("Name"),
                                           0, 4, Qt::AlignLeft);
                                           
      //
      // For stretching on  bottom
      //
     // const int rowStretchNumber    = 15000;
     // paintSelectionGridLayout->addWidget(new QLabel(""),
     //                                      rowStretchNumber, 4, 1, 1, Qt::AlignLeft);
      paintColumnSelectionGridLayout->setColumnStretch(0, 0);
      paintColumnSelectionGridLayout->setColumnStretch(1, 0);
      paintColumnSelectionGridLayout->setColumnStretch(2, 0);
      paintColumnSelectionGridLayout->setColumnStretch(3, 0);
      paintColumnSelectionGridLayout->setColumnStretch(4, 0);
     // paintSelectionGridLayout->setRowStretch(rowStretchNumber, 1000);
      
      paintPageLayout->addWidget(paintSelectionWidget, 100, Qt::AlignLeft | Qt::AlignTop);
   }
   
   //
   // Add radio buttons and text boxes
   //
   for (int i = numExistingPaints; i < numValidPaints; i++) {
      QLabel* colLabel = new QLabel(QString::number(i + 1));
      paintColumnNameLabels.push_back(colLabel);
      paintColumnSelectionGridLayout->addWidget(colLabel, i + 1, 0, Qt::AlignLeft);
      
      QRadioButton* rb = new QRadioButton("");
      paintColumnRadioButtons.push_back(rb);
      paintColumnButtonGroup->addButton(rb, i);
      paintColumnSelectionGridLayout->addWidget(rb, i + 1, 1, Qt::AlignLeft);
      
      //
      // Comment push button
      //
      QToolButton* commentPushButton = new QToolButton;
      commentPushButton->setText("?");
      //commentPushButton->setFixedWidth(40);
      //commentPushButton->setAutoDefault(false);
      paintColumnCommentPushButtons.push_back(commentPushButton);
      paintColumnCommentButtonGroup->addButton(commentPushButton, i);
      paintColumnSelectionGridLayout->addWidget(commentPushButton, i + 1, 2, Qt::AlignHCenter);
      
      //
      // metadata push button
      //
      QToolButton* metaDataPushButton = new QToolButton;
      metaDataPushButton->setText("M");
      metaDataPushButton->setToolTip("Press the button to set the\n"
                                     "metadata link for this column");
      //metaDataPushButton->setFixedWidth(40);
      //metaDataPushButton->setAutoDefault(false);
      paintColumnMetaDataPushButtons.push_back(metaDataPushButton);
      paintColumnMetaDataButtonGroup->addButton(metaDataPushButton, i);
      paintColumnSelectionGridLayout->addWidget(metaDataPushButton, i + 1, 3, Qt::AlignHCenter);
      
      //
      // Name line edit
      //
      QLineEdit* le = new QLineEdit;
      le->setMinimumWidth(nameMinimumWidth);
      paintColumnNameLineEdits.push_back(le);
      QObject::connect(le, SIGNAL(returnPressed()),
                       this, SLOT(readPaintColumnSelections()));
      paintColumnSelectionGridLayout->addWidget(le, i + 1, 4, Qt::AlignLeft);
      
      pagePaintColumnWidgetGroup->addWidget(rb);
      pagePaintColumnWidgetGroup->addWidget(le);
   }
   
   //
   // Update items already in the dialog
   //
   for (int i = 0; i < numValidPaints; i++) {
      paintColumnNameLabels[i]->show();
      paintColumnRadioButtons[i]->show();
      paintColumnCommentPushButtons[i]->show();
      paintColumnMetaDataPushButtons[i]->show();
      paintColumnNameLineEdits[i]->setText(pf->getColumnName(i));
      paintColumnNameLineEdits[i]->home(true);
      paintColumnNameLineEdits[i]->show();
   }
   
   //
   // Hide paints that are not needed
   //
   for (int i = numValidPaints; i < numExistingPaints; i++) {
      paintColumnNameLabels[i]->hide();
      paintColumnRadioButtons[i]->hide();
      paintColumnMetaDataPushButtons[i]->hide();
      paintColumnCommentPushButtons[i]->hide();
      paintColumnNameLineEdits[i]->hide();
   }
}


Generated by  Doxygen 1.6.0   Back to index