Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Friendlier segment editor widget for better intergration in layouts #1085

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
<height>100</height>
</size>
</property>
<property name="maximumSize">
Expand Down Expand Up @@ -258,7 +258,7 @@
<item>
<widget class="QGroupBox" name="EffectsGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand All @@ -274,7 +274,7 @@
<item>
<widget class="QGroupBox" name="OptionsGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand Down Expand Up @@ -377,7 +377,7 @@
<item>
<widget class="ctkCollapsibleGroupBox" name="MaskingGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand Down Expand Up @@ -468,19 +468,6 @@
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
<item row="1" column="0">
<widget class="QTableWidget" name="SegmentsTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="MinimumExpanding">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1633,14 +1633,11 @@ void qMRMLSegmentEditorWidget::updateEffectsSectionFromMRML()
d->MaskingGroupBox->show();

// Perform updates to prevent layout collapse
d->EffectHelpBrowser->setMinimumHeight(d->EffectHelpBrowser->sizeHint().height());
if (d->EffectHelpBrowser->layout())
{
d->EffectHelpBrowser->layout()->update();
}
activeEffect->optionsFrame()->setMinimumHeight(activeEffect->optionsFrame()->sizeHint().height());
activeEffect->optionsLayout()->activate();
this->setMinimumHeight(this->sizeHint().height());
}
else
{
Expand Down Expand Up @@ -3269,21 +3266,16 @@ void qMRMLSegmentEditorWidget::updateEffectLayouts()

if (d->ActiveEffect)
{
d->EffectHelpBrowser->setMinimumHeight(d->EffectHelpBrowser->sizeHint().height());
if (d->EffectHelpBrowser->layout())
{
d->EffectHelpBrowser->layout()->update();
}
d->ActiveEffect->optionsFrame()->setMinimumHeight(d->ActiveEffect->optionsFrame()->sizeHint().height());
d->ActiveEffect->optionsLayout()->activate();
}
else
{
d->OptionsGroupBox->setMinimumHeight(d->OptionsGroupBox->sizeHint().height());
d->OptionsGroupBox->layout()->activate();
}

this->setMinimumHeight(this->sizeHint().height());
}

//-----------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions Modules/Scripted/SegmentEditor/SegmentEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def setup(self):
self.selectParameterNode()
self.editor.setMRMLScene(slicer.mrmlScene)
self.layout.addWidget(self.editor)
self.layout.addStretch()

# Observe editor effect registrations to make sure that any effects that are registered
# later will show up in the segment editor widget. For example, if Segment Editor is set
Expand Down