Slicer ROI dimensions Input numbers autofill


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 ?

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.

1 Like

I believe those both use a ctkDoubleSpinBox internially, so one could try changing it to use the editingFinished signal. Might be a little work to dig through the layers since those range sliders have several modes to keep in sync.

1 Like

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.

1 Like

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

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).

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.

[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.