Cannot decrease the width of my module

I created a default extension with a module (it contains an input selector)

After I reload it, when I select a volume, I can only reduce the width of the module so that the full name of the volume is still visible.

Is it possible to reduce the size further?

Ideally, I would want a solution where when I decrease the width further, only some of the first and last letters of the name would be displayed with ellipses in the middle - like e.g. in the Volumes module

I don’t have a clear answer for you. Just looked at the properties of the qMRMLNodeComboBox and there is no obvious property for this

Are you using the same combobox type? If you look at the combobox in the Volumes module, is it set up differently in any way than yours?

I’m using the same combobox. It seems to be setup pretty similarly. also when I make the exact same setup it still doesn’t fix the issue.

this is from the volumes UI

     <item>
      <widget class="qMRMLNodeComboBox" name="ActiveVolumeNodeSelector">
       <property name="nodeTypes">
        <stringlist notr="true">
         <string>vtkMRMLVolumeNode</string>
        </stringlist>
       </property>
       <property name="addEnabled">
        <bool>false</bool>
       </property>
       <property name="renameEnabled">
        <bool>true</bool>
       </property>
      </widget>
     </item>

and this is from the UI of a default module

    <item row="0" column="1">
    <widget class="qMRMLNodeComboBox" name="inputSelector">
    <property name="toolTip">
        <string>Pick the input to the algorithm.</string>
    </property>
    <property name="nodeTypes">
        <stringlist notr="true">
        <string>vtkMRMLScalarVolumeNode</string>
        </stringlist>
    </property>
    <property name="showChildNodeTypes">
        <bool>false</bool>
    </property>
    <property name="addEnabled">
        <bool>false</bool>
    </property>
    <property name="removeEnabled">
        <bool>false</bool>
    </property>
    <property name="SlicerParameterName" stdset="0">
        <string>inputVolume</string>
    </property>
    </widget>
    </item>

weridly, the first time I open the new module my desired behaviour works (the name of the volume shorteneing and expanding with the width of the volume), but after I click on Reload it assumes the expanded width and it cannot be reduced

So this problem only occurs after using the Reload function?

In that case I wouldn’t even spend any time with this, because the users for whom you make the module will not use Reload at all.

it occurs in two cases:

  1. when I reload
  2. I have a button that will be used to change the appearance of the UI . it executes the following code - after this code is executed the problem occurs
    slicer.app.setStyleSheet("""
                QWidget {
                    background-color: #060f21;
                    color: white;
                }
                QMainWindow {
                    background-color: #060f21;
                }
                qSlicerLayoutManager {
                    background-color: #060f21;
                }
                """)

I would not expect that setting a style sheet causes changes like this, so this is a bug. Unfortunately the layout logic in Qt is extremely complicated, so I see a very low chance of this being resolved unless you find a solution. However, if someone has an idea please chime in.

In the meantime I’d set the style sheet before first entering the module, which I imagine would solve the problem.

1 Like