diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/charts/domain/logxlogydomain.cpp | 10 | ||||
-rw-r--r-- | src/charts/domain/logxydomain.cpp | 10 | ||||
-rw-r--r-- | src/charts/domain/xlogydomain.cpp | 6 | ||||
-rw-r--r-- | src/charts/qchart.cpp | 1 | ||||
-rw-r--r-- | src/chartsqml2/declarativechart.cpp | 1 |
5 files changed, 24 insertions, 4 deletions
diff --git a/src/charts/domain/logxlogydomain.cpp b/src/charts/domain/logxlogydomain.cpp index 04ba559f..2c8cd1b8 100644 --- a/src/charts/domain/logxlogydomain.cpp +++ b/src/charts/domain/logxlogydomain.cpp @@ -115,9 +115,9 @@ void LogXLogYDomain::zoomOut(const QRectF &rect) const qreal factorY = m_size.height() / fixedRect.height(); qreal logLeftX = m_logLeftX + (m_logRightX - m_logLeftX) / 2 * (1 - factorX); - qreal logRIghtX = m_logLeftX + (m_logRightX - m_logLeftX) / 2 * (1 + factorX); + qreal logRightX = m_logLeftX + (m_logRightX - m_logLeftX) / 2 * (1 + factorX); qreal leftX = qPow(m_logBaseX, logLeftX); - qreal rightX = qPow(m_logBaseX, logRIghtX); + qreal rightX = qPow(m_logBaseX, logRightX); qreal minX = leftX < rightX ? leftX : rightX; qreal maxX = leftX > rightX ? leftX : rightX; @@ -128,6 +128,12 @@ void LogXLogYDomain::zoomOut(const QRectF &rect) qreal minY = leftY < rightY ? leftY : rightY; qreal maxY = leftY > rightY ? leftY : rightY; + if (logRightX > m_size.width() || newLogMaxY > m_size.height()) + return; + + if (qIsInf(maxX) || qIsInf(maxY)) + return; + setRange(minX, maxX, minY, maxY); } diff --git a/src/charts/domain/logxydomain.cpp b/src/charts/domain/logxydomain.cpp index fb77656c..aedfb7f3 100644 --- a/src/charts/domain/logxydomain.cpp +++ b/src/charts/domain/logxydomain.cpp @@ -106,9 +106,9 @@ void LogXYDomain::zoomOut(const QRectF &rect) const qreal factorX = m_size.width() / fixedRect.width(); qreal logLeftX = m_logLeftX + (m_logRightX - m_logLeftX) / 2 * (1 - factorX); - qreal logRIghtX = m_logLeftX + (m_logRightX - m_logLeftX) / 2 * (1 + factorX); + qreal logRightX = m_logLeftX + (m_logRightX - m_logLeftX) / 2 * (1 + factorX); qreal leftX = qPow(m_logBaseX, logLeftX); - qreal rightX = qPow(m_logBaseX, logRIghtX); + qreal rightX = qPow(m_logBaseX, logRightX); qreal minX = leftX < rightX ? leftX : rightX; qreal maxX = leftX > rightX ? leftX : rightX; @@ -119,6 +119,12 @@ void LogXYDomain::zoomOut(const QRectF &rect) maxY = minY + dy * fixedRect.bottom(); minY = maxY - dy * m_size.height(); + if (logRightX > m_size.width()) + return; + + if (qIsInf(maxX)) + return; + setRange(minX, maxX, minY, maxY); } diff --git a/src/charts/domain/xlogydomain.cpp b/src/charts/domain/xlogydomain.cpp index 0cd995f3..19dd5ca5 100644 --- a/src/charts/domain/xlogydomain.cpp +++ b/src/charts/domain/xlogydomain.cpp @@ -118,6 +118,12 @@ void XLogYDomain::zoomOut(const QRectF &rect) qreal minY = leftY < rightY ? leftY : rightY; qreal maxY = leftY > rightY ? leftY : rightY; + if (newLogMaxY > m_size.height()) + return; + + if (qIsInf(maxY)) + return; + setRange(minX, maxX, minY, maxY); } diff --git a/src/charts/qchart.cpp b/src/charts/qchart.cpp index 703e6625..743fea6d 100644 --- a/src/charts/qchart.cpp +++ b/src/charts/qchart.cpp @@ -414,6 +414,7 @@ void QChart::zoomIn(const QRectF &rect) /*! Zooms out of the view by a factor of two. + \note This will do nothing if the result would contain an invalid logarithmic axis range. */ void QChart::zoomOut() { diff --git a/src/chartsqml2/declarativechart.cpp b/src/chartsqml2/declarativechart.cpp index 6cb811aa..a58e67c7 100644 --- a/src/chartsqml2/declarativechart.cpp +++ b/src/chartsqml2/declarativechart.cpp @@ -366,6 +366,7 @@ QT_CHARTS_BEGIN_NAMESPACE /*! \qmlmethod ChartView::zoomOut() Zooms out of the view by a factor of two. + \note This will do nothing if the result would contain an invalid logarithmic axis range. */ /*! |