diff options
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qeasingcurve.cpp | 20 | ||||
-rw-r--r-- | src/corelib/tools/qline.cpp | 12 |
3 files changed, 17 insertions, 17 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 5ae2dde..db6435e 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -1915,7 +1915,7 @@ QTime QTime::fromString(const QString& s, Qt::DateFormat f) const float msec(msec_s.toFloat(&ok)); if (!ok) return QTime(); - return QTime(hour, minute, second, qMin(qRound(msec * qreal(1000.0)), 999)); + return QTime(hour, minute, second, qMin(qRound(msec * 1000.0), 999)); } } } diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index a629ebc..3e1e1ee 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -317,7 +317,7 @@ class QEasingCurveFunction public: enum Type { In, Out, InOut, OutIn }; - QEasingCurveFunction(QEasingCurveFunction::Type type = In, qreal period = qreal(0.3), qreal amplitude = qreal(1.0), + QEasingCurveFunction(QEasingCurveFunction::Type type = In, qreal period = 0.3, qreal amplitude = 1.0, qreal overshoot = 1.70158f) : _t(type), _p(period), _a(amplitude), _o(overshoot) { } @@ -667,7 +667,7 @@ bool QEasingCurve::operator==(const QEasingCurve &other) const */ qreal QEasingCurve::amplitude() const { - return d_ptr->config ? d_ptr->config->_a : qreal(1.0); + return d_ptr->config ? d_ptr->config->_a : 1.0; } /*! @@ -691,7 +691,7 @@ void QEasingCurve::setAmplitude(qreal amplitude) */ qreal QEasingCurve::period() const { - return d_ptr->config ? d_ptr->config->_p : qreal(0.3); + return d_ptr->config ? d_ptr->config->_p : 0.3; } /*! @@ -742,9 +742,9 @@ QEasingCurve::Type QEasingCurve::type() const void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType) { - qreal amp = qreal(-1.0); - qreal period = qreal(-1.0); - qreal overshoot = qreal(-1.0); + qreal amp = -1.0; + qreal period = -1.0; + qreal overshoot = -1.0; if (config) { amp = config->_a; @@ -754,13 +754,13 @@ void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType) config = 0; } - if (isConfigFunction(newType) || (amp != qreal(-1.0)) || (period != qreal(-1.0)) || (overshoot != qreal(-1.0))) { + if (isConfigFunction(newType) || (amp != -1.0) || (period != -1.0) || (overshoot != -1.0)) { config = curveToFunctionObject(newType); - if (amp != qreal(-1.0)) + if (amp != -1.0) config->_a = amp; - if (period != qreal(-1.0)) + if (period != -1.0) config->_p = period; - if (overshoot != qreal(-1.0)) + if (overshoot != -1.0) config->_o = overshoot; func = 0; } else if (newType != QEasingCurve::Custom) { diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp index 5b30c97..d0afb7a 100644 --- a/src/corelib/tools/qline.cpp +++ b/src/corelib/tools/qline.cpp @@ -574,7 +574,7 @@ qreal QLineF::angle() const const qreal dx = pt2.x() - pt1.x(); const qreal dy = pt2.y() - pt1.y(); - const qreal theta = qAtan2(-dy, dx) * qreal(360.0) / Q_2PI; + const qreal theta = atan2(-dy, dx) * 360.0 / M_2PI; const qreal theta_normalized = theta < 0 ? theta + 360 : theta; @@ -598,7 +598,7 @@ qreal QLineF::angle() const */ void QLineF::setAngle(qreal angle) { - const qreal angleR = angle * Q_2PI / qreal(360.0); + const qreal angleR = angle * M_2PI / 360.0; const qreal l = length(); const qreal dx = qCos(angleR) * l; @@ -620,7 +620,7 @@ void QLineF::setAngle(qreal angle) */ QLineF QLineF::fromPolar(qreal length, qreal angle) { - const qreal angleR = angle * Q_2PI / qreal(360.0); + const qreal angleR = angle * M_2PI / 360.0; return QLineF(0, 0, qCos(angleR) * length, -qSin(angleR) * length); } @@ -639,7 +639,7 @@ QLineF QLineF::unitVector() const QLineF f(p1(), QPointF(pt1.x() + x/len, pt1.y() + y/len)); #ifndef QT_NO_DEBUG - if (qAbs(f.length() - 1) >= qreal(0.001)) + if (qAbs(f.length() - 1) >= 0.001) qWarning("QLine::unitVector: New line does not have unit length"); #endif @@ -814,8 +814,8 @@ qreal QLineF::angle(const QLineF &l) const qreal cos_line = (dx()*l.dx() + dy()*l.dy()) / (length()*l.length()); qreal rad = 0; // only accept cos_line in the range [-1,1], if it is outside, use 0 (we return 0 rather than PI for those cases) - if (cos_line >= qreal(-1.0) && cos_line <= qreal(1.0)) rad = qAcos( cos_line ); - return rad * 360 / Q_2PI; + if (cos_line >= -1.0 && cos_line <= 1.0) rad = acos( cos_line ); + return rad * 360 / M_2PI; } |