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

void GuiDisplayControlDialog::updateRgbPaintSelectionPage (  ) 

update rgb paint selection page

update rgb paint selection page.

Definition at line 8624 of file GuiDisplayControlDialog.cxx.

References WuQWidgetGroup::addWidget(), NodeAttributeFile::getColumnName(), NodeAttributeFile::getNumberOfColumns(), DisplaySettingsNodeAttributeFile::getSelectedDisplayColumn(), overlayNumberComboBox, pageRgbPaintSelection, readRgbPaintPageSelection(), rgbSelectionBlueCommentButtonGroup, rgbSelectionBlueHistogramButtonGroup, rgbSelectionGreenCommentButtonGroup, rgbSelectionGreenHistogramButtonGroup, rgbSelectionNameLineEdits, rgbSelectionPageGridLayout, rgbSelectionRadioButtons, rgbSelectionRadioButtonsButtonGroup, rgbSelectionRedCommentButtonGroup, rgbSelectionRedHistogramButtonGroup, rgbSelectionRowWidgetGroup, surfaceModelIndex, and validRgbPaintData.

Referenced by showDisplayControlPage(), slotOverlayNumberComboBox(), and updateRgbPaintItems().

{
   if (pageRgbPaintSelection == NULL) {
      return;
   }
   
   const DisplaySettingsRgbPaint* dsrgb = theMainWindow->getBrainSet()->getDisplaySettingsRgbPaint();
   const RgbPaintFile* rpf = theMainWindow->getBrainSet()->getRgbPaintFile();
   const int numRowsInDialog = static_cast<int>(rgbSelectionRadioButtons.size());
   const int numCols = rpf->getNumberOfColumns();

   //
   // Create new items as needed
   //   
   for (int i = numRowsInDialog; i < numCols; i++) {
      QRadioButton* rb = new QRadioButton(" ");
      rgbSelectionRadioButtonsButtonGroup->addButton(rb, i);
      rgbSelectionRadioButtons.push_back(rb);

      QToolButton* redCommentButton = new QToolButton;
      redCommentButton->setText("?");
      redCommentButton->setToolTip("Show comment for this color.");
      rgbSelectionRedCommentButtonGroup->addButton(redCommentButton, i);

      QToolButton* redHistogramButton = new QToolButton;
      redHistogramButton->setToolTip("Show histogram for this color.");
      redHistogramButton->setText("H");
      rgbSelectionRedHistogramButtonGroup->addButton(redHistogramButton, i);

      QToolButton* greenCommentButton = new QToolButton;
      greenCommentButton->setToolTip("Show comment for this color.");
      greenCommentButton->setText("?");
      rgbSelectionGreenCommentButtonGroup->addButton(greenCommentButton, i);

      QToolButton* greenHistogramButton = new QToolButton;
      greenHistogramButton->setToolTip("Show histogram for this color.");
      greenHistogramButton->setText("H");
      rgbSelectionGreenHistogramButtonGroup->addButton(greenHistogramButton, i);

      QToolButton* blueCommentButton = new QToolButton;
      blueCommentButton->setToolTip("Show comment for this color.");
      blueCommentButton->setText("?");
      rgbSelectionBlueCommentButtonGroup->addButton(blueCommentButton, i);

      QToolButton* blueHistogramButton = new QToolButton;
      blueHistogramButton->setToolTip("Show histogram for this color.");
      blueHistogramButton->setText("H");
      rgbSelectionBlueHistogramButtonGroup->addButton(blueHistogramButton, i);

      QLineEdit* nameLineEdit = new QLineEdit;
      nameLineEdit->setMinimumWidth(350);
      QObject::connect(nameLineEdit, SIGNAL(returnPressed()),
                       this, SLOT(readRgbPaintPageSelection()));
      rgbSelectionNameLineEdits.push_back(nameLineEdit);
      
      QLabel* colLabel = new QLabel(QString::number(i + 1));
      rgbSelectionPageGridLayout->addWidget(colLabel, i + 1, 0, Qt::AlignHCenter);
      rgbSelectionPageGridLayout->addWidget(rb, i + 1, 1, Qt::AlignHCenter);
      rgbSelectionPageGridLayout->addWidget(redCommentButton, i + 1, 2, Qt::AlignHCenter);
      rgbSelectionPageGridLayout->addWidget(redHistogramButton, i + 1, 3, Qt::AlignHCenter);
      rgbSelectionPageGridLayout->addWidget(greenCommentButton, i + 1, 4, Qt::AlignHCenter);
      rgbSelectionPageGridLayout->addWidget(greenHistogramButton, i + 1, 5, Qt::AlignHCenter);
      rgbSelectionPageGridLayout->addWidget(blueCommentButton, i + 1, 6, Qt::AlignHCenter);
      rgbSelectionPageGridLayout->addWidget(blueHistogramButton, i + 1, 7, Qt::AlignHCenter);
      rgbSelectionPageGridLayout->addWidget(nameLineEdit, i + 1, 8, Qt::AlignLeft);

      WuQWidgetGroup* wg = new WuQWidgetGroup(this);
      wg->addWidget(colLabel);
      wg->addWidget(rb);
      wg->addWidget(redCommentButton);
      wg->addWidget(greenCommentButton);
      wg->addWidget(blueCommentButton);
      wg->addWidget(redHistogramButton);
      wg->addWidget(greenHistogramButton);
      wg->addWidget(blueHistogramButton);
      wg->addWidget(nameLineEdit);
      rgbSelectionRowWidgetGroup.push_back(wg);
      
   }
   
   //
   // Update all items
   //
   for (int i = 0; i < numCols; i++) {
      rgbSelectionNameLineEdits[i]->setText(rpf->getColumnName(i));
      rgbSelectionRowWidgetGroup[i]->setHidden(false);
   }
   
   //
   // Hide unneeded items
   //
   for (int i = numCols; i < numRowsInDialog; i++) {
      rgbSelectionRowWidgetGroup[i]->setHidden(true);
   }
   
   //
   // Update selection check box
   //
   rgbSelectionRadioButtonsButtonGroup->blockSignals(true);
   const int num = dsrgb->getSelectedDisplayColumn(surfaceModelIndex,
                                       overlayNumberComboBox->currentIndex());
   if ((num >= 0) && (num < rpf->getNumberOfColumns())) {
      rgbSelectionRadioButtons[num]->setChecked(true);
   }
   rgbSelectionRadioButtonsButtonGroup->blockSignals(false);
   
   pageRgbPaintSelection->setEnabled(validRgbPaintData);
}


Generated by  Doxygen 1.6.0   Back to index