Skip to content
Permalink
Browse files

ENH: add check box to show/hide coordinate columns

When box is checked, hide the markup coordiante columns in the
table, when unchecked show them.

Issue #3667

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23112 3bd1e089-480b-0410-8dfb-8563597acbee
  • Loading branch information...
naucoin committed Apr 23, 2014
1 parent edb69cd commit b0d6897dabdb5eca73ee408518d5d1096077e7e5
@@ -349,6 +349,19 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="hideCoordinateColumnsCheckBox">
<property name="toolTip">
<string>Check to hide the coordinate columns in the table, uncheck to show them. Right click in rows to see coordinates.</string>
</property>
<property name="text">
<string>Hide XYZ</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -386,6 +386,11 @@ void qSlicerMarkupsModuleWidgetPrivate::setupUi(qSlicerWidget* widget)
this->activeMarkupTableWidget->setColumnWidth(this->columnIndex("Y"), 65);
this->activeMarkupTableWidget->setColumnWidth(this->columnIndex("Z"), 65);

// show/hide the coordinate columns
QObject::connect(this->hideCoordinateColumnsCheckBox,
SIGNAL(toggled(bool)),
q, SLOT(onHideCoordinateColumnsToggled(bool)));

// use an icon for some column headers
// selected is a check box
QTableWidgetItem *selectedHeader = this->activeMarkupTableWidget->horizontalHeaderItem(this->columnIndex("Selected"));
@@ -427,6 +432,7 @@ int qSlicerMarkupsModuleWidgetPrivate::numberOfColumns()
{
return this->columnLabels.size();
}

//-----------------------------------------------------------------------------
// qSlicerMarkupsModuleWidget methods

@@ -3007,3 +3013,26 @@ bool qSlicerMarkupsModuleWidget::sliceIntersectionsVisible()
return true;
}
}

//-----------------------------------------------------------------------------
void qSlicerMarkupsModuleWidget::onHideCoordinateColumnsToggled(bool checked)
{
Q_D(qSlicerMarkupsModuleWidget);

d->activeMarkupTableWidget->setColumnHidden(d->columnIndex("X"), checked);
d->activeMarkupTableWidget->setColumnHidden(d->columnIndex("Y"), checked);
d->activeMarkupTableWidget->setColumnHidden(d->columnIndex("Z"), checked);

if (!checked)
{
// back to default column widths
d->activeMarkupTableWidget->setColumnWidth(d->columnIndex("Name"), 60);
d->activeMarkupTableWidget->setColumnWidth(d->columnIndex("Description"), 120);
}
else
{
// expand the name and description columns
d->activeMarkupTableWidget->setColumnWidth(d->columnIndex("Name"), 120);
d->activeMarkupTableWidget->setColumnWidth(d->columnIndex("Description"), 240);
}
}
@@ -229,6 +229,9 @@ public slots:
/// \sa sliceIntersectionsVisible()
void onSliceIntersectionsVisibilityToggled(bool checked);

// update visibility of the coordinate columns in the table
void onHideCoordinateColumnsToggled(bool checked);

protected:
QScopedPointer<qSlicerMarkupsModuleWidgetPrivate> d_ptr;

0 comments on commit b0d6897

Please sign in to comment.
You can’t perform that action at this time.