fixes for platforms where qreal is not a double

btw, wouldn't it be cleaner if all those qMin(0.0, qMax(1.0, foo)) calls are calls to qBound instead?

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=748283
This commit is contained in:
Marijn Kruisselbrink 2007-12-14 01:38:32 +00:00
parent 8fcf61c9b6
commit a7dcbb5456
5 changed files with 8 additions and 8 deletions

View File

@ -220,9 +220,9 @@ void LayoutAnimator::moveEffectUpdateItem( qreal value , LayoutItem* item , Effe
Widget* widget = dynamic_cast<Widget*>(item->graphicsItem());
if ( widget && effect == FadeInMoveEffect )
widget->setOpacity( qMin(1.0,widget->opacity()+d->delta(value)) );
widget->setOpacity( qMin(qreal(1.0),widget->opacity()+d->delta(value)) );
else if ( widget && effect == FadeOutMoveEffect )
widget->setOpacity( qMax(0.0,widget->opacity()-d->delta(value)) );
widget->setOpacity( qMax(qreal(0.0),widget->opacity()-d->delta(value)) );
if ( effect == FadeInMoveEffect ) {

View File

@ -141,8 +141,8 @@ public:
// not do anything smarter concerning the sizeHint when there are
// autosized elements.
qreal width = item->sizeHint().width() / qMin(scaled.width(), 1.0);
qreal height = item->sizeHint().height() / qMin(scaled.height(), 1.0);
qreal width = item->sizeHint().width() / qMin(scaled.width(), qreal(1.0));
qreal height = item->sizeHint().height() / qMin(scaled.height(), qreal(1.0));
if (width > sizeHint.width()) sizeHint.setWidth(width);
if (height > sizeHint.height()) sizeHint.setHeight(height);

View File

@ -115,7 +115,7 @@ class Phase::Private
{
qreal progress = frames;
progress = currentFrame / progress;
progress = qMin(1.0, qMax(0.0, progress));
progress = qMin(qreal(1.0), qMax(qreal(0.0), progress));
return progress;
}
@ -420,7 +420,7 @@ QPixmap Phase::animationResult(AnimId id)
qreal progress = state->frames;
//kDebug() << "Phase::animationResult(" << id << " at " << progress;
progress = state->currentFrame / progress;
progress = qMin(1.0, qMax(0.0, progress));
progress = qMin(qreal(1.0), qMax(qreal(0.0), progress));
//kDebug() << "Phase::animationResult(" << id << " at " << progress;
switch (state->animation) {

View File

@ -92,7 +92,7 @@ QString SearchMatch::searchTerm() const
void SearchMatch::setRelevance(qreal relevance)
{
d->relevance = qMax(0.0, qMin(1.0, relevance));
d->relevance = qMax(qreal(0.0), qMin(qreal(1.0), relevance));
}
qreal SearchMatch::relevance() const

View File

@ -255,7 +255,7 @@ void SignalPlotter::scale(qreal delta)
calculateNiceRange();
}
double SignalPlotter::scaledBy() const
qreal SignalPlotter::scaledBy() const
{
return d->scaledBy;
}