Mentions légales du service

Skip to content

Hotfix/ avoid spinbox and comboBox scroll

LEVY Jonathan requested to merge hotfix/spinbox-scroll into develop

This fix changes the behaviour of the spinboxes to only allow scrolling whey they are strongly focused (clicked with the moused, selected with Tab, etc.)

  • I created a BaseSpinBox mother class, from which SpinBoxLong and SpinBoxDouble inherit
  • In this class I factorized some code that was common to both SpinBoxLong and SpinBoxDouble, and I added an eventFilter.
  • Oddly enough, I had a strange glitch where the cursor was not displayed when clicking the spinbox, unless you select some text or you move the cursor with arrows (hence forcing it to be displayed). I added a quick workaround to force the cursor to be displayed, so that the user knows that the spinbox is selected. (Ideally, it would be nice to have the theme change the spinbox color when it's selected!)

Also, the ParameterSpinBoxes use SpinBoxLong and SpinBoxDouble, except the ParameterIntSpinBox, which was using a plain QSpinBox. I changed ParameterIntSpinBox to use a SpinBoxLong to avoid rewriting everything for it (if you can store it in an int, you can store it in a long long).

The result is, you can scroll without being stopped by a spinbox ; you can click on a spinbox to focus it (hence displaying a cursor), and when it's selected, you can scroll it. You can click outside, or use Tab, to lose focus.

This has been tested with Macular. (I saw that some older bugs appear in the demo app dtkWidgetsMenu in dtk-widgets, so I prefered to test it with a more recent implementation)

EDIT

I was told by Nicolas Niclausse that the ComboBox also scrolled while not focused, so I added an event filter to reject scrolls.

Edited by LEVY Jonathan

Merge request reports