##// END OF EJS Templates
Simple UI testing added using mago(LDTP):...
Simple UI testing added using mago(LDTP): -new basic test application added -new script added

File last commit:

r2104:f8a933676fbd
r2132:45eed4d8b56a
Show More
domain.cpp
205 lines | 4.8 KiB | text/x-c | CppLexer
Jani Honkonen
Add license headers
r794 /****************************************************************************
**
** Copyright (C) 2012 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the Qt Commercial Charts Add-on.
**
** $QT_BEGIN_LICENSE$
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
** $QT_END_LICENSE$
**
****************************************************************************/
Michal Klocek
Refactors qchart , adds line animation...
r131 #include "domain_p.h"
Michal Klocek
Refactors Domain and Axis...
r1698 #include "qabstractaxis_p.h"
Michal Klocek
Refactors qchart , adds line animation...
r131
QTCOMMERCIALCHART_BEGIN_NAMESPACE
Jani Honkonen
more coding style fixes for src-folder...
r2104 Domain::Domain(QObject *parent)
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 : QObject(parent),
m_minX(0),
m_maxX(0),
m_minY(0),
m_maxY(0)
Michal Klocek
Refactors qchart , adds line animation...
r131 {
}
Domain::~Domain()
{
}
Michal Klocek
Refactor domain model...
r439 void Domain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
Michal Klocek
Adds loosenumber algorithm...
r678 {
Michal Klocek
Refactor axis hadnling...
r1078 bool axisXChanged = false;
bool axisYChanged = false;
Michal Klocek
Refactor domain model...
r439
Jani Honkonen
Use qFuzzyIsNull to compare (in)equality of real values
r768 if (!qFuzzyIsNull(m_minX - minX) || !qFuzzyIsNull(m_maxX - maxX)) {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 m_minX = minX;
m_maxX = maxX;
axisXChanged = true;
emit rangeXChanged(m_minX, m_maxX);
Michal Klocek
Adds loosenumber algorithm...
r678 }
Jani Honkonen
Use qFuzzyIsNull to compare (in)equality of real values
r768 if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 m_minY = minY;
m_maxY = maxY;
axisYChanged = true;
emit rangeYChanged(m_minY, m_maxY);
Michal Klocek
Adds loosenumber algorithm...
r678 }
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (axisXChanged || axisYChanged)
Michal Klocek
Refactors Domain and Axis...
r1698 emit updated();
Michal Klocek
Refactor domain model...
r439 }
Michal Klocek
Adds loosenumber algorithm...
r678
Michal Klocek
Refactor domain model...
r439 void Domain::setRangeX(qreal min, qreal max)
{
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 setRange(min, max, m_minY, m_maxY);
Michal Klocek
Refactor domain model...
r439 }
Michal Klocek
Refactors barchart axis hadnling...
r679
Michal Klocek
Refactor domain model...
r439 void Domain::setRangeY(qreal min, qreal max)
{
Michal Klocek
Adds loosenumber algorithm...
r678 setRange(m_minX, m_maxX, min, max);
Michal Klocek
Refactor domain model...
r439 }
void Domain::setMinX(qreal min)
{
Michal Klocek
Adds loosenumber algorithm...
r678 setRange(min, m_maxX, m_minY, m_maxY);
Michal Klocek
Refactor domain model...
r439 }
void Domain::setMaxX(qreal max)
{
Michal Klocek
Adds loosenumber algorithm...
r678 setRange(m_minX, max, m_minY, m_maxY);
Michal Klocek
Refactor domain model...
r439 }
void Domain::setMinY(qreal min)
{
Michal Klocek
Adds loosenumber algorithm...
r678 setRange(m_minX, m_maxX, min, m_maxY);
Michal Klocek
Refactor domain model...
r439 }
void Domain::setMaxY(qreal max)
{
setRange(m_minX, m_maxX, m_minY, max);
}
Michal Klocek
Refactors qchart , adds line animation...
r131 qreal Domain::spanX() const
{
Michal Klocek
Refactor domain model...
r439 Q_ASSERT(m_maxX >= m_minX);
return m_maxX - m_minX;
Michal Klocek
Refactors qchart , adds line animation...
r131 }
qreal Domain::spanY() const
{
Michal Klocek
Refactor domain model...
r439 Q_ASSERT(m_maxY >= m_minY);
return m_maxY - m_minY;
Michal Klocek
Refactors qchart , adds line animation...
r131 }
Michal Klocek
Adds isEmpty to domain
r388 bool Domain::isEmpty() const
{
Jani Honkonen
Use qFuzzyIsNull to compare (in)equality of real values
r768 return qFuzzyIsNull(spanX()) || qFuzzyIsNull(spanY());
Michal Klocek
Adds isEmpty to domain
r388 }
Jani Honkonen
more coding style fixes for src-folder...
r2104 void Domain::zoomIn(const QRectF &rect, const QSizeF &size)
Michal Klocek
Refactors qchart , adds line animation...
r131 {
Michal Klocek
Refactor domain model...
r439 qreal dx = spanX() / size.width();
qreal dy = spanY() / size.height();
Michal Klocek
Refactors qchart , adds line animation...
r131
Michal Klocek
Refactor axis hadnling...
r1078 qreal maxX = m_maxX;
qreal minX = m_minX;
qreal minY = m_minY;
qreal maxY = m_maxY;
Michal Klocek
Refactor domain model...
r439
Michal Klocek
Refactor axis hadnling...
r1078 maxX = minX + dx * rect.right();
minX = minX + dx * rect.left();
minY = maxY - dy * rect.bottom();
maxY = maxY - dy * rect.top();
Michal Klocek
Adds loosenumber algorithm...
r678
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 setRange(minX, maxX, minY, maxY);
Michal Klocek
Refactor domain model...
r439 }
Jani Honkonen
more coding style fixes for src-folder...
r2104 void Domain::zoomOut(const QRectF &rect, const QSizeF &size)
Michal Klocek
Refactor domain model...
r439 {
qreal dx = spanX() / rect.width();
qreal dy = spanY() / rect.height();
Michal Klocek
Refactors qchart , adds line animation...
r131
Michal Klocek
Refactor axis hadnling...
r1078 qreal maxX = m_maxX;
qreal minX = m_minX;
qreal minY = m_minY;
qreal maxY = m_maxY;
Michal Klocek
Refactors qchart , adds line animation...
r131
Michal Klocek
Refactor axis hadnling...
r1078 minX = maxX - dx * rect.right();
maxX = minX + dx * size.width();
maxY = minY + dy * rect.bottom();
minY = maxY - dy * size.height();
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 setRange(minX, maxX, minY, maxY);
Michal Klocek
Adds scroll support...
r531 }
Jani Honkonen
more coding style fixes for src-folder...
r2104 void Domain::move(qreal dx, qreal dy, const QSizeF &size)
Michal Klocek
Adds scroll support...
r531 {
qreal x = spanX() / size.width();
qreal y = spanY() / size.height();
Michal Klocek
Refactor axis hadnling...
r1078 qreal maxX = m_maxX;
qreal minX = m_minX;
qreal minY = m_minY;
qreal maxY = m_maxY;
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (dx != 0) {
Michal Klocek
Refactor axis hadnling...
r1078 minX = minX + x * dx;
maxX = maxX + x * dx;
Michal Klocek
Adds scroll support...
r531 }
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (dy != 0) {
Michal Klocek
Refactor axis hadnling...
r1078 minY = minY + y * dy;
maxY = maxY + y * dy;
Michal Klocek
Adds scroll support...
r531 }
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 setRange(minX, maxX, minY, maxY);
Michal Klocek
Refactor domain model...
r439 }
Michal Klocek
Refactors Domain and Axis...
r1698 void Domain::emitUpdated()
Michal Klocek
Adds loosenumber algorithm...
r678 {
Michal Klocek
Refactors Domain and Axis...
r1698 emit updated();
Michal Klocek
Adds loosenumber algorithm...
r678 }
Michal Klocek
Refactors Domain and Axis...
r1698 void Domain::handleAxisUpdated()
Michal Klocek
Adds missing ticks hadnling
r554 {
Jani Honkonen
more coding style fixes for src-folder...
r2104 QAbstractAxisPrivate *axis = qobject_cast<QAbstractAxisPrivate *>(sender());
Michal Klocek
Refactors Domain and Axis...
r1698 Q_ASSERT(axis);
axis->setDirty(false);
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (axis->orientation() == Qt::Horizontal)
setRangeX(axis->min(), axis->max());
else if (axis->orientation() == Qt::Vertical)
setRangeY(axis->min(), axis->max());
Michal Klocek
Adds missing ticks hadnling
r554 }
Michal Klocek
Another attempt to fix issue with visual sutudio hidden export attributes in domain
r1066 bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const Domain &domain1, const Domain &domain2)
Michal Klocek
Add overloaded comparison operators to domain
r220 {
Jani Honkonen
Use qFuzzyIsNull to compare (in)equality of real values
r768 return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX) &&
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY) &&
qFuzzyIsNull(domain1.m_minX - domain2.m_minX) &&
qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
Michal Klocek
Add overloaded comparison operators to domain
r220 }
Michal Klocek
Another attempt to fix issue with visual sutudio hidden export attributes in domain
r1066
bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const Domain &domain1, const Domain &domain2)
Michal Klocek
Add overloaded comparison operators to domain
r220 {
return !(domain1 == domain2);
}
Michal Klocek
Another attempt to fix issue with visual sutudio hidden export attributes in domain
r1066
QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const Domain &domain)
Michal Klocek
Adds debug operator to domain
r222 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 dbg.nospace() << "Domain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')';
Michal Klocek
Adds debug operator to domain
r222 return dbg.maybeSpace();
}
Michal Klocek
Refactor domain model...
r439 #include "moc_domain_p.cpp"
Michal Klocek
Refactors qchart , adds line animation...
r131 QTCOMMERCIALCHART_END_NAMESPACE