# Cannot decrease the width of my module

**URL:** <https://discourse.slicer.org/t/cannot-decrease-the-width-of-my-module/40649>\
**Category:** Development\
**Created:** [December 12, 2024, 12:46pm UTC](https://discourse.slicer.org/t/cannot-decrease-the-width-of-my-module/40649 "2024-12-12T12:46:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![koeglfryderyk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/koeglfryderyk/32/14638_2.png) [@koeglfryderyk](https://discourse.slicer.org/u/koeglfryderyk)\
**Post date:** [December 12, 2024, 12:46pm UTC](https://discourse.slicer.org/t/cannot-decrease-the-width-of-my-module/40649/1 "2024-12-12T12:46:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [December 12, 2024, 3:38pm UTC](https://discourse.slicer.org/t/cannot-decrease-the-width-of-my-module/40649/2 "2024-12-12T15:38:30Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/f/bf19eeebae735f2a0ca49c60bf530632a7d77462.png)

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?

---

<div class="post-metadata">

**Author:** ![koeglfryderyk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/koeglfryderyk/32/14638_2.png) [@koeglfryderyk](https://discourse.slicer.org/u/koeglfryderyk)\
**Post date:** [December 16, 2024, 10:06am UTC](https://discourse.slicer.org/t/cannot-decrease-the-width-of-my-module/40649/3 "2024-12-16T10:06:01Z")

</div>

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

```auto
     <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

```auto
    <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

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [December 16, 2024, 12:31pm UTC](https://discourse.slicer.org/t/cannot-decrease-the-width-of-my-module/40649/4 "2024-12-16T12:31:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![koeglfryderyk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/koeglfryderyk/32/14638_2.png) [@koeglfryderyk](https://discourse.slicer.org/u/koeglfryderyk)\
**Post date:** [December 16, 2024, 12:43pm UTC](https://discourse.slicer.org/t/cannot-decrease-the-width-of-my-module/40649/5 "2024-12-16T12:43:56Z")

</div>

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

```python
    slicer.app.setStyleSheet("""
                QWidget {
                    background-color: #060f21;
                    color: white;
                }
                QMainWindow {
                    background-color: #060f21;
                }
                qSlicerLayoutManager {
                    background-color: #060f21;
                }
                """)

```

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [December 16, 2024, 12:48pm UTC](https://discourse.slicer.org/t/cannot-decrease-the-width-of-my-module/40649/6 "2024-12-16T12:48:40Z")

</div>

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.
