From 143be951b1fe8316b0dffb9010810c9cb1941ee0 2015-04-23 09:54:21 From: Titta Heikkala Date: 2015-04-23 09:54:21 Subject: [PATCH] Fix QNX build issue Use qmath and cmath methods instead of math.h methods. Change-Id: I7c853f2e1218a1d3cde15a089192c24a6b0b1395 Reviewed-by: Miikka Heikkinen --- diff --git a/src/charts/axis/barcategoryaxis/chartbarcategoryaxisx.cpp b/src/charts/axis/barcategoryaxis/chartbarcategoryaxisx.cpp index 00db60e..3d245b9 100644 --- a/src/charts/axis/barcategoryaxis/chartbarcategoryaxisx.cpp +++ b/src/charts/axis/barcategoryaxis/chartbarcategoryaxisx.cpp @@ -48,7 +48,7 @@ QVector ChartBarCategoryAxisX::calculateLayout() const return points; qreal adjustedMin = min() + 0.5; - qreal offset = (ceil(adjustedMin) - adjustedMin) * delta; + qreal offset = (qCeil(adjustedMin) - adjustedMin) * delta; int count = qFloor(range); if (count < 1) diff --git a/src/charts/axis/barcategoryaxis/chartbarcategoryaxisy.cpp b/src/charts/axis/barcategoryaxis/chartbarcategoryaxisy.cpp index 536ca59..620d876 100644 --- a/src/charts/axis/barcategoryaxis/chartbarcategoryaxisy.cpp +++ b/src/charts/axis/barcategoryaxis/chartbarcategoryaxisy.cpp @@ -48,7 +48,7 @@ QVector ChartBarCategoryAxisY::calculateLayout() const return points; qreal adjustedMin = min() + 0.5; - qreal offset = (ceil(adjustedMin) - adjustedMin) * delta; + qreal offset = (qCeil(adjustedMin) - adjustedMin) * delta; int count = qFloor(range); if (count < 1) diff --git a/src/charts/axis/chartaxiselement.cpp b/src/charts/axis/chartaxiselement.cpp index be07d14..d2ff57f 100644 --- a/src/charts/axis/chartaxiselement.cpp +++ b/src/charts/axis/chartaxiselement.cpp @@ -23,6 +23,7 @@ #include #include #include +#include QT_CHARTS_BEGIN_NAMESPACE @@ -271,7 +272,7 @@ QStringList ChartAxisElement::createValueLabels(qreal min, qreal max, int ticks, return labels; if (format.isNull()) { - int n = qMax(int(-qFloor(log10((max - min) / (ticks - 1)))), 0) + 1; + int n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0) + 1; for (int i = 0; i < ticks; i++) { qreal value = min + (i * (max - min) / (ticks - 1)); labels << presenter()->numberToString(value, 'f', n); @@ -318,14 +319,14 @@ QStringList ChartAxisElement::createLogValueLabels(qreal min, qreal max, qreal b int firstTick; if (base > 1) - firstTick = ceil(log10(min) / log10(base)); + firstTick = qCeil(std::log10(min) / std::log10(base)); else - firstTick = ceil(log10(max) / log10(base)); + firstTick = qCeil(std::log10(max) / std::log10(base)); if (format.isNull()) { int n = 0; if (ticks > 1) - n = qMax(int(-qFloor(log10((max - min) / (ticks - 1)))), 0); + n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0); n++; for (int i = firstTick; i < ticks + firstTick; i++) { qreal value = qPow(base, i); @@ -371,7 +372,7 @@ QStringList ChartAxisElement::createDateTimeLabels(qreal min, qreal max,int tick if (max <= min || ticks < 1) return labels; - int n = qMax(int(-floor(log10((max - min) / (ticks - 1)))), 0); + int n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0); n++; for (int i = 0; i < ticks; i++) { qreal value = min + (i * (max - min) / (ticks - 1)); diff --git a/src/charts/axis/logvalueaxis/chartlogvalueaxisx.cpp b/src/charts/axis/logvalueaxis/chartlogvalueaxisx.cpp index 30d1a6b..ed401ed 100644 --- a/src/charts/axis/logvalueaxis/chartlogvalueaxisx.cpp +++ b/src/charts/axis/logvalueaxis/chartlogvalueaxisx.cpp @@ -23,6 +23,7 @@ #include #include #include +#include QT_CHARTS_BEGIN_NAMESPACE @@ -42,11 +43,11 @@ QVector ChartLogValueAxisX::calculateLayout() const { QVector points; - qreal logMax = log10(m_axis->max()) / log10(m_axis->base()); - qreal logMin = log10(m_axis->min()) / log10(m_axis->base()); + qreal logMax = std::log10(m_axis->max()) / std::log10(m_axis->base()); + qreal logMin = std::log10(m_axis->min()) / std::log10(m_axis->base()); qreal leftEdge = logMin < logMax ? logMin : logMax; - qreal ceilEdge = ceil(leftEdge); - int tickCount = qAbs(ceil(logMax) - ceil(logMin)); + qreal ceilEdge = qCeil(leftEdge); + int tickCount = qAbs(qCeil(logMax) - qCeil(logMin)); points.resize(tickCount); const QRectF &gridRect = gridGeometry(); @@ -86,9 +87,9 @@ QSizeF ChartLogValueAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint QSizeF base = HorizontalAxis::sizeHint(which, constraint); QStringList ticksList; - qreal logMax = log10(m_axis->max()) / log10(m_axis->base()); - qreal logMin = log10(m_axis->min()) / log10(m_axis->base()); - int tickCount = qAbs(ceil(logMax) - ceil(logMin)); + qreal logMax = std::log10(m_axis->max()) / std::log10(m_axis->base()); + qreal logMin = std::log10(m_axis->min()) / std::log10(m_axis->base()); + int tickCount = qAbs(qCeil(logMax) - qCeil(logMin)); if (m_axis->max() > m_axis->min() && tickCount > 0) ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat()); else diff --git a/src/charts/axis/logvalueaxis/chartlogvalueaxisy.cpp b/src/charts/axis/logvalueaxis/chartlogvalueaxisy.cpp index 0fc7329..f056776 100644 --- a/src/charts/axis/logvalueaxis/chartlogvalueaxisy.cpp +++ b/src/charts/axis/logvalueaxis/chartlogvalueaxisy.cpp @@ -23,6 +23,7 @@ #include #include #include +#include QT_CHARTS_BEGIN_NAMESPACE @@ -41,11 +42,11 @@ ChartLogValueAxisY::~ChartLogValueAxisY() QVector ChartLogValueAxisY::calculateLayout() const { QVector points; - qreal logMax = log10(m_axis->max()) / log10(m_axis->base()); - qreal logMin = log10(m_axis->min()) / log10(m_axis->base()); + qreal logMax = std::log10(m_axis->max()) / std::log10(m_axis->base()); + qreal logMin = std::log10(m_axis->min()) / std::log10(m_axis->base()); qreal leftEdge = logMin < logMax ? logMin : logMax; - qreal ceilEdge = ceil(leftEdge); - int tickCount = qAbs(ceil(logMax) - ceil(logMin)); + qreal ceilEdge = qCeil(leftEdge); + int tickCount = qAbs(qCeil(logMax) - qCeil(logMin)); points.resize(tickCount); const QRectF &gridRect = gridGeometry(); @@ -86,9 +87,9 @@ QSizeF ChartLogValueAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint QSizeF base = VerticalAxis::sizeHint(which, constraint); QStringList ticksList; - qreal logMax = log10(m_axis->max()) / log10(m_axis->base()); - qreal logMin = log10(m_axis->min()) / log10(m_axis->base()); - int tickCount = qAbs(ceil(logMax) - ceil(logMin)); + qreal logMax = std::log10(m_axis->max()) / std::log10(m_axis->base()); + qreal logMin = std::log10(m_axis->min()) / std::log10(m_axis->base()); + int tickCount = qAbs(qCeil(logMax) - qCeil(logMin)); if (m_axis->max() > m_axis->min() && tickCount > 0) ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat()); else diff --git a/src/charts/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp b/src/charts/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp index 7e75764..8da03cf 100644 --- a/src/charts/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp +++ b/src/charts/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp @@ -22,6 +22,7 @@ #include #include #include +#include QT_CHARTS_BEGIN_NAMESPACE @@ -39,12 +40,12 @@ PolarChartLogValueAxisAngular::~PolarChartLogValueAxisAngular() QVector PolarChartLogValueAxisAngular::calculateLayout() const { QLogValueAxis *logValueAxis = static_cast(axis()); - const qreal logMax = log10(logValueAxis->max()) / log10(logValueAxis->base()); - const qreal logMin = log10(logValueAxis->min()) / log10(logValueAxis->base()); + const qreal logMax = std::log10(logValueAxis->max()) / std::log10(logValueAxis->base()); + const qreal logMin = std::log10(logValueAxis->min()) / std::log10(logValueAxis->base()); const qreal startEdge = logMin < logMax ? logMin : logMax; const qreal delta = 360.0 / qAbs(logMax - logMin); - const qreal initialSpan = (ceil(startEdge) - startEdge) * delta; - int tickCount = qAbs(ceil(logMax) - ceil(logMin)); + const qreal initialSpan = (qCeil(startEdge) - startEdge) * delta; + int tickCount = qAbs(qCeil(logMax) - qCeil(logMin)); QVector points; points.resize(tickCount); diff --git a/src/charts/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp b/src/charts/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp index 9c9fa03..97643c0 100644 --- a/src/charts/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp +++ b/src/charts/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp @@ -22,6 +22,7 @@ #include #include #include +#include QT_CHARTS_BEGIN_NAMESPACE @@ -39,16 +40,16 @@ PolarChartLogValueAxisRadial::~PolarChartLogValueAxisRadial() QVector PolarChartLogValueAxisRadial::calculateLayout() const { QLogValueAxis *logValueAxis = static_cast(axis()); - const qreal logMax = log10(logValueAxis->max()) / log10(logValueAxis->base()); - const qreal logMin = log10(logValueAxis->min()) / log10(logValueAxis->base()); + const qreal logMax = std::log10(logValueAxis->max()) / std::log10(logValueAxis->base()); + const qreal logMin = std::log10(logValueAxis->min()) / std::log10(logValueAxis->base()); const qreal innerEdge = logMin < logMax ? logMin : logMax; const qreal outerEdge = logMin > logMax ? logMin : logMax; const qreal delta = (axisGeometry().width() / 2.0) / qAbs(logMax - logMin); - const qreal initialSpan = (ceil(innerEdge) - innerEdge) * delta; - int tickCount = qAbs(ceil(logMax) - ceil(logMin)); + const qreal initialSpan = (qCeil(innerEdge) - innerEdge) * delta; + int tickCount = qAbs(qCeil(logMax) - qCeil(logMin)); // Extra tick if outer edge is exactly at the tick - if (outerEdge == ceil(outerEdge)) + if (outerEdge == qCeil(outerEdge)) tickCount++; QVector points; diff --git a/src/charts/domain/abstractdomain.cpp b/src/charts/domain/abstractdomain.cpp index 842ffed..1ef6c77 100644 --- a/src/charts/domain/abstractdomain.cpp +++ b/src/charts/domain/abstractdomain.cpp @@ -19,6 +19,7 @@ #include #include #include +#include QT_CHARTS_BEGIN_NAMESPACE @@ -173,7 +174,7 @@ void AbstractDomain::looseNiceNumbers(qreal &min, qreal &max, int &ticksCount) qreal AbstractDomain::niceNumber(qreal x, bool ceiling) { - qreal z = qPow(10, qFloor(log10(x))); //find corresponding number of the form of 10^n than is smaller than x + qreal z = qPow(10, qFloor(std::log10(x))); //find corresponding number of the form of 10^n than is smaller than x qreal q = x / z; //q<10 && q>=1; if (ceiling) { diff --git a/src/charts/domain/logxlogydomain.cpp b/src/charts/domain/logxlogydomain.cpp index 88fceeb..5d08de2 100644 --- a/src/charts/domain/logxlogydomain.cpp +++ b/src/charts/domain/logxlogydomain.cpp @@ -20,6 +20,7 @@ #include #include #include +#include QT_CHARTS_BEGIN_NAMESPACE @@ -50,8 +51,8 @@ void LogXLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) m_minX = minX; m_maxX = maxX; axisXChanged = true; - qreal logMinX = log10(m_minX) / log10(m_logBaseX); - qreal logMaxX = log10(m_maxX) / log10(m_logBaseX); + qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX); + qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX); m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX; m_logRightX = logMinX > logMaxX ? logMinX : logMaxX; if(!m_signalsBlocked) @@ -62,8 +63,8 @@ void LogXLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) m_minY = minY; m_maxY = maxY; axisYChanged = true; - qreal logMinY = log10(m_minY) / log10(m_logBaseY); - qreal logMaxY = log10(m_maxY) / log10(m_logBaseY); + qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY); + qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY); m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY; m_logRightY = logMinY > logMaxY ? logMinY : logMaxY; if (!m_signalsBlocked) @@ -141,18 +142,18 @@ QPointF LogXLogYDomain::calculateGeometryPoint(const QPointF &point, bool &ok) c qreal x(0); qreal y(0); if (point.x() > 0 && point.y() > 0) { - x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX; - y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height(); + x = (std::log10(point.x()) / std::log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX; + y = (std::log10(point.y()) / std::log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height(); ok = true; } else { qWarning() << "Logarithms of zero and negative values are undefined."; ok = false; if (point.x() > 0) - x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX; + x = (std::log10(point.x()) / std::log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX; else x = 0; if (point.y() > 0) { - y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + y = (std::log10(point.y()) / std::log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height(); } else { y = m_size.height(); @@ -171,8 +172,8 @@ QVector LogXLogYDomain::calculateGeometryPoints(const QList &v for (int i = 0; i < vector.count(); ++i) { if (vector[i].x() > 0 && vector[i].y() > 0) { - qreal x = (log10(vector[i].x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX; - qreal y = (log10(vector[i].y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height(); + qreal x = (std::log10(vector[i].x()) / std::log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX; + qreal y = (std::log10(vector[i].y()) / std::log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height(); result[i].setX(x); result[i].setY(y); } else { @@ -227,8 +228,8 @@ bool LogXLogYDomain::detachAxis(QAbstractAxis *axis) void LogXLogYDomain::handleVerticalAxisBaseChanged(qreal baseY) { m_logBaseY = baseY; - qreal logMinY = log10(m_minY) / log10(m_logBaseY); - qreal logMaxY = log10(m_maxY) / log10(m_logBaseY); + qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY); + qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY); m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY; m_logRightY = logMinY > logMaxY ? logMinY : logMaxY; emit updated(); @@ -237,8 +238,8 @@ void LogXLogYDomain::handleVerticalAxisBaseChanged(qreal baseY) void LogXLogYDomain::handleHorizontalAxisBaseChanged(qreal baseX) { m_logBaseX = baseX; - qreal logMinX = log10(m_minX) / log10(m_logBaseX); - qreal logMaxX = log10(m_maxX) / log10(m_logBaseX); + qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX); + qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX); m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX; m_logRightX = logMinX > logMaxX ? logMinX : logMaxX; emit updated(); diff --git a/src/charts/domain/logxlogypolardomain.cpp b/src/charts/domain/logxlogypolardomain.cpp index efd9bb9..b14e04e 100644 --- a/src/charts/domain/logxlogypolardomain.cpp +++ b/src/charts/domain/logxlogypolardomain.cpp @@ -20,6 +20,7 @@ #include #include #include +#include QT_CHARTS_BEGIN_NAMESPACE @@ -50,8 +51,8 @@ void LogXLogYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal max m_minX = minX; m_maxX = maxX; axisXChanged = true; - qreal logMinX = log10(m_minX) / log10(m_logBaseX); - qreal logMaxX = log10(m_maxX) / log10(m_logBaseX); + qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX); + qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX); m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX; m_logRightX = logMinX > logMaxX ? logMinX : logMaxX; if (!m_signalsBlocked) @@ -62,8 +63,8 @@ void LogXLogYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal max m_minY = minY; m_maxY = maxY; axisYChanged = true; - qreal logMinY = log10(m_minY) / log10(m_logBaseY); - qreal logMaxY = log10(m_maxY) / log10(m_logBaseY); + qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY); + qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY); m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY; m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY; if (!m_signalsBlocked) @@ -143,7 +144,7 @@ qreal LogXLogYPolarDomain::toAngularCoordinate(qreal value, bool &ok) const } else { ok = true; const qreal tickSpan = 360.0 / qAbs(m_logRightX - m_logLeftX); - const qreal logValue = log10(value) / log10(m_logBaseX); + const qreal logValue = std::log10(value) / std::log10(m_logBaseX); const qreal valueDelta = logValue - m_logLeftX; retVal = valueDelta * tickSpan; @@ -160,7 +161,7 @@ qreal LogXLogYPolarDomain::toRadialCoordinate(qreal value, bool &ok) const } else { ok = true; const qreal tickSpan = m_radius / qAbs(m_logOuterY - m_logInnerY); - const qreal logValue = log10(value) / log10(m_logBaseY); + const qreal logValue = std::log10(value) / std::log10(m_logBaseY); const qreal valueDelta = logValue - m_logInnerY; retVal = valueDelta * tickSpan; @@ -222,8 +223,8 @@ bool LogXLogYPolarDomain::detachAxis(QAbstractAxis *axis) void LogXLogYPolarDomain::handleHorizontalAxisBaseChanged(qreal baseX) { m_logBaseX = baseX; - qreal logMinX = log10(m_minX) / log10(m_logBaseX); - qreal logMaxX = log10(m_maxX) / log10(m_logBaseX); + qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX); + qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX); m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX; m_logRightX = logMinX > logMaxX ? logMinX : logMaxX; emit updated(); @@ -232,8 +233,8 @@ void LogXLogYPolarDomain::handleHorizontalAxisBaseChanged(qreal baseX) void LogXLogYPolarDomain::handleVerticalAxisBaseChanged(qreal baseY) { m_logBaseY = baseY; - qreal logMinY = log10(m_minY) / log10(m_logBaseY); - qreal logMaxY = log10(m_maxY) / log10(m_logBaseY); + qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY); + qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY); m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY; m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY; emit updated(); diff --git a/src/charts/domain/logxydomain.cpp b/src/charts/domain/logxydomain.cpp index c51eb0b..268b31e 100644 --- a/src/charts/domain/logxydomain.cpp +++ b/src/charts/domain/logxydomain.cpp @@ -20,6 +20,7 @@ #include #include #include +#include QT_CHARTS_BEGIN_NAMESPACE @@ -46,8 +47,8 @@ void LogXYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) m_minX = minX; m_maxX = maxX; axisXChanged = true; - qreal logMinX = log10(m_minX) / log10(m_logBaseX); - qreal logMaxX = log10(m_maxX) / log10(m_logBaseX); + qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX); + qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX); m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX; m_logRightX = logMinX > logMaxX ? logMinX : logMaxX; if(!m_signalsBlocked) @@ -135,7 +136,7 @@ QPointF LogXYDomain::calculateGeometryPoint(const QPointF &point, bool &ok) cons qreal x(0); qreal y = (point.y() - m_minY) * -deltaY + m_size.height(); if (point.x() > 0) { - x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX; + x = (std::log10(point.x()) / std::log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX; ok = true; } else { x = 0; @@ -155,7 +156,7 @@ QVector LogXYDomain::calculateGeometryPoints(const QList &vect for (int i = 0; i < vector.count(); ++i) { if (vector[i].x() > 0) { - qreal x = (log10(vector[i].x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX; + qreal x = (std::log10(vector[i].x()) / std::log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX; qreal y = (vector[i].y() - m_minY) * -deltaY + m_size.height(); result[i].setX(x); result[i].setY(y); @@ -204,8 +205,8 @@ bool LogXYDomain::detachAxis(QAbstractAxis *axis) void LogXYDomain::handleHorizontalAxisBaseChanged(qreal baseX) { m_logBaseX = baseX; - qreal logMinX = log10(m_minX) / log10(m_logBaseX); - qreal logMaxX = log10(m_maxX) / log10(m_logBaseX); + qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX); + qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX); m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX; m_logRightX = logMinX > logMaxX ? logMinX : logMaxX; emit updated(); diff --git a/src/charts/domain/logxypolardomain.cpp b/src/charts/domain/logxypolardomain.cpp index 8ca9f02..842f069 100644 --- a/src/charts/domain/logxypolardomain.cpp +++ b/src/charts/domain/logxypolardomain.cpp @@ -20,6 +20,7 @@ #include #include #include +#include QT_CHARTS_BEGIN_NAMESPACE @@ -46,8 +47,8 @@ void LogXYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) m_minX = minX; m_maxX = maxX; axisXChanged = true; - qreal logMinX = log10(m_minX) / log10(m_logBaseX); - qreal logMaxX = log10(m_maxX) / log10(m_logBaseX); + qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX); + qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX); m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX; m_logRightX = logMinX > logMaxX ? logMinX : logMaxX; if (!m_signalsBlocked) @@ -136,7 +137,7 @@ qreal LogXYPolarDomain::toAngularCoordinate(qreal value, bool &ok) const } else { ok = true; const qreal tickSpan = 360.0 / qAbs(m_logRightX - m_logLeftX); - const qreal logValue = log10(value) / log10(m_logBaseX); + const qreal logValue = std::log10(value) / std::log10(m_logBaseX); const qreal valueDelta = logValue - m_logLeftX; retVal = valueDelta * tickSpan; @@ -201,8 +202,8 @@ bool LogXYPolarDomain::detachAxis(QAbstractAxis *axis) void LogXYPolarDomain::handleHorizontalAxisBaseChanged(qreal baseX) { m_logBaseX = baseX; - qreal logMinX = log10(m_minX) / log10(m_logBaseX); - qreal logMaxX = log10(m_maxX) / log10(m_logBaseX); + qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX); + qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX); m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX; m_logRightX = logMinX > logMaxX ? logMinX : logMaxX; emit updated(); diff --git a/src/charts/domain/xlogydomain.cpp b/src/charts/domain/xlogydomain.cpp index 282c6cf..dcc460b 100644 --- a/src/charts/domain/xlogydomain.cpp +++ b/src/charts/domain/xlogydomain.cpp @@ -20,6 +20,7 @@ #include #include #include +#include QT_CHARTS_BEGIN_NAMESPACE @@ -54,8 +55,8 @@ void XLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) m_minY = minY; m_maxY = maxY; axisYChanged = true; - qreal logMinY = log10(m_minY) / log10(m_logBaseY); - qreal logMaxY = log10(m_maxY) / log10(m_logBaseY); + qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY); + qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY); m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY; m_logRightY = logMinY > logMaxY ? logMinY : logMaxY; if (!m_signalsBlocked) @@ -135,7 +136,7 @@ QPointF XLogYDomain::calculateGeometryPoint(const QPointF &point, bool &ok) cons qreal x = (point.x() - m_minX) * deltaX; qreal y(0); if (point.y() > 0) { - y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height(); + y = (std::log10(point.y()) / std::log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height(); ok = true; } else { y = m_size.height(); @@ -156,7 +157,7 @@ QVector XLogYDomain::calculateGeometryPoints(const QList &vect for (int i = 0; i < vector.count(); ++i) { if (vector[i].y() > 0) { qreal x = (vector[i].x() - m_minX) * deltaX; - qreal y = (log10(vector[i].y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height(); + qreal y = (std::log10(vector[i].y()) / std::log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height(); result[i].setX(x); result[i].setY(y); } else { @@ -200,8 +201,8 @@ bool XLogYDomain::detachAxis(QAbstractAxis *axis) void XLogYDomain::handleVerticalAxisBaseChanged(qreal baseY) { m_logBaseY = baseY; - qreal logMinY = log10(m_minY) / log10(m_logBaseY); - qreal logMaxY = log10(m_maxY) / log10(m_logBaseY); + qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY); + qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY); m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY; m_logRightY = logMinY > logMaxY ? logMinY : logMaxY; emit updated(); diff --git a/src/charts/domain/xlogypolardomain.cpp b/src/charts/domain/xlogypolardomain.cpp index 769c95f..58d8df3 100644 --- a/src/charts/domain/xlogypolardomain.cpp +++ b/src/charts/domain/xlogypolardomain.cpp @@ -20,6 +20,7 @@ #include #include #include +#include QT_CHARTS_BEGIN_NAMESPACE @@ -54,8 +55,8 @@ void XLogYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) m_minY = minY; m_maxY = maxY; axisYChanged = true; - qreal logMinY = log10(m_minY) / log10(m_logBaseY); - qreal logMaxY = log10(m_maxY) / log10(m_logBaseY); + qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY); + qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY); m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY; m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY; if (!m_signalsBlocked) @@ -144,7 +145,7 @@ qreal XLogYPolarDomain::toRadialCoordinate(qreal value, bool &ok) const } else { ok = true; const qreal tickSpan = m_radius / qAbs(m_logOuterY - m_logInnerY); - const qreal logValue = log10(value) / log10(m_logBaseY); + const qreal logValue = std::log10(value) / std::log10(m_logBaseY); const qreal valueDelta = logValue - m_logInnerY; retVal = valueDelta * tickSpan; @@ -196,8 +197,8 @@ bool XLogYPolarDomain::detachAxis(QAbstractAxis *axis) void XLogYPolarDomain::handleVerticalAxisBaseChanged(qreal baseY) { m_logBaseY = baseY; - qreal logMinY = log10(m_minY) / log10(m_logBaseY); - qreal logMaxY = log10(m_maxY) / log10(m_logBaseY); + qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY); + qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY); m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY; m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY; emit updated();