@@ -341,7 +341,7 void ChartDataSet::zoomInDomain(const QRectF &rect) | |||||
341 | QList<AbstractDomain*> domains; |
|
341 | QList<AbstractDomain*> domains; | |
342 | foreach(QAbstractSeries *s, m_seriesList) { |
|
342 | foreach(QAbstractSeries *s, m_seriesList) { | |
343 | AbstractDomain* domain = s->d_ptr->domain(); |
|
343 | AbstractDomain* domain = s->d_ptr->domain(); | |
344 |
s->d_ptr->m_domain->block |
|
344 | s->d_ptr->m_domain->blockRangeSignals(true); | |
345 | domains<<domain; |
|
345 | domains<<domain; | |
346 | } |
|
346 | } | |
347 |
|
347 | |||
@@ -349,7 +349,7 void ChartDataSet::zoomInDomain(const QRectF &rect) | |||||
349 | domain->zoomIn(rect); |
|
349 | domain->zoomIn(rect); | |
350 |
|
350 | |||
351 | foreach(AbstractDomain *domain, domains) |
|
351 | foreach(AbstractDomain *domain, domains) | |
352 |
domain->block |
|
352 | domain->blockRangeSignals(false); | |
353 | } |
|
353 | } | |
354 |
|
354 | |||
355 | void ChartDataSet::zoomOutDomain(const QRectF &rect) |
|
355 | void ChartDataSet::zoomOutDomain(const QRectF &rect) | |
@@ -357,7 +357,7 void ChartDataSet::zoomOutDomain(const QRectF &rect) | |||||
357 | QList<AbstractDomain*> domains; |
|
357 | QList<AbstractDomain*> domains; | |
358 | foreach(QAbstractSeries *s, m_seriesList) { |
|
358 | foreach(QAbstractSeries *s, m_seriesList) { | |
359 | AbstractDomain* domain = s->d_ptr->domain(); |
|
359 | AbstractDomain* domain = s->d_ptr->domain(); | |
360 |
s->d_ptr->m_domain->block |
|
360 | s->d_ptr->m_domain->blockRangeSignals(true); | |
361 | domains<<domain; |
|
361 | domains<<domain; | |
362 | } |
|
362 | } | |
363 |
|
363 | |||
@@ -365,16 +365,15 void ChartDataSet::zoomOutDomain(const QRectF &rect) | |||||
365 | domain->zoomOut(rect); |
|
365 | domain->zoomOut(rect); | |
366 |
|
366 | |||
367 | foreach(AbstractDomain *domain, domains) |
|
367 | foreach(AbstractDomain *domain, domains) | |
368 |
domain->block |
|
368 | domain->blockRangeSignals(false); | |
369 | } |
|
369 | } | |
370 |
|
370 | |||
371 | void ChartDataSet::scrollDomain(qreal dx, qreal dy) |
|
371 | void ChartDataSet::scrollDomain(qreal dx, qreal dy) | |
372 | { |
|
372 | { | |
373 | QList<AbstractDomain*> domains; |
|
373 | QList<AbstractDomain*> domains; | |
374 | foreach(QAbstractSeries *s, m_seriesList) { |
|
374 | foreach(QAbstractSeries *s, m_seriesList) { | |
375 |
AbstractDomain* domain = s->d_ptr-> |
|
375 | AbstractDomain* domain = s->d_ptr->domain(); | |
376 | if(domains.contains(domain)) continue; |
|
376 | s->d_ptr->m_domain->blockRangeSignals(true); | |
377 | s->d_ptr->m_domain->blockAxisSignals(true); |
|
|||
378 | domains<<domain; |
|
377 | domains<<domain; | |
379 | } |
|
378 | } | |
380 |
|
379 | |||
@@ -382,7 +381,7 void ChartDataSet::scrollDomain(qreal dx, qreal dy) | |||||
382 | domain->move(dx, dy); |
|
381 | domain->move(dx, dy); | |
383 |
|
382 | |||
384 | foreach(AbstractDomain *domain, domains) |
|
383 | foreach(AbstractDomain *domain, domains) | |
385 |
domain->block |
|
384 | domain->blockRangeSignals(false); | |
386 | } |
|
385 | } | |
387 |
|
386 | |||
388 | QList<QAbstractAxis*> ChartDataSet::axes() const |
|
387 | QList<QAbstractAxis*> ChartDataSet::axes() const |
@@ -30,7 +30,7 AbstractDomain::AbstractDomain(QObject *parent) | |||||
30 | m_maxX(0), |
|
30 | m_maxX(0), | |
31 | m_minY(0), |
|
31 | m_minY(0), | |
32 | m_maxY(0), |
|
32 | m_maxY(0), | |
33 |
m_ |
|
33 | m_signalsBlocked(false) | |
34 | { |
|
34 | { | |
35 | } |
|
35 | } | |
36 |
|
36 | |||
@@ -112,19 +112,23 QPointF AbstractDomain::calculateDomainPoint(const QPointF &point) const | |||||
112 |
|
112 | |||
113 | void AbstractDomain::handleVerticalAxisRangeChanged(qreal min, qreal max) |
|
113 | void AbstractDomain::handleVerticalAxisRangeChanged(qreal min, qreal max) | |
114 | { |
|
114 | { | |
115 | if(!m_axisSignalsBlocked) |
|
|||
116 |
|
|
115 | setRangeY(min, max); | |
117 | } |
|
116 | } | |
118 |
|
117 | |||
119 | void AbstractDomain::handleHorizontalAxisRangeChanged(qreal min, qreal max) |
|
118 | void AbstractDomain::handleHorizontalAxisRangeChanged(qreal min, qreal max) | |
120 | { |
|
119 | { | |
121 | if(!m_axisSignalsBlocked) |
|
|||
122 |
|
|
120 | setRangeX(min, max); | |
123 | } |
|
121 | } | |
124 |
|
122 | |||
125 |
void AbstractDomain::block |
|
123 | void AbstractDomain::blockRangeSignals(bool block) | |
126 | { |
|
124 | { | |
127 |
m_ |
|
125 | if(m_signalsBlocked!=block){ | |
|
126 | m_signalsBlocked=block; | |||
|
127 | if(!block) { | |||
|
128 | emit rangeHorizontalChanged(m_minX,m_maxX); | |||
|
129 | emit rangeVerticalChanged(m_minY,m_maxY); | |||
|
130 | } | |||
|
131 | } | |||
128 | } |
|
132 | } | |
129 |
|
133 | |||
130 | //algorithm defined by Paul S.Heckbert GraphicalGems I |
|
134 | //algorithm defined by Paul S.Heckbert GraphicalGems I |
@@ -69,8 +69,8 public: | |||||
69 | qreal spanY() const; |
|
69 | qreal spanY() const; | |
70 | bool isEmpty() const; |
|
70 | bool isEmpty() const; | |
71 |
|
71 | |||
72 |
void block |
|
72 | void blockRangeSignals(bool block); | |
73 |
bool |
|
73 | bool rangeSignalsBlocked() const { return m_signalsBlocked; } | |
74 |
|
74 | |||
75 | friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const AbstractDomain &domain1, const AbstractDomain &domain2); |
|
75 | friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const AbstractDomain &domain1, const AbstractDomain &domain2); | |
76 | friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const AbstractDomain &domain1, const AbstractDomain &domain2); |
|
76 | friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const AbstractDomain &domain1, const AbstractDomain &domain2); | |
@@ -105,7 +105,7 protected: | |||||
105 | qreal m_minY; |
|
105 | qreal m_minY; | |
106 | qreal m_maxY; |
|
106 | qreal m_maxY; | |
107 | QSizeF m_size; |
|
107 | QSizeF m_size; | |
108 |
bool m_ |
|
108 | bool m_signalsBlocked; | |
109 | }; |
|
109 | }; | |
110 |
|
110 | |||
111 | QTCOMMERCIALCHART_END_NAMESPACE |
|
111 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -42,6 +42,7 void XYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) | |||||
42 | m_minX = minX; |
|
42 | m_minX = minX; | |
43 | m_maxX = maxX; |
|
43 | m_maxX = maxX; | |
44 | axisXChanged = true; |
|
44 | axisXChanged = true; | |
|
45 | if(!m_signalsBlocked) | |||
45 | emit rangeHorizontalChanged(m_minX, m_maxX); |
|
46 | emit rangeHorizontalChanged(m_minX, m_maxX); | |
46 | } |
|
47 | } | |
47 |
|
48 | |||
@@ -49,6 +50,7 void XYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) | |||||
49 | m_minY = minY; |
|
50 | m_minY = minY; | |
50 | m_maxY = maxY; |
|
51 | m_maxY = maxY; | |
51 | axisYChanged = true; |
|
52 | axisYChanged = true; | |
|
53 | if(!m_signalsBlocked) | |||
52 | emit rangeVerticalChanged(m_minY, m_maxY); |
|
54 | emit rangeVerticalChanged(m_minY, m_maxY); | |
53 | } |
|
55 | } | |
54 |
|
56 |
General Comments 0
You need to be logged in to leave comments.
Login now