summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp16
-rw-r--r--src/gui/math3d/qquaternion.cpp54
-rw-r--r--src/gui/math3d/qvector2d.cpp6
-rw-r--r--src/gui/math3d/qvector3d.cpp6
-rw-r--r--src/gui/math3d/qvector4d.cpp6
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp4
-rw-r--r--src/gui/opengl/qtriangulatingstroker_p.h6
-rw-r--r--src/gui/opengl/qtriangulator.cpp8
-rw-r--r--src/gui/painting/qdrawhelper.cpp8
-rw-r--r--src/gui/painting/qmath_p.h7
-rw-r--r--src/gui/painting/qrasterizer.cpp16
-rw-r--r--src/gui/text/qdistancefield.cpp6
-rw-r--r--src/gui/text/qfontdatabase.cpp2
-rw-r--r--src/gui/util/qgridlayoutengine.cpp4
-rw-r--r--src/gui/util/qvalidator.cpp4
15 files changed, 70 insertions, 83 deletions
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp
index 42aae6c20c..c196f7cff8 100644
--- a/src/gui/math3d/qmatrix4x4.cpp
+++ b/src/gui/math3d/qmatrix4x4.cpp
@@ -1125,8 +1125,8 @@ void QMatrix4x4::rotate(float angle, float x, float y, float z)
c = -1.0f;
} else {
float a = angle * M_PI / 180.0f;
- c = cosf(a);
- s = sinf(a);
+ c = std::cos(a);
+ s = std::sin(a);
}
if (x == 0.0f) {
if (y == 0.0f) {
@@ -1186,7 +1186,7 @@ void QMatrix4x4::rotate(float angle, float x, float y, float z)
double(y) * double(y) +
double(z) * double(z);
if (!qFuzzyCompare(len, 1.0) && !qFuzzyIsNull(len)) {
- len = sqrt(len);
+ len = std::sqrt(len);
x = float(double(x) / len);
y = float(double(y) / len);
z = float(double(z) / len);
@@ -1234,8 +1234,8 @@ void QMatrix4x4::projectedRotate(float angle, float x, float y, float z)
c = -1.0f;
} else {
float a = angle * M_PI / 180.0f;
- c = cosf(a);
- s = sinf(a);
+ c = std::cos(a);
+ s = std::sin(a);
}
if (x == 0.0f) {
if (y == 0.0f) {
@@ -1282,7 +1282,7 @@ void QMatrix4x4::projectedRotate(float angle, float x, float y, float z)
double(y) * double(y) +
double(z) * double(z);
if (!qFuzzyCompare(len, 1.0) && !qFuzzyIsNull(len)) {
- len = sqrt(len);
+ len = std::sqrt(len);
x = float(double(x) / len);
y = float(double(y) / len);
z = float(double(z) / len);
@@ -1487,10 +1487,10 @@ void QMatrix4x4::perspective(float verticalAngle, float aspectRatio, float nearP
// Construct the projection.
QMatrix4x4 m(1);
float radians = (verticalAngle / 2.0f) * M_PI / 180.0f;
- float sine = sinf(radians);
+ float sine = std::sin(radians);
if (sine == 0.0f)
return;
- float cotan = cosf(radians) / sine;
+ float cotan = std::cos(radians) / sine;
float clip = farPlane - nearPlane;
m.m[0][0] = cotan / aspectRatio;
m.m[1][0] = 0.0f;
diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp
index 0653ace5a4..f2e79cb834 100644
--- a/src/gui/math3d/qquaternion.cpp
+++ b/src/gui/math3d/qquaternion.cpp
@@ -219,7 +219,7 @@ QT_BEGIN_NAMESPACE
*/
float QQuaternion::length() const
{
- return qSqrt(xp * xp + yp * yp + zp * zp + wp * wp);
+ return std::sqrt(xp * xp + yp * yp + zp * zp + wp * wp);
}
/*!
@@ -252,7 +252,7 @@ QQuaternion QQuaternion::normalized() const
if (qFuzzyIsNull(len - 1.0f))
return *this;
else if (!qFuzzyIsNull(len))
- return *this / qSqrt(len);
+ return *this / std::sqrt(len);
else
return QQuaternion(0.0f, 0.0f, 0.0f, 0.0f);
}
@@ -273,7 +273,7 @@ void QQuaternion::normalize()
if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
return;
- len = qSqrt(len);
+ len = std::sqrt(len);
xp /= len;
yp /= len;
@@ -386,8 +386,8 @@ QQuaternion QQuaternion::fromAxisAndAngle(const QVector3D& axis, float angle)
// We normalize the result just in case the values are close
// to zero, as suggested in the above FAQ.
float a = (angle / 2.0f) * M_PI / 180.0f;
- float s = sinf(a);
- float c = cosf(a);
+ float s = std::sin(a);
+ float c = std::cos(a);
QVector3D ax = axis.normalized();
return QQuaternion(c, ax.x() * s, ax.y() * s, ax.z() * s).normalized();
}
@@ -415,12 +415,12 @@ void QQuaternion::toAxisAndAngle(float *x, float *y, float *z, float *angle) con
*y = yp;
*z = zp;
if (!qFuzzyIsNull(length - 1.0f)) {
- length = sqrtf(length);
+ length = std::sqrt(length);
*x /= length;
*y /= length;
*z /= length;
}
- *angle = 2.0f * acosf(wp);
+ *angle = 2.0f * std::acos(wp);
} else {
// angle is 0 (mod 2*pi), so any axis will fit
*x = *y = *z = *angle = 0.0f;
@@ -438,15 +438,15 @@ void QQuaternion::toAxisAndAngle(float *x, float *y, float *z, float *angle) con
QQuaternion QQuaternion::fromAxisAndAngle
(float x, float y, float z, float angle)
{
- float length = qSqrt(x * x + y * y + z * z);
+ float length = std::sqrt(x * x + y * y + z * z);
if (!qFuzzyIsNull(length - 1.0f) && !qFuzzyIsNull(length)) {
x /= length;
y /= length;
z /= length;
}
float a = (angle / 2.0f) * M_PI / 180.0f;
- float s = sinf(a);
- float c = cosf(a);
+ float s = std::sin(a);
+ float c = std::cos(a);
return QQuaternion(c, x * s, y * s, z * s).normalized();
}
@@ -515,20 +515,20 @@ void QQuaternion::toEulerAngles(float *pitch, float *yaw, float *roll) const
zw /= lengthSquared;
}
- *pitch = asinf(-2.0f * (yz - xw));
+ *pitch = std::asin(-2.0f * (yz - xw));
if (*pitch < M_PI_2) {
if (*pitch > -M_PI_2) {
- *yaw = atan2f(2.0f * (xz + yw), 1.0f - 2.0f * (xx + yy));
- *roll = atan2f(2.0f * (xy + zw), 1.0f - 2.0f * (xx + zz));
+ *yaw = std::atan2(2.0f * (xz + yw), 1.0f - 2.0f * (xx + yy));
+ *roll = std::atan2(2.0f * (xy + zw), 1.0f - 2.0f * (xx + zz));
} else {
// not a unique solution
*roll = 0.0f;
- *yaw = -atan2f(-2.0f * (xy - zw), 1.0f - 2.0f * (yy + zz));
+ *yaw = -std::atan2(-2.0f * (xy - zw), 1.0f - 2.0f * (yy + zz));
}
} else {
// not a unique solution
*roll = 0.0f;
- *yaw = atan2f(-2.0f * (xy - zw), 1.0f - 2.0f * (yy + zz));
+ *yaw = std::atan2(-2.0f * (xy - zw), 1.0f - 2.0f * (yy + zz));
}
*pitch = qRadiansToDegrees(*pitch);
@@ -558,12 +558,12 @@ QQuaternion QQuaternion::fromEulerAngles(float pitch, float yaw, float roll)
yaw *= 0.5f;
roll *= 0.5f;
- const float c1 = cosf(yaw);
- const float s1 = sinf(yaw);
- const float c2 = cosf(roll);
- const float s2 = sinf(roll);
- const float c3 = cosf(pitch);
- const float s3 = sinf(pitch);
+ const float c1 = std::cos(yaw);
+ const float s1 = std::sin(yaw);
+ const float c2 = std::cos(roll);
+ const float s2 = std::sin(roll);
+ const float c3 = std::cos(pitch);
+ const float s3 = std::sin(pitch);
const float c1c2 = c1 * c2;
const float s1s2 = s1 * s2;
@@ -635,7 +635,7 @@ QQuaternion QQuaternion::fromRotationMatrix(const QMatrix3x3 &rot3x3)
const float trace = rot3x3(0, 0) + rot3x3(1, 1) + rot3x3(2, 2);
if (trace > 0.00000001f) {
- const float s = 2.0f * sqrtf(trace + 1.0f);
+ const float s = 2.0f * std::sqrt(trace + 1.0f);
scalar = 0.25f * s;
axis[0] = (rot3x3(2, 1) - rot3x3(1, 2)) / s;
axis[1] = (rot3x3(0, 2) - rot3x3(2, 0)) / s;
@@ -650,7 +650,7 @@ QQuaternion QQuaternion::fromRotationMatrix(const QMatrix3x3 &rot3x3)
int j = s_next[i];
int k = s_next[j];
- const float s = 2.0f * sqrtf(rot3x3(i, i) - rot3x3(j, j) - rot3x3(k, k) + 1.0f);
+ const float s = 2.0f * std::sqrt(rot3x3(i, i) - rot3x3(j, j) - rot3x3(k, k) + 1.0f);
axis[i] = 0.25f * s;
scalar = (rot3x3(k, j) - rot3x3(j, k)) / s;
axis[j] = (rot3x3(j, i) + rot3x3(i, j)) / s;
@@ -792,11 +792,11 @@ QQuaternion QQuaternion::slerp
float factor1 = 1.0f - t;
float factor2 = t;
if ((1.0f - dot) > 0.0000001) {
- float angle = acosf(dot);
- float sinOfAngle = sinf(angle);
+ float angle = std::acos(dot);
+ float sinOfAngle = std::sin(angle);
if (sinOfAngle > 0.0000001) {
- factor1 = sinf((1.0f - t) * angle) / sinOfAngle;
- factor2 = sinf(t * angle) / sinOfAngle;
+ factor1 = std::sin((1.0f - t) * angle) / sinOfAngle;
+ factor2 = std::sin(t * angle) / sinOfAngle;
}
}
diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp
index bad46c6e0b..fe4c9f8cc2 100644
--- a/src/gui/math3d/qvector2d.cpp
+++ b/src/gui/math3d/qvector2d.cpp
@@ -189,7 +189,7 @@ float QVector2D::length() const
// Need some extra precision if the length is very small.
double len = double(xp) * double(xp) +
double(yp) * double(yp);
- return float(sqrt(len));
+ return float(std::sqrt(len));
}
/*!
@@ -220,7 +220,7 @@ QVector2D QVector2D::normalized() const
if (qFuzzyIsNull(len - 1.0f)) {
return *this;
} else if (!qFuzzyIsNull(len)) {
- double sqrtLen = sqrt(len);
+ double sqrtLen = std::sqrt(len);
return QVector2D(float(double(xp) / sqrtLen), float(double(yp) / sqrtLen));
} else {
return QVector2D();
@@ -241,7 +241,7 @@ void QVector2D::normalize()
if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
return;
- len = sqrt(len);
+ len = std::sqrt(len);
xp = float(double(xp) / len);
yp = float(double(yp) / len);
diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp
index fa09a43480..a93d994a70 100644
--- a/src/gui/math3d/qvector3d.cpp
+++ b/src/gui/math3d/qvector3d.cpp
@@ -235,7 +235,7 @@ QVector3D QVector3D::normalized() const
if (qFuzzyIsNull(len - 1.0f)) {
return *this;
} else if (!qFuzzyIsNull(len)) {
- double sqrtLen = sqrt(len);
+ double sqrtLen = std::sqrt(len);
return QVector3D(float(double(xp) / sqrtLen),
float(double(yp) / sqrtLen),
float(double(zp) / sqrtLen));
@@ -259,7 +259,7 @@ void QVector3D::normalize()
if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
return;
- len = sqrt(len);
+ len = std::sqrt(len);
xp = float(double(xp) / len);
yp = float(double(yp) / len);
@@ -679,7 +679,7 @@ float QVector3D::length() const
double len = double(xp) * double(xp) +
double(yp) * double(yp) +
double(zp) * double(zp);
- return float(sqrt(len));
+ return float(std::sqrt(len));
}
/*!
diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp
index 1eed1c1301..6afe9b8cad 100644
--- a/src/gui/math3d/qvector4d.cpp
+++ b/src/gui/math3d/qvector4d.cpp
@@ -256,7 +256,7 @@ float QVector4D::length() const
double(yp) * double(yp) +
double(zp) * double(zp) +
double(wp) * double(wp);
- return float(sqrt(len));
+ return float(std::sqrt(len));
}
/*!
@@ -289,7 +289,7 @@ QVector4D QVector4D::normalized() const
if (qFuzzyIsNull(len - 1.0f)) {
return *this;
} else if (!qFuzzyIsNull(len)) {
- double sqrtLen = sqrt(len);
+ double sqrtLen = std::sqrt(len);
return QVector4D(float(double(xp) / sqrtLen),
float(double(yp) / sqrtLen),
float(double(zp) / sqrtLen),
@@ -315,7 +315,7 @@ void QVector4D::normalize()
if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
return;
- len = sqrt(len);
+ len = std::sqrt(len);
xp = float(double(xp) / len);
yp = float(double(yp) / len);
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index c23e0c28ea..576558022e 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -462,8 +462,8 @@ void QOpenGL2PaintEngineExPrivate::updateMatrix()
// anti-aliased text rendering. In such cases, we snap the translate to the pixel grid.
if (snapToPixelGrid && transform.type() == QTransform::TxTranslate) {
// 0.50 needs to rounded down to 0.0 for consistency with raster engine:
- dx = ceilf(dx - 0.5f);
- dy = ceilf(dy - 0.5f);
+ dx = std::ceil(dx - 0.5f);
+ dy = std::ceil(dy - 0.5f);
}
pmvMatrix[0][0] = (wfactor * transform.m11()) - transform.m13();
pmvMatrix[1][0] = (wfactor * transform.m21()) - transform.m23();
diff --git a/src/gui/opengl/qtriangulatingstroker_p.h b/src/gui/opengl/qtriangulatingstroker_p.h
index 2561810d7a..dd46cbe1e5 100644
--- a/src/gui/opengl/qtriangulatingstroker_p.h
+++ b/src/gui/opengl/qtriangulatingstroker_p.h
@@ -134,11 +134,11 @@ inline void QTriangulatingStroker::normalVector(float x1, float y1, float x2, fl
float pw;
if (dx == 0)
- pw = m_width / qAbs(dy);
+ pw = m_width / std::abs(dy);
else if (dy == 0)
- pw = m_width / qAbs(dx);
+ pw = m_width / std::abs(dx);
else
- pw = m_width / sqrt(dx*dx + dy*dy);
+ pw = m_width / std::sqrt(dx*dx + dy*dy);
*nx = -dy * pw;
*ny = dx * pw;
diff --git a/src/gui/opengl/qtriangulator.cpp b/src/gui/opengl/qtriangulator.cpp
index b0d754b87e..6574fe9975 100644
--- a/src/gui/opengl/qtriangulator.cpp
+++ b/src/gui/opengl/qtriangulator.cpp
@@ -49,8 +49,6 @@
#include <private/qopenglextensions_p.h>
#include <private/qrbtree_p.h>
-#include <math.h>
-
QT_BEGIN_NAMESPACE
//#define Q_TRIANGULATOR_DEBUG
@@ -1700,8 +1698,8 @@ void QTriangulator<T>::ComplexToSimple::DebugDialog::paintEvent(QPaintEvent *)
QPodPoint q = vertices.at(splits.at(i).vertex);
QPodPoint u = vertices.at(edges.at(splits.at(i).edge).from) - q;
QPodPoint v = vertices.at(edges.at(splits.at(i).edge).to) - q;
- qreal uLen = sqrt(qreal(qDot(u, u)));
- qreal vLen = sqrt(qreal(qDot(v, v)));
+ qreal uLen = qSqrt(qDot(u, u));
+ qreal vLen = qSqrt(qDot(v, v));
if (uLen) {
u.x *= 2 * halfPointSize / uLen;
u.y *= 2 * halfPointSize / uLen;
@@ -1719,7 +1717,7 @@ void QTriangulator<T>::ComplexToSimple::DebugDialog::paintEvent(QPaintEvent *)
template <typename T>
void QTriangulator<T>::ComplexToSimple::DebugDialog::wheelEvent(QWheelEvent *event)
{
- qreal scale = exp(-0.001 * event->delta());
+ qreal scale = qExp(-0.001 * event->delta());
QPointF center = m_window.center();
QPointF delta = scale * (m_window.bottomRight() - center);
m_window = QRectF(center - delta, center + delta);
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index f461dfef06..84063eb692 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -1684,7 +1684,7 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
b++;
fx += fdx;
}
- } else if ((fdx < 0 && fdx > -(fixed_scale / 8)) || fabs(data->m22) < (1./8.)) { // scale up more than 8x
+ } else if ((fdx < 0 && fdx > -(fixed_scale / 8)) || std::abs(data->m22) < (1./8.)) { // scale up more than 8x
int y1 = (fy >> 16);
int y2;
fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2);
@@ -1843,7 +1843,7 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
}
}
} else { //rotation
- if (fabs(data->m11) > 8 || fabs(data->m22) > 8) {
+ if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) {
//if we are zooming more than 8 times, we use 8bit precision for the position.
while (b < end) {
int x1 = (fx >> 16);
@@ -2196,7 +2196,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut);
layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut);
- if ((fdx < 0 && fdx > -(fixed_scale / 8)) || fabs(data->m22) < (1./8.)) { // scale up more than 8x
+ if ((fdx < 0 && fdx > -(fixed_scale / 8)) || std::abs(data->m22) < (1./8.)) { // scale up more than 8x
int disty = (fy & 0x0000ffff) >> 8;
for (int i = 0; i < len; ++i) {
uint tl = buf1[i * 2 + 0];
@@ -2255,7 +2255,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut);
layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut);
- if (fabs(data->m11) > 8 || fabs(data->m22) > 8) {
+ if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) {
//if we are zooming more than 8 times, we use 8bit precision for the position.
for (int i = 0; i < len; ++i) {
uint tl = buf1[i * 2 + 0];
diff --git a/src/gui/painting/qmath_p.h b/src/gui/painting/qmath_p.h
index 50a49c2cb5..9cb64a46cb 100644
--- a/src/gui/painting/qmath_p.h
+++ b/src/gui/painting/qmath_p.h
@@ -45,14 +45,13 @@
// We mean it.
//
-#include <math.h>
#include <qmath.h>
QT_BEGIN_NAMESPACE
-static const qreal Q_PI = qreal(3.14159265358979323846); // pi
-static const qreal Q_2PI = qreal(6.28318530717958647693); // 2*pi
-static const qreal Q_PI2 = qreal(1.57079632679489661923); // pi/2
+static const qreal Q_PI = qreal(M_PI); // pi
+static const qreal Q_2PI = qreal(2 * M_PI); // 2*pi
+static const qreal Q_PI2 = qreal(M_PI_2); // pi/2
static const qreal Q_MM_PER_INCH = 25.4;
inline int qIntSqrtInt(int v)
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index 426dd846ed..75bf31cde1 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -712,20 +712,10 @@ static inline bool q26Dot6Compare(qreal p1, qreal p2)
return int((p2 - p1) * 64.) == 0;
}
-static inline qreal qFloorF(qreal v)
-{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return floorf(v);
- else
-#endif
- return floor(v);
-}
-
static inline QPointF snapTo26Dot6Grid(const QPointF &p)
{
- return QPointF(qFloorF(p.x() * 64) * (1 / qreal(64)),
- qFloorF(p.y() * 64) * (1 / qreal(64)));
+ return QPointF(std::floor(p.x() * 64) * (1 / qreal(64)),
+ std::floor(p.y() * 64) * (1 / qreal(64)));
}
/*
@@ -832,7 +822,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
return;
// adjust width which is given relative to |b - a|
- width *= sqrt(w0 / w);
+ width *= qSqrt(w0 / w);
}
QSpanBuffer buffer(d->blend, d->data, d->clipRect);
diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp
index 49ec31fc19..471a39a6e1 100644
--- a/src/gui/text/qdistancefield.cpp
+++ b/src/gui/text/qdistancefield.cpp
@@ -509,8 +509,8 @@ static void makeDistanceField(QDistanceFieldData *data, const QPainterPath &path
bits[i] = exteriorColor;
const qreal angleStep = qreal(15 * 3.141592653589793238 / 180);
- const QPoint rotation(qRound(cos(angleStep) * 0x4000),
- qRound(sin(angleStep) * 0x4000)); // 2:14 signed
+ const QPoint rotation(qRound(qCos(angleStep) * 0x4000),
+ qRound(qSin(angleStep) * 0x4000)); // 2:14 signed
const quint32 *indices = pathIndices.data();
QVarLengthArray<QPoint> normals;
@@ -544,7 +544,7 @@ static void makeDistanceField(QDistanceFieldData *data, const QPainterPath &path
QPoint n(to.y() - from.y(), from.x() - to.x());
if (n.x() == 0 && n.y() == 0)
continue;
- int scale = qRound((offs << 16) / sqrt(qreal(n.x() * n.x() + n.y() * n.y()))); // 8:16
+ int scale = qRound((offs << 16) / qSqrt(qreal(n.x() * n.x() + n.y() * n.y()))); // 8:16
n.rx() = n.x() * scale >> 8;
n.ry() = n.y() * scale >> 8;
normals.append(n);
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 211b8b6659..1cdbf6aa8e 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -2640,7 +2640,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
QFontDef req = d->request;
if (req.pixelSize == -1) {
- req.pixelSize = floor(((req.pointSize * d->dpi) / 72) * 100 + 0.5) / 100;
+ req.pixelSize = std::floor(((req.pointSize * d->dpi) / 72) * 100 + 0.5) / 100;
req.pixelSize = qRound(req.pixelSize);
}
if (req.pointSize < 0)
diff --git a/src/gui/util/qgridlayoutengine.cpp b/src/gui/util/qgridlayoutengine.cpp
index 5b98001b38..df8dab2903 100644
--- a/src/gui/util/qgridlayoutengine.cpp
+++ b/src/gui/util/qgridlayoutengine.cpp
@@ -193,7 +193,7 @@ namespace {
// does not return int
static inline qreal qround(qreal f)
{
- return floor(f + 0.5);
+ return std::floor(f + qreal(0.5));
}
}
@@ -355,7 +355,7 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz
qreal maxBoxSize = box.q_maximumSize;
if (snapToPixelGrid)
- maxBoxSize = qMax(box.q_minimumSize, floor(maxBoxSize));
+ maxBoxSize = qMax(box.q_minimumSize, std::floor(maxBoxSize));
qreal avail = sumCurrentAvailable * factors[i] / sumFactors;
if (sizes[i] + avail >= maxBoxSize) {
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp
index dcb1f9817f..6b1e20c844 100644
--- a/src/gui/util/qvalidator.cpp
+++ b/src/gui/util/qvalidator.cpp
@@ -40,7 +40,7 @@
#include "private/qlocale_p.h"
#include <limits.h>
-#include <math.h>
+#include <cmath>
QT_BEGIN_NAMESPACE
@@ -384,7 +384,7 @@ static int numDigits(qlonglong n)
{
if (n == 0)
return 1;
- return (int)log10(double(n)) + 1;
+ return (int)std::log10(double(n)) + 1;
}
static qlonglong pow10(int exp)