diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-14 15:04:42 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-14 15:05:50 (GMT) |
commit | 3c8f4512df30dee4a867a498fff6d2b27b881e4b (patch) | |
tree | f6cec8256c40fe72514cfbd304f1eb85bd916e4d /src/3rdparty | |
parent | 533807d5c06be28694665fc889ec1942c59ab705 (diff) | |
download | Qt-3c8f4512df30dee4a867a498fff6d2b27b881e4b.zip Qt-3c8f4512df30dee4a867a498fff6d2b27b881e4b.tar.gz Qt-3c8f4512df30dee4a867a498fff6d2b27b881e4b.tar.bz2 |
QVariant: more work on avoinding conversion between float and doubles
we call QVariant::toReal instead of toDouble when needed
Diffstat (limited to 'src/3rdparty')
-rw-r--r-- | src/3rdparty/phonon/ds9/effect.cpp | 3 | ||||
-rw-r--r-- | src/3rdparty/phonon/phonon/effectwidget.cpp | 13 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/3rdparty/phonon/ds9/effect.cpp b/src/3rdparty/phonon/ds9/effect.cpp index dc4ac3d..104a3c1 100644 --- a/src/3rdparty/phonon/ds9/effect.cpp +++ b/src/3rdparty/phonon/ds9/effect.cpp @@ -138,8 +138,7 @@ namespace Phonon ComPointer<IMediaParams> params(filter, IID_IMediaParams); Q_ASSERT(params); - MP_DATA data = float(v.toDouble()); - params->SetParam(p.id(), data); + params->SetParam(p.id(), v.toFloat()); } } diff --git a/src/3rdparty/phonon/phonon/effectwidget.cpp b/src/3rdparty/phonon/phonon/effectwidget.cpp index 99478f7..8f105f2 100644 --- a/src/3rdparty/phonon/phonon/effectwidget.cpp +++ b/src/3rdparty/phonon/phonon/effectwidget.cpp @@ -111,7 +111,7 @@ void EffectWidgetPrivate::autogenerateUi() #endif QWidget *control = 0; - switch (para.type()) { + switch (para.userType()) { case QVariant::String: { QComboBox *cb = new QComboBox(q); @@ -157,19 +157,20 @@ void EffectWidgetPrivate::autogenerateUi() QObject::connect(sb, SIGNAL(valueChanged(int)), q, SLOT(_k_setIntParameter(int))); } break; + case QMetaType::Float: case QVariant::Double: { - const double minValue = (para.minimumValue().type() == QVariant::Double ? - para.minimumValue().toDouble() : DEFAULT_MIN); - const double maxValue = (para.maximumValue().type() == QVariant::Double ? - para.maximumValue().toDouble() : DEFAULT_MAX); + const qreal minValue = para.minimumValue().canConvert(QVariant::Double) ? + para.minimumValue().toReal(&ok) : DEFAULT_MIN; + const qreal maxValue = para.maximumValue().canConvert(QVariant::Double) ? + para.maximumValue().toReal(&ok) : DEFAULT_MAX; if (minValue == -1. && maxValue == 1.) { //Special case values between -1 and 1.0 to use a slider for improved usability QSlider *slider = new QSlider(Qt::Horizontal, q); control = slider; slider->setRange(-SLIDER_RANGE, +SLIDER_RANGE); - slider->setValue(int(SLIDER_RANGE * value.toDouble())); + slider->setValue(int(SLIDER_RANGE * value.toReal())); slider->setTickPosition(QSlider::TicksBelow); slider->setTickInterval(TICKINTERVAL); QObject::connect(slider, SIGNAL(valueChanged(int)), q, SLOT(_k_setSliderParameter(int))); |