KDE4 KDoubleNumInput -> QDoubleSpinBox ???

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

KDE4 KDoubleNumInput -> QDoubleSpinBox ???

Gerhard Kulzer-3
All KDoubleNumInput sliders that require sub-integer steps are not working anymore in KDE4 because KDoubleNumInput does not allow for it. That means that most of the plugin sliders are useless.

QDoubleSpinBox would be the adequate replacement allowing 0.01 steps in my (uninformed) eyes. If that is the solution, tell me, I could the replacement whereever needed.

Best regards
Gerhard

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: KDE4 KDoubleNumInput -> QDoubleSpinBox ???

Gilles Caulier-4
2008/4/22, Gerhard Kulzer <[hidden email]>:
> All KDoubleNumInput sliders that require sub-integer steps are not working anymore in KDE4 because KDoubleNumInput does not allow for it. That means that most of the plugin sliders are useless.
>
>  QDoubleSpinBox would be the adequate replacement allowing 0.01 steps in my (uninformed) eyes. If that is the solution, tell me, I could the replacement whereever needed.

Yes, i have seen few dysfunction in WB plugin.

For a simple KDoubleNumInput which not use a slider, yes, it can be
done. But in other case, QDoubleSpinBox do not provide a slider and
cannot be used instead...

http://doc.trolltech.com/4.3/qdoublespinbox.html

But there is no reason that KDoubleNumInput doesn't work. Look KDE api doc :

http://api.kde.org/4.0-api/kdelibs-apidocs/kdeui/html/classKDoubleNumInput.html

" The slider is created only when the user specifies a range for the
control using the setRange function with the slider parameter set to
"true"."

Perhaps it's the problem in my KDE4 port ?

Gilles
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: KDE4 KDoubleNumInput -> QDoubleSpinBox ???

Marcel Wiesweg

> 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/knuminput.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.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: KDE4 KDoubleNumInput -> QDoubleSpinBox ???

Gilles Caulier-4
2008/4/22 Marcel Wiesweg <[hidden email]>:

>
>  > 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/knuminput.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
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: KDE4 KDoubleNumInput -> QDoubleSpinBox ???

Laurent Montel
On Tuesday 22 April 2008 17:53:28 Gilles Caulier wrote:

> 2008/4/22 Marcel Wiesweg <[hidden email]>:
> >  > 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
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: KDE4 KDoubleNumInput -> QDoubleSpinBox ???

Laurent Montel
On Tuesday 22 April 2008 18:11:19 Laurent Montel wrote:

> On Tuesday 22 April 2008 17:53:28 Gilles Caulier wrote:
> > 2008/4/22 Marcel Wiesweg <[hidden email]>:
> > >  > 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/kn
> > >um 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

Marcel is right it can't work.
For the moment we have just a QSlider which works with integer.
It will necessary to create a "QDoubleSlider" if we want to make it work.
I will look at if it's possible.

Regards
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: KDE4 KDoubleNumInput -> QDoubleSpinBox ???

Gilles Caulier-4
2008/4/23 Laurent Montel <[hidden email]>:

> On Tuesday 22 April 2008 18:11:19 Laurent Montel wrote:
>  > On Tuesday 22 April 2008 17:53:28 Gilles Caulier wrote:
>  > > 2008/4/22 Marcel Wiesweg <[hidden email]>:
>  > > >  > 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/kn
>  > > >um 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
>
>  Marcel is right it can't work.
>  For the moment we have just a QSlider which works with integer.
>  It will necessary to create a "QDoubleSlider" if we want to make it work.
>  I will look at if it's possible.
>
>  Regards
>

Laurent.

There is something that i don't understand : KDoubleNumInput already
exist in KDE3 and work very well. When this widget have been ported to
KDE4, no regression regression tests have been done ?

Gilles
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: KDE4 KDoubleNumInput -> QDoubleSpinBox ???

Laurent Montel
On Wednesday 23 April 2008 08:58:08 Gilles Caulier wrote:

> 2008/4/23 Laurent Montel <[hidden email]>:
> > On Tuesday 22 April 2008 18:11:19 Laurent Montel wrote:
> >  > On Tuesday 22 April 2008 17:53:28 Gilles Caulier wrote:
> >  > > 2008/4/22 Marcel Wiesweg <[hidden email]>:
> >  > > >  > 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/widge
> >  > > >ts/kn um 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
> >
> >  Marcel is right it can't work.
> >  For the moment we have just a QSlider which works with integer.
> >  It will necessary to create a "QDoubleSlider" if we want to make it
> > work. I will look at if it's possible.
> >
> >  Regards
>
> Laurent.
>
> There is something that i don't understand : KDoubleNumInput already
> exist in KDE3 and work very well. When this widget have been ported to
> KDE4, no regression regression tests have been done ?

In kde3 there was a KDoubleSpinBox but it was removed for kde4 (I don't know
why). So it's necessary to readd/port it (if possible)

> Gilles



--
Laurent Montel,
KDE/KOffice developer, Qt consultancy projects
Klarälvdalens Datakonsult AB, Platform-independent software solutions
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: KDE4 KDoubleNumInput -> QDoubleSpinBox ???

Laurent Montel
On Wednesday 23 April 2008 09:42:50 Laurent Montel wrote:
> > There is something that i don't understand : KDoubleNumInput already
> > exist in KDE3 and work very well. When this widget have been ported to
> > KDE4, no regression regression tests have been done ?
>
> In kde3 there was a KDoubleSpinBox but it was removed for kde4 (I don't
> know why). So it's necessary to readd/port it (if possible)


In kde3 we have same code as kde4

=> spinbox use an "int"
=> I don't know how it can work on kde3
we will have the same error in kde3 for setlinestep
=> 0.1 will change to 0

    if( m_slider ) {
        // don't update the slider to avoid an endless recursion
        QSpinBox * spin = d->spin;
        disconnect(spin, SIGNAL(valueChanged(int)),
                m_slider, SLOT(setValue(int)) );
    }
    d->spin->setRange( lower, upper, step, d->spin->precision() );

    if(slider) {
        // upcast to base type to get the min/maxValue in int form:
        QSpinBox * spin = d->spin;
        int slmax = spin->maxValue();
        int slmin = spin->minValue();
        int slvalue = spin->value();
        int slstep = spin->lineStep();
        if (m_slider) {
            m_slider->setRange(slmin, slmax);
            m_slider->setLineStep(slstep);
            m_slider->setValue(slvalue);
        } else {
            m_slider = new QSlider(slmin, slmax, slstep, slvalue,
                                   QSlider::Horizontal, this);
            m_slider->setTickmarks(QSlider::Below);
            // feedback line: when one moves, the other moves, too:
            connect(m_slider, SIGNAL(valueChanged(int)),
                    SLOT(sliderMoved(int)) );
        }
        connect(spin, SIGNAL(valueChanged(int)),
                        m_slider, SLOT(setValue(int)) );
        // calculate ( slmax - slmin ) / 10 without overflowing ints:
        int major = calcDiffByTen( slmax, slmin );
        if ( !major ) major = slstep; // ### needed?
        m_slider->setTickInterval(major);
    } else {
        delete m_slider;
        m_slider = 0;
    }



> > Gilles
--
Laurent Montel,
KDE/KOffice developer, Qt consultancy projects
Klarälvdalens Datakonsult AB, Platform-independent software solutions
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: KDE4 KDoubleNumInput -> QDoubleSpinBox ???

Gerhard Kulzer-3
On Wednesday 23 April 2008 Laurent Montel wrote:

> On Wednesday 23 April 2008 09:42:50 Laurent Montel wrote:
> > > There is something that i don't understand : KDoubleNumInput already
> > > exist in KDE3 and work very well. When this widget have been ported to
> > > KDE4, no regression regression tests have been done ?
> >
> > In kde3 there was a KDoubleSpinBox but it was removed for kde4 (I don't
> > know why). So it's necessary to readd/port it (if possible)
>
>
> In kde3 we have same code as kde4
>
> => spinbox use an "int"
> => I don't know how it can work on kde3
> we will have the same error in kde3 for setlinestep
> => 0.1 will change to 0
>
I don't know why but in KDE3 it works with 0.01 step width.
Anyway, we need this slider functionality in KDE4.

Gerhard

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel

signature.asc (196 bytes) Download Attachment