Skip to content
Closed
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 @@ -217,7 +217,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 Down Expand Up @@ -409,19 +409,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 @@ -1544,7 +1544,6 @@ void qMRMLSegmentEditorWidget::updateEffectsSectionFromMRML()
}
activeEffect->optionsFrame()->setMinimumHeight(activeEffect->optionsFrame()->sizeHint().height());
activeEffect->optionsLayout()->activate();
this->setMinimumHeight(this->sizeHint().height());
}
else
{
Expand Down
3 changes: 3 additions & 0 deletions Modules/Scripted/SegmentEditor/SegmentEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def setup(self):
self.addObserver(slicer.mrmlScene, slicer.mrmlScene.EndCloseEvent, self.onSceneEndClose)
self.addObserver(slicer.mrmlScene, slicer.mrmlScene.EndImportEvent, self.onSceneEndImport)

if hasattr(self.layout, "addStretch"):
self.layout.addStretch()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need the hasattr check? Qt4/Qt5 difference?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because not all qt layout classes have that method and if you use the SegmentEditor in your own module as follows, setup would crash (e.g. QFormLayout and QGridLayout don't have that method):

from SegmentEditor import SegmentEditorWidget
widget = qt.QWidget()
widget.setLayout(qt.QGridLayout())
segmentEditor = SegmentEditorWidget(parent=widget)
segmentEditor.setup()
widget.show()


def selectParameterNode(self):
# Select parameter set node if one is found in the scene, and create one otherwise
segmentEditorSingletonTag = "SegmentEditor"
Expand Down