# Slicer ROI dimensions Input numbers autofill

**URL:** <https://discourse.slicer.org/t/slicer-roi-dimensions-input-numbers-autofill/12773>\
**Category:** Development\
**Created:** [July 29, 2020, 6:07pm UTC](https://discourse.slicer.org/t/slicer-roi-dimensions-input-numbers-autofill/12773 "2020-07-29T18:07:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![manjula](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/manjula/32/80981_2.png) [@manjula](https://discourse.slicer.org/u/manjula)\
**Post date:** [July 29, 2020, 6:07pm UTC](https://discourse.slicer.org/t/slicer-roi-dimensions-input-numbers-autofill/12773/1 "2020-07-29T18:07:24Z")

</div>

Hi,

it is bit annoying when we type in the dimensions of ROI box that it autofills the next number. I am not sure if I explain it properly.

For example if I want to type 0.75 and the moment I type 0.7 it fills the 0. So it is kind of annoying when we change the ROI frequently. I noticed this in some other modules also but I cannot recall them now.

is this something that can be fixed ?

 ![Screenshot from 2020-07-29 19-49-11](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/2/f204754e07a5ed55a7ab6a42ad580f8fc4780c2a.png)

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [July 29, 2020, 6:28pm UTC](https://discourse.slicer.org/t/slicer-roi-dimensions-input-numbers-autofill/12773/2 "2020-07-29T18:28:26Z")

</div>

Yes, it is annoying. ScalarOpacityMapping of the Volume Rendering module also shows some strange typing behaviors, when you try to manually enter values for points.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [July 29, 2020, 7:02pm UTC](https://discourse.slicer.org/t/slicer-roi-dimensions-input-numbers-autofill/12773/3 "2020-07-29T19:02:10Z")

</div>

I believe those both use a [`ctkDoubleSpinBox`](https://github.com/commontk/CTK/blob/master/Libs/Widgets/ctkDoubleSpinBox.cpp) internially, so one could try changing it to use the [`editingFinished` signal](https://doc.qt.io/qt-5/qlineedit.html#editingFinished). Might be a little work to dig through the layers since those range sliders have several modes to keep in sync.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 29, 2020, 8:26pm UTC](https://discourse.slicer.org/t/slicer-roi-dimensions-input-numbers-autofill/12773/4 "2020-07-29T20:26:39Z")

</div>

ctkDoubleSpinBox behavior is controlled by several flags and many combinations results in annoying behavior. Probably just a few of those flags would need to be flipped to fix this.

ScalarOpacityMapping has some extra complications - you need to remain between two two neighbor values and validation is necessary after each typed character to make the rendering update instantly.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [July 29, 2020, 10:11pm UTC](https://discourse.slicer.org/t/slicer-roi-dimensions-input-numbers-autofill/12773/5 "2020-07-29T22:11:36Z")

</div>

> [@lassoan](#):
>
> ScalarOpacityMapping has some extra complications - you need to remain between two two neighbor values and validation is necessary after each typed character to make the rendering update instantly.

The validation and re-rendering don’t need to happen on each typed character. It would be fine to wait for editingFinished.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 29, 2020, 10:25pm UTC](https://discourse.slicer.org/t/slicer-roi-dimensions-input-numbers-autofill/12773/6 "2020-07-29T22:25:38Z")

</div>

Would waiting for editingFinished mean that you need to hit Tab and Shift+Tab to see the result of editing the value? That would be quite a lot of extra work. Also, the values are mainly intended to be visually adjusted by hitting the arrow up/down keys - waiting for editingFinished may break that, too (I haven’t tried).

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [July 30, 2020, 12:04am UTC](https://discourse.slicer.org/t/slicer-roi-dimensions-input-numbers-autofill/12773/7 "2020-07-30T00:04:17Z")

</div>

I haven’t tried either, but the editingFinished is triggered either by losing focus (tab) or by hitting return, which I think is very conventional when entering text in a scenario like this. Not sure what the arrow button behavior is, but that could be decoupled from the text input.

> **[QLineEdit Class | Qt Widgets 6.6.1](https://doc.qt.io/qt-5/qlineedit.html#editingFinished)**
>
> The QLineEdit widget is a one-line text editor.

> [signal]void QLineEdit::editingFinished()  
> This signal is emitted when the Return or Enter key is pressed or the line edit loses focus. Note that if there is a validator() or inputMask() set on the line edit and enter/return is pressed, the editingFinished() signal will only be emitted if the input follows the inputMask() and the validator() returns QValidator::Acceptable.
