##// END OF EJS Templates
Added attach/dettach axis domain implementations
Marek Rosa -
r2290:f089818f996f
parent child
Show More
@@ -186,7 +186,7 void QLogValueAxis::setBase(qreal base)
186 if (base > 0) {
186 if (base > 0) {
187 Q_D(QLogValueAxis);
187 Q_D(QLogValueAxis);
188 d->m_base = base;
188 d->m_base = base;
189 emit d->baseChanged(base);
189 emit baseChanged(base);
190 }
190 }
191 }
191 }
192
192
@@ -63,6 +63,7 Q_SIGNALS:
63 void minChanged(qreal min);
63 void minChanged(qreal min);
64 void maxChanged(qreal max);
64 void maxChanged(qreal max);
65 void rangeChanged(qreal min, qreal max);
65 void rangeChanged(qreal min, qreal max);
66 void baseChanged(qreal base);
66
67
67 private:
68 private:
68 Q_DECLARE_PRIVATE(QLogValueAxis)
69 Q_DECLARE_PRIVATE(QLogValueAxis)
@@ -56,9 +56,6 class QLogValueAxisPrivate : public QAbstractAxisPrivate
56 void setRange(const QVariant &min, const QVariant &max);
56 void setRange(const QVariant &min, const QVariant &max);
57 int tickCount() const;
57 int tickCount() const;
58
58
59 Q_SIGNALS:
60 void baseChanged(qreal base);
61
62 protected:
59 protected:
63 qreal m_min;
60 qreal m_min;
64 qreal m_max;
61 qreal m_max;
@@ -20,6 +20,7
20
20
21 #include "logxlogydomain_p.h"
21 #include "logxlogydomain_p.h"
22 #include "qabstractaxis_p.h"
22 #include "qabstractaxis_p.h"
23 #include "qlogvalueaxis.h"
23 #include <qmath.h>
24 #include <qmath.h>
24
25
25 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
@@ -154,6 +155,44 QPointF LogXLogYDomain::calculateDomainPoint(const QPointF &point) const
154 return QPointF(x, y);
155 return QPointF(x, y);
155 }
156 }
156
157
158 bool LogXLogYDomain::attachAxis(QAbstractAxis* axis)
159 {
160 AbstractDomain::attachAxis(axis);
161 QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
162
163 if(logAxis && logAxis->orientation()==Qt::Vertical)
164 QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
165
166 if(logAxis && logAxis->orientation()==Qt::Horizontal)
167 QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
168
169 return true;
170 }
171
172 bool LogXLogYDomain::detachAxis(QAbstractAxis* axis)
173 {
174 AbstractDomain::detachAxis(axis);
175 QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
176
177 if(logAxis && logAxis->orientation()==Qt::Vertical)
178 QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
179
180 if(logAxis && logAxis->orientation()==Qt::Horizontal)
181 QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
182
183 return true;
184 }
185
186 void LogXLogYDomain::handleVerticalAxisBaseChanged(qreal baseY)
187 {
188 m_logBaseY = baseY;
189 }
190
191 void LogXLogYDomain::handleHorizontalAxisBaseChanged(qreal baseX)
192 {
193 m_logBaseX = baseX;
194 }
195
157 // operators
196 // operators
158
197
159 bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2)
198 bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2)
@@ -58,6 +58,13 public:
58 QPointF calculateDomainPoint(const QPointF &point) const;
58 QPointF calculateDomainPoint(const QPointF &point) const;
59 QVector<QPointF> calculateGeometryPoints(const QList<QPointF>& vector) const;
59 QVector<QPointF> calculateGeometryPoints(const QList<QPointF>& vector) const;
60
60
61 bool attachAxis(QAbstractAxis* axis);
62 bool detachAxis(QAbstractAxis* axis);
63
64 public Q_SLOTS:
65 void handleVerticalAxisBaseChanged(qreal baseY);
66 void handleHorizontalAxisBaseChanged(qreal baseX);
67
61 private:
68 private:
62 qreal m_logMinX;
69 qreal m_logMinX;
63 qreal m_logMaxX;
70 qreal m_logMaxX;
@@ -20,6 +20,7
20
20
21 #include "logxydomain_p.h"
21 #include "logxydomain_p.h"
22 #include "qabstractaxis_p.h"
22 #include "qabstractaxis_p.h"
23 #include "qlogvalueaxis.h"
23 #include <qmath.h>
24 #include <qmath.h>
24
25
25 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
@@ -154,6 +155,33 QPointF LogXYDomain::calculateDomainPoint(const QPointF &point) const
154 return QPointF(x, y);
155 return QPointF(x, y);
155 }
156 }
156
157
158 bool LogXYDomain::attachAxis(QAbstractAxis* axis)
159 {
160 AbstractDomain::attachAxis(axis);
161 QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
162
163 if(logAxis && logAxis->orientation()==Qt::Horizontal)
164 QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
165
166 return true;
167 }
168
169 bool LogXYDomain::detachAxis(QAbstractAxis* axis)
170 {
171 AbstractDomain::detachAxis(axis);
172 QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
173
174 if(logAxis && logAxis->orientation()==Qt::Horizontal)
175 QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
176
177 return true;
178 }
179
180 void LogXYDomain::handleHorizontalAxisBaseChanged(qreal baseX)
181 {
182 m_logBaseX = baseX;
183 }
184
157 // operators
185 // operators
158
186
159 bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXYDomain &domain1, const LogXYDomain &domain2)
187 bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXYDomain &domain1, const LogXYDomain &domain2)
@@ -58,6 +58,12 public:
58 QPointF calculateDomainPoint(const QPointF &point) const;
58 QPointF calculateDomainPoint(const QPointF &point) const;
59 QVector<QPointF> calculateGeometryPoints(const QList<QPointF>& vector) const;
59 QVector<QPointF> calculateGeometryPoints(const QList<QPointF>& vector) const;
60
60
61 bool attachAxis(QAbstractAxis* axis);
62 bool detachAxis(QAbstractAxis* axis);
63
64 public Q_SLOTS:
65 void handleHorizontalAxisBaseChanged(qreal baseX);
66
61 private:
67 private:
62 qreal m_logMinX;
68 qreal m_logMinX;
63 qreal m_logMaxX;
69 qreal m_logMaxX;
@@ -20,6 +20,7
20
20
21 #include "xlogydomain_p.h"
21 #include "xlogydomain_p.h"
22 #include "qabstractaxis_p.h"
22 #include "qabstractaxis_p.h"
23 #include "qlogvalueaxis.h"
23 #include <qmath.h>
24 #include <qmath.h>
24
25
25 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
@@ -155,6 +156,33 QPointF XLogYDomain::calculateDomainPoint(const QPointF &point) const
155 return QPointF(x, y);
156 return QPointF(x, y);
156 }
157 }
157
158
159 bool XLogYDomain::attachAxis(QAbstractAxis* axis)
160 {
161 AbstractDomain::attachAxis(axis);
162 QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
163
164 if(logAxis && logAxis->orientation()==Qt::Vertical)
165 QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
166
167 return true;
168 }
169
170 bool XLogYDomain::detachAxis(QAbstractAxis* axis)
171 {
172 AbstractDomain::detachAxis(axis);
173 QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
174
175 if(logAxis && logAxis->orientation()==Qt::Vertical)
176 QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
177
178 return true;
179 }
180
181 void XLogYDomain::handleVerticalAxisBaseChanged(qreal baseY)
182 {
183 m_logBaseY = baseY;
184 }
185
158 // operators
186 // operators
159
187
160 bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const XLogYDomain &domain1, const XLogYDomain &domain2)
188 bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const XLogYDomain &domain1, const XLogYDomain &domain2)
@@ -58,6 +58,12 public:
58 QPointF calculateDomainPoint(const QPointF &point) const;
58 QPointF calculateDomainPoint(const QPointF &point) const;
59 QVector<QPointF> calculateGeometryPoints(const QList<QPointF>& vector) const;
59 QVector<QPointF> calculateGeometryPoints(const QList<QPointF>& vector) const;
60
60
61 bool attachAxis(QAbstractAxis* axis);
62 bool detachAxis(QAbstractAxis* axis);
63
64 public Q_SLOTS:
65 void handleVerticalAxisBaseChanged(qreal baseY);
66
61 private:
67 private:
62 qreal m_logMinY;
68 qreal m_logMinY;
63 qreal m_logMaxY;
69 qreal m_logMaxY;
General Comments 0
You need to be logged in to leave comments. Login now