[Digikam-devel] KDE4 KDoubleNumInput -> QDoubleSpinBox ???

Laurent Montel montel at kde.org
Tue Apr 22 17:11:19 BST 2008


On Tuesday 22 April 2008 17:53:28 Gilles Caulier wrote:
> 2008/4/22 Marcel Wiesweg <marcel.wiesweg at gmx.de>:
> >  > Perhaps it's the problem in my KDE4 port ?
> >
> >  Looks like a KDE bug:
> >
> >  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/knum
> >input.cpp:834: warning: converting to 'int' from 'double'
> >
> >
> >  Looking at the docs: QDoubleSpinBox::singleStep() is a double value,
> > here converted to an int. Converting 0.01 to int results in 0. QSlider
> > only takes integer arguments, so the ints need to be mapped to double.
> > The code above is not suitable for ranges and steps in [0; 1], has very
> > bad results for [1; 10], and may begin to work in the hundreds.
>
> You has right Marcel.
>
> I fork your message to Laurent Montel to fix the problem in KDELibs.
>
> Best
>
> Gilles Caulier

Waou... it's a big bug.
I will look at it this night (not time now)
I add it to my todo

-- 
Laurent Montel,
KDE/KOffice developer, Qt consultancy projects
Klarälvdalens Datakonsult AB, Platform-independent software solutions



More information about the Digikam-devel mailing list