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

void GuiDisplayControlDialog::createAndUpdateMetricSelectionPage (  )  [private]

create and update metric selection page

Create and update metric selections. Because the number of metrics may change, this method may update and change the labels on existing checkboxes, add new checkboxes, and hide existing checkboxes.

Definition at line 11622 of file GuiDisplayControlDialog.cxx.

References GiftiNodeDataFile::getColumnName(), DebugControl::getDebugOn(), GiftiNodeDataFile::getNumberOfColumns(), metricColumnCommentPushButtons, metricColumnHistogramPushButtons, metricColumnMetaDataPushButtons, metricColumnNameLineEdits, metricColumnNumberLabels, metricCommentButtonGroup, metricCommentColumnSelection(), metricDisplayColumnSelection(), metricHistogramButtonGroup, metricHistogramColumnSelection(), metricMetaDataButtonGroup, metricMetaDataColumnSelection(), metricSelectionGridLayout, metricSubPageSelectionsLayout, metricThresholdButtonGroup, metricThresholdColumnSelection(), metricThresholdRadioButtons, metricViewButtonGroup, metricViewRadioButtons, numValidMetrics, and pageMetricSelection.

Referenced by createMetricSelectionPage(), and updateMetricSelectionPage().

{
   MetricFile* mf = theMainWindow->getBrainSet()->getMetricFile();
   numValidMetrics = mf->getNumberOfColumns();
   
   const int numExistingMetrics = static_cast<int>(metricViewRadioButtons.size());
   const int nameMinimumWidth = 500;
      
   if (metricSubPageSelectionsLayout == NULL) {
      //
      // Grid layout for metric selections
      //
      QWidget* metricSelectionGridWidget = new QWidget;
      metricSelectionGridLayout = new QGridLayout(metricSelectionGridWidget);
      metricSelectionGridLayout->setSpacing(3);
      metricSelectionGridLayout->setColumnMinimumWidth(6, nameMinimumWidth+20);
      metricSelectionGridLayout->addWidget(new QLabel("#"),
                                           0, 0, Qt::AlignRight);
      metricSelectionGridLayout->addWidget(new QLabel("View"),
                                           0, 1, Qt::AlignHCenter);
      metricSelectionGridLayout->addWidget(new QLabel("Thresh"),
                                           0, 2, Qt::AlignHCenter);
      metricSelectionGridLayout->addWidget(new QLabel("Cmt"),
                                           0, 3, Qt::AlignHCenter);
      metricSelectionGridLayout->addWidget(new QLabel("MD"),
                                           0, 4, Qt::AlignHCenter);
      metricSelectionGridLayout->addWidget(new QLabel("Hist"),
                                           0, 5, Qt::AlignHCenter);
      metricSelectionGridLayout->addWidget(new QLabel("Name"),
                                           0, 6, Qt::AlignLeft);
                                           
      //
      // For stretching on  bottom
      //
      //const int rowStretchNumber    = 15000;
      //metricSelectionGridLayout->addWidget(new QLabel(""),
      //                                     rowStretchNumber, 5, 1, 1, Qt::AlignLeft);
                                           
      //
      // Only allow the name column to stretch
      // 
      metricSelectionGridLayout->setColumnStretch(0, 0);
      metricSelectionGridLayout->setColumnStretch(1, 0);
      metricSelectionGridLayout->setColumnStretch(2, 0);
      metricSelectionGridLayout->setColumnStretch(3, 0);
      metricSelectionGridLayout->setColumnStretch(4, 0);
      metricSelectionGridLayout->setColumnStretch(5, 0);
      metricSelectionGridLayout->setColumnStretch(6, 0);
      //metricSelectionGridLayout->setRowStretch(rowStretchNumber, 1000);
      
      //
      // Create the metric selections layout and push selections to the left
      //
      metricSubPageSelectionsLayout = new QVBoxLayout(pageMetricSelection);
      metricSubPageSelectionsLayout->addWidget(metricSelectionGridWidget, 100, Qt::AlignLeft | Qt::AlignTop);
   }
   
   //
   // Create the button group for the metric view buttons.
   //
   if (metricViewButtonGroup == NULL) {
      metricViewButtonGroup = new QButtonGroup(this);
      metricViewButtonGroup->setExclusive(true);
      QObject::connect(metricViewButtonGroup, SIGNAL(buttonClicked(int)),
                       this, SLOT(metricDisplayColumnSelection(int)));
   }
   
   //
   // Create the button group for the metric threshold buttons.
   //
   if (metricThresholdButtonGroup == NULL) {
      metricThresholdButtonGroup = new QButtonGroup(this);
      metricThresholdButtonGroup->setExclusive(true);
      QObject::connect(metricThresholdButtonGroup, SIGNAL(buttonClicked(int)),
                       this, SLOT(metricThresholdColumnSelection(int)));
   }
   
   //
   // Create the button group for the metric comment buttons.
   //
   if (metricCommentButtonGroup == NULL) {
      metricCommentButtonGroup = new QButtonGroup(this);
      QObject::connect(metricCommentButtonGroup, SIGNAL(buttonClicked(int)),
                       this, SLOT(metricCommentColumnSelection(int)));
   }
   
   //
   // Create the button group for the metric metadata buttons.
   //
   if (metricMetaDataButtonGroup == NULL) {
      metricMetaDataButtonGroup = new QButtonGroup(this);
      QObject::connect(metricMetaDataButtonGroup, SIGNAL(buttonClicked(int)),
                       this, SLOT(metricMetaDataColumnSelection(int)));
   }
   
   //
   // Create the button group for the metric histogram buttons
   //
   if (metricHistogramButtonGroup == NULL) {
      metricHistogramButtonGroup = new QButtonGroup(this);
      QObject::connect(metricHistogramButtonGroup, SIGNAL(buttonClicked(int)),
                       this, SLOT(metricHistogramColumnSelection(int)));
   }
   
   //
   // Add new widgets as needed
   //
   for (int i = numExistingMetrics; i < numValidMetrics; i++) {
      //
      // Column number
      //
      QLabel* columnNumberLabel = new QLabel(QString::number(i + 1));
      metricColumnNumberLabels.push_back(columnNumberLabel);
      metricSelectionGridLayout->addWidget(columnNumberLabel, i + 1, 0,
                                           Qt::AlignRight);
                                           
      //
      // View radio button
      //
      QRadioButton* viewRadioButton = new QRadioButton("");
      metricViewRadioButtons.push_back(viewRadioButton);
      metricViewButtonGroup->addButton(viewRadioButton, i);
      metricSelectionGridLayout->addWidget(viewRadioButton, i + 1, 1, Qt::AlignHCenter);
      
      //
      // Threshold radio button
      //
      QRadioButton* threshRadioButton = new QRadioButton("");
      metricThresholdRadioButtons.push_back(threshRadioButton);
      metricThresholdButtonGroup->addButton(threshRadioButton, i);
      metricSelectionGridLayout->addWidget(threshRadioButton, i + 1, 2, Qt::AlignHCenter);
      
      //
      // Comment push button
      //
      QToolButton* commentPushButton = new QToolButton;
      commentPushButton->setText("?");
      //commentPushButton->setFixedWidth(40);
      //commentPushButton->setAutoDefault(false);
      metricColumnCommentPushButtons.push_back(commentPushButton);
      metricCommentButtonGroup->addButton(commentPushButton, i);
      metricSelectionGridLayout->addWidget(commentPushButton, i + 1, 3, 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);
      metricColumnMetaDataPushButtons.push_back(metaDataPushButton);
      metricMetaDataButtonGroup->addButton(metaDataPushButton, i);
      metricSelectionGridLayout->addWidget(metaDataPushButton, i + 1, 4, Qt::AlignHCenter);
      
      //
      // Histogram push button
      QToolButton* histogramPushButton = new QToolButton;
      histogramPushButton->setText("H");
      histogramPushButton->setToolTip("Press the button to view \n"
                                      "a histogram of this metric\n"
                                      "column's data.");
      metricColumnHistogramPushButtons.push_back(histogramPushButton);
      metricHistogramButtonGroup->addButton(histogramPushButton, i);
      metricSelectionGridLayout->addWidget(histogramPushButton, i + 1, 5, Qt::AlignHCenter);
      
      //
      //
      // Name line edit
      //
      QLineEdit* metricLineEdit = new QLineEdit;
      metricLineEdit->setText(mf->getColumnName(i));
      metricLineEdit->setMinimumWidth(nameMinimumWidth);
      metricColumnNameLineEdits.push_back(metricLineEdit);
      metricSelectionGridLayout->addWidget(metricLineEdit, i + 1, 6, Qt::AlignLeft);
   }
      
   //
   // Show and update all valid metrics
   //
   for (int i = 0; i < numValidMetrics; i++) {
      metricColumnNameLineEdits[i]->setText(mf->getColumnName(i));
      metricColumnNumberLabels[i]->show();
      metricViewRadioButtons[i]->show();
      metricThresholdRadioButtons[i]->show();
      metricColumnCommentPushButtons[i]->show();
      metricColumnMetaDataPushButtons[i]->show();
      metricColumnHistogramPushButtons[i]->show();
      metricColumnNameLineEdits[i]->show();
      metricColumnNameLineEdits[i]->home(true);
   }
   
   //
   // Hide widgets that are not needed
   //
   for (int i = numValidMetrics; i < numExistingMetrics; i++) {
      metricColumnNumberLabels[i]->hide();
      metricViewRadioButtons[i]->hide();
      metricThresholdRadioButtons[i]->hide();
      metricColumnCommentPushButtons[i]->hide();
      metricColumnMetaDataPushButtons[i]->hide();
      metricColumnHistogramPushButtons[i]->hide();
      metricColumnNameLineEdits[i]->hide();
   }
   
   if (numValidMetrics > 0) {
      if (DebugControl::getDebugOn()) {
         std::cout << " " << std::endl;
         std::cout << "Metric created " << std::endl;
         std::cout << " " << std::endl;
      }
   }
}


Generated by  Doxygen 1.6.0   Back to index