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

void GuiDisplayControlDialog::createAndUpdateSurfaceShapeSelections (  )  [private, slot]

create and update the surface shape selections

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

Definition at line 9947 of file GuiDisplayControlDialog.cxx.

References GiftiNodeDataFile::getColumnName(), GiftiNodeDataFile::getNumberOfColumns(), numValidSurfaceShape, pageSurfaceShapeSelections, shapeColumnSelection(), surfaceShapeColumnCommentPushButtons, surfaceShapeColumnHistogramPushButtons, surfaceShapeColumnMetaDataPushButtons, surfaceShapeColumnNameLineEdits, surfaceShapeColumnNumberLabels, surfaceShapeCommentButtonGroup, surfaceShapeCommentColumnSelection(), surfaceShapeHistogramButtonGroup, surfaceShapeHistogramColumnSelection(), surfaceShapeMetaDataButtonGroup, surfaceShapeMetaDataColumnSelection(), surfaceShapeSelectionGridLayout, surfaceShapeSubSelectionsLayout, and surfaceShapeViewButtonGroup.

Referenced by createShapeSelectionPage(), and updateShapeSelections().

{
   SurfaceShapeFile* ssf = theMainWindow->getBrainSet()->getSurfaceShapeFile();
   numValidSurfaceShape = ssf->getNumberOfColumns();
   
   const int numExistingSurfaceShape = static_cast<int>(surfaceShapeViewRadioButtons.size());
   const int nameMinimumWidth = 500;
     
   if (surfaceShapeSubSelectionsLayout == NULL) {
      //
      // Grid layout for surfaceShape selections
      //
      QWidget* shapeSelectionsGridWidget = new QWidget;
      surfaceShapeSelectionGridLayout = new QGridLayout(shapeSelectionsGridWidget);
      //surfaceShapeSelectionGridLayout->setMargin(3);
      surfaceShapeSelectionGridLayout->setSpacing(3);
      surfaceShapeSelectionGridLayout->setColumnMinimumWidth(5, nameMinimumWidth+20);
      surfaceShapeSelectionGridLayout->addWidget(new QLabel("#"),
                                           0, 0, Qt::AlignRight);
      surfaceShapeSelectionGridLayout->addWidget(new QLabel("View"),
                                           0, 1, Qt::AlignHCenter);
      surfaceShapeSelectionGridLayout->addWidget(new QLabel("Cmt"),
                                           0, 2, Qt::AlignHCenter);
      surfaceShapeSelectionGridLayout->addWidget(new QLabel("MD"),
                                           0, 3, Qt::AlignHCenter);
      surfaceShapeSelectionGridLayout->addWidget(new QLabel("Hist"),
                                           0, 4, Qt::AlignHCenter);
      surfaceShapeSelectionGridLayout->addWidget(new QLabel("Name"),
                                           0, 5, Qt::AlignLeft);
      
      //
      // For stretching on  bottom
      //
      //const int rowStretchNumber    = 15000;
      //surfaceShapeSelectionGridLayout->addWidget(new QLabel(""),
      //                                     rowStretchNumber, 4, 1, 1, Qt::AlignLeft);
                                           
      surfaceShapeSelectionGridLayout->setColumnStretch(0, 0);
      surfaceShapeSelectionGridLayout->setColumnStretch(1, 0);
      surfaceShapeSelectionGridLayout->setColumnStretch(2, 0);
      surfaceShapeSelectionGridLayout->setColumnStretch(3, 0);
      surfaceShapeSelectionGridLayout->setColumnStretch(4, 0);
      surfaceShapeSelectionGridLayout->setColumnStretch(5, 0);
      //surfaceShapeSelectionGridLayout->setRowStretch(rowStretchNumber, 1000);

      //
      // Create the shape selections layout and push selections to the left
      //
      surfaceShapeSubSelectionsLayout = new QVBoxLayout(pageSurfaceShapeSelections);
      surfaceShapeSubSelectionsLayout->addWidget(shapeSelectionsGridWidget, 100, Qt::AlignLeft | Qt::AlignTop);
   }
   
   //
   // Create the button group for the surfaceShape view buttons.
   //
   if (surfaceShapeViewButtonGroup == NULL) {
      surfaceShapeViewButtonGroup = new QButtonGroup(this);
      surfaceShapeViewButtonGroup->setExclusive(true);
      QObject::connect(surfaceShapeViewButtonGroup, SIGNAL(buttonClicked(int)),
                       this, SLOT(shapeColumnSelection(int)));
   }
   
   //
   // Create the button group for the surfaceShape buttons.
   //
   if (surfaceShapeCommentButtonGroup == NULL) {
      surfaceShapeCommentButtonGroup = new QButtonGroup(this);
      QObject::connect(surfaceShapeCommentButtonGroup, SIGNAL(buttonClicked(int)),
                       this, SLOT(surfaceShapeCommentColumnSelection(int)));
   }
   
   //
   // Create the button group for the surface shape metadata buttons
   //
   if (surfaceShapeMetaDataButtonGroup == NULL) {
      surfaceShapeMetaDataButtonGroup = new QButtonGroup(this);
      QObject::connect(surfaceShapeMetaDataButtonGroup, SIGNAL(buttonClicked(int)),
                       this, SLOT(surfaceShapeMetaDataColumnSelection(int)));
   }
   
   //
   // Create the button group for the surface shape histogram buttons
   //
   if (surfaceShapeHistogramButtonGroup == NULL) {
      surfaceShapeHistogramButtonGroup = new QButtonGroup(this);
      QObject::connect(surfaceShapeHistogramButtonGroup, SIGNAL(buttonClicked(int)),
                       this, SLOT(surfaceShapeHistogramColumnSelection(int)));
   }
   
   //
   // Add new widgets as needed
   //
   for (int i = numExistingSurfaceShape; i < numValidSurfaceShape; i++) {
      //
      // Column number
      //
      QLabel* columnNumberLabel = new QLabel(QString::number(i + 1));
      surfaceShapeColumnNumberLabels.push_back(columnNumberLabel);
      surfaceShapeSelectionGridLayout->addWidget(columnNumberLabel, i + 1, 0,
                                           Qt::AlignRight);
                                           
      //
      // View radio button
      //
      QRadioButton* viewRadioButton = new QRadioButton("");
      surfaceShapeViewRadioButtons.push_back(viewRadioButton);
      surfaceShapeViewButtonGroup->addButton(viewRadioButton, i);
      surfaceShapeSelectionGridLayout->addWidget(viewRadioButton, i + 1, 1, Qt::AlignHCenter);
      
      //
      // Comment push button
      //
      QToolButton* commentPushButton = new QToolButton;
      commentPushButton->setText("?");
      //commentPushButton->setFixedWidth(40);
      //commentPushButton->setAutoDefault(false);
      surfaceShapeColumnCommentPushButtons.push_back(commentPushButton);
      surfaceShapeCommentButtonGroup->addButton(commentPushButton, i);
      surfaceShapeSelectionGridLayout->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);
      surfaceShapeColumnMetaDataPushButtons.push_back(metaDataPushButton);
      surfaceShapeMetaDataButtonGroup->addButton(metaDataPushButton, i);
      surfaceShapeSelectionGridLayout->addWidget(metaDataPushButton, i + 1, 3, Qt::AlignHCenter);
      
      //
      // Histogram push button
      //
      QToolButton* histogramPushButton = new QToolButton;
      histogramPushButton->setText("H");
      histogramPushButton->setToolTip("Press this button to display\n"
                                      "a histogram for this column.");
      surfaceShapeColumnHistogramPushButtons.push_back(histogramPushButton);
      surfaceShapeHistogramButtonGroup->addButton(histogramPushButton, i);
      surfaceShapeSelectionGridLayout->addWidget(histogramPushButton, i + 1, 4, Qt::AlignHCenter);
      
      //
      // Name line edit
      //
      QLineEdit* surfaceShapeLineEdit = new QLineEdit;
      surfaceShapeLineEdit->setText(ssf->getColumnName(i));
      surfaceShapeLineEdit->setMinimumWidth(nameMinimumWidth);
      surfaceShapeColumnNameLineEdits.push_back(surfaceShapeLineEdit);
      surfaceShapeSelectionGridLayout->addWidget(surfaceShapeLineEdit, i + 1, 5, Qt::AlignLeft);
   }
      
   //
   // Show and update all valid surfaceShapes
   //
   for (int i = 0; i < numValidSurfaceShape; i++) {
      surfaceShapeColumnNameLineEdits[i]->blockSignals(true);
      surfaceShapeColumnNameLineEdits[i]->setText(ssf->getColumnName(i));
      surfaceShapeColumnNameLineEdits[i]->blockSignals(false);
      if (i < numExistingSurfaceShape) {
         if (surfaceShapeColumnNumberLabels[i]->isVisible() == false) {
            surfaceShapeColumnNumberLabels[i]->show();
            surfaceShapeViewRadioButtons[i]->show();
            surfaceShapeColumnCommentPushButtons[i]->show();
            surfaceShapeColumnMetaDataPushButtons[i]->show();
            surfaceShapeColumnHistogramPushButtons[i]->show();
            surfaceShapeColumnNameLineEdits[i]->show();
            surfaceShapeColumnNameLineEdits[i]->home(true);
         }
      }
   }
   
   //
   // Hide widgets that are not needed
   //
   for (int i = numValidSurfaceShape; i < numExistingSurfaceShape; i++) {
      surfaceShapeColumnNumberLabels[i]->hide();
      surfaceShapeViewRadioButtons[i]->hide();
      surfaceShapeColumnCommentPushButtons[i]->hide();
      surfaceShapeColumnMetaDataPushButtons[i]->hide();
      surfaceShapeColumnHistogramPushButtons[i]->hide();
      surfaceShapeColumnNameLineEdits[i]->hide();
   }
}


Generated by  Doxygen 1.6.0   Back to index