Bug 168022 - KDoubleNumInput is broken in KDE4
Summary: KDoubleNumInput is broken in KDE4
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Unmaintained
Component: kdeui (show other bugs)
Version: SVN
Platform: unspecified Linux
: VHI normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
: 216630 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-08-01 19:09 UTC by Gandalf Lechner
Modified: 2018-08-28 10:44 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Fixes issues with small double numbers (2.00 KB, patch)
2009-01-01 19:02 UTC, Urs Wolfer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gandalf Lechner 2008-08-01 19:09:30 UTC
Version:           0.10-beta3 (using 4.1.00 (KDE 4.1.0), Kubuntu packages)
Compiler:          gcc
OS:                Linux (x86_64) release 2.6.24-17-generic

In the add border dialog, with "preserve aspect ratio" switched off, the slider for choosing the width of the border behaves incorrectly; it only allows the user to choose between two values, 1 pixel or 1103 pixel in my case.
This problem does not appear in 0.9.4. The percentage slider one can use with "preserve aspect ratio" switched on works fine in both cases.
Comment 1 caulier.gilles 2008-08-01 20:36:28 UTC
Looks like a KDE bug into KDoubleNumInput

Look at the code from knuminput.cpp (current trunk):
       // upcast to base type to get the minimum/maximum in int form:
       QDoubleSpinBox * spin = d->spin;
       int slmax = spin->maximum(); <-- What if maximum is 0.4? Slider's maximum is 0.
       int slmin = spin->minimum(); <-- same for this
       int slvalue = spin->value(); <--
       int slstep = spin->singleStep(); <-- Step 0.01? slstep is 0
...
           priv->m_slider = new QSlider(Qt::Horizontal, this);
           priv->m_slider->setMinimum(slmin);
           priv->m_slider->setMaximum(slmax);
           priv->m_slider->setSingleStep(slstep);
           priv->m_slider->setValue(slvalue);

Look at compilation warning:
/home/marcel/freshmeat/multimedia/kde4/src/KDE/kdelibs/kdeui/widgets/knuminput.cpp:834: warning: converting to 'int' from 'double'

Gilles Caulier
Comment 2 Mikolaj Machowski 2008-12-15 21:59:38 UTC
*** Bug 177876 has been marked as a duplicate of this bug. ***
Comment 3 Luka Renko 2009-01-01 18:18:48 UTC
How can we raise priority for this to get on fixed before 4.2 release?
Comment 4 caulier.gilles 2009-01-01 18:23:39 UTC
I'm agree with Luka.

This file is very important for digiKam. KDoubleNumInput widget is everywhere in digiKam (Raw decoding, editor plugins, etc...)

Dysfunctions from this widget reduce digiKam usability. 

Thanks in advance to take a look on this problem before KDE 4.2 release.

Happy new year.

Gilles Caulier 
Comment 5 Urs Wolfer 2009-01-01 19:02:11 UTC
Created attachment 29806 [details]
Fixes issues with small double numbers

Please seems to work well with the class test; though I have not tested it with digikam. Please test it and let me know some feedback.

Anyway, the whole knuminput classes could need some revamp....
Comment 6 caulier.gilles 2009-01-01 19:07:57 UTC
Andi, Marcel, Mik,

If you use KDE4 from trunk, please test patch from Urs with digiKam. Here i still use KDE 4.1.3.

Thanks in advance

Gilles Caulier
Comment 7 Mikolaj Machowski 2009-01-01 22:24:54 UTC
Looks OK. There are still few things I noticed:

- by moving slider values change by 0.10, not fluently; I can insert more precise values in numeric fields; in connection with complex limitations of values in some plugins this creates some mess
- in White Balance, Black point setting is limited only to 0.05 amplitude so by moving slider there are only two positions 0.0 and 0.05
- Restoration -> General -> Smoothing while dragging slider it sometimes add/remove 0.01 from value

There is definite improvement but things still feel awkward.
Comment 8 Urs Wolfer 2009-01-02 00:04:34 UTC
SVN commit 904333 by uwolfer:

Fix slider for KDoubleNumInput when using very small numbers.
Thanks for the feedback Mikolaj; I have adjusted the patch so it should work better in your cases.
BUG:168022

 M  +8 -4      knuminput.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=904333
Comment 9 Christoph Feck 2009-12-01 01:19:58 UTC
The slider still has problems, e.g. using

    KDoubleNumInput *input = new KDoubleNumInput(0.1, 3.0, 1.0, mainWindow);
    input->setSliderEnabled(true);
    input->setSingleStep(0.01);

does only allow 11 distinct values, it should allow (3.0 - 0.1) / 0.01 + 1 = 291 values. See duplicate bug report.
Comment 10 Christoph Feck 2009-12-01 01:20:18 UTC
*** Bug 216630 has been marked as a duplicate of this bug. ***
Comment 11 Christoph Feck 2009-12-09 04:50:20 UTC
SVN commit 1060479 by cfeck:

Improve KDoubleNumInput slider

* Fixed crash on minimum == maximum
* Fixed incorrect slider value for exponentRatio != 1.0
* Correctly compute number of steps for small ranges
* Improve slider usability for large ranges and exponential sliders

BUG: 168022


 M  +14 -18    knuminput.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1060479