[Digikam-devel] KDE4 KDoubleNumInput -> QDoubleSpinBox ???
Laurent Montel
montel at kde.org
Wed Apr 23 08:48:58 BST 2008
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
More information about the Digikam-devel
mailing list