##// END OF EJS Templates
Bugfix resize event during zoomin
Michal Klocek -
r2289:d4cb0061d8bc
parent child
Show More
@@ -341,7 +341,7 void ChartDataSet::zoomInDomain(const QRectF &rect)
341 341 QList<AbstractDomain*> domains;
342 342 foreach(QAbstractSeries *s, m_seriesList) {
343 343 AbstractDomain* domain = s->d_ptr->domain();
344 s->d_ptr->m_domain->blockAxisSignals(true);
344 s->d_ptr->m_domain->blockRangeSignals(true);
345 345 domains<<domain;
346 346 }
347 347
@@ -349,7 +349,7 void ChartDataSet::zoomInDomain(const QRectF &rect)
349 349 domain->zoomIn(rect);
350 350
351 351 foreach(AbstractDomain *domain, domains)
352 domain->blockAxisSignals(false);
352 domain->blockRangeSignals(false);
353 353 }
354 354
355 355 void ChartDataSet::zoomOutDomain(const QRectF &rect)
@@ -357,7 +357,7 void ChartDataSet::zoomOutDomain(const QRectF &rect)
357 357 QList<AbstractDomain*> domains;
358 358 foreach(QAbstractSeries *s, m_seriesList) {
359 359 AbstractDomain* domain = s->d_ptr->domain();
360 s->d_ptr->m_domain->blockAxisSignals(true);
360 s->d_ptr->m_domain->blockRangeSignals(true);
361 361 domains<<domain;
362 362 }
363 363
@@ -365,16 +365,15 void ChartDataSet::zoomOutDomain(const QRectF &rect)
365 365 domain->zoomOut(rect);
366 366
367 367 foreach(AbstractDomain *domain, domains)
368 domain->blockAxisSignals(false);
368 domain->blockRangeSignals(false);
369 369 }
370 370
371 371 void ChartDataSet::scrollDomain(qreal dx, qreal dy)
372 372 {
373 373 QList<AbstractDomain*> domains;
374 374 foreach(QAbstractSeries *s, m_seriesList) {
375 AbstractDomain* domain = s->d_ptr->m_domain.data();
376 if(domains.contains(domain)) continue;
377 s->d_ptr->m_domain->blockAxisSignals(true);
375 AbstractDomain* domain = s->d_ptr->domain();
376 s->d_ptr->m_domain->blockRangeSignals(true);
378 377 domains<<domain;
379 378 }
380 379
@@ -382,7 +381,7 void ChartDataSet::scrollDomain(qreal dx, qreal dy)
382 381 domain->move(dx, dy);
383 382
384 383 foreach(AbstractDomain *domain, domains)
385 domain->blockAxisSignals(false);
384 domain->blockRangeSignals(false);
386 385 }
387 386
388 387 QList<QAbstractAxis*> ChartDataSet::axes() const
@@ -30,7 +30,7 AbstractDomain::AbstractDomain(QObject *parent)
30 30 m_maxX(0),
31 31 m_minY(0),
32 32 m_maxY(0),
33 m_axisSignalsBlocked(false)
33 m_signalsBlocked(false)
34 34 {
35 35 }
36 36
@@ -112,19 +112,23 QPointF AbstractDomain::calculateDomainPoint(const QPointF &point) const
112 112
113 113 void AbstractDomain::handleVerticalAxisRangeChanged(qreal min, qreal max)
114 114 {
115 if(!m_axisSignalsBlocked)
116 115 setRangeY(min, max);
117 116 }
118 117
119 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::blockAxisSignals(bool block)
123 void AbstractDomain::blockRangeSignals(bool block)
126 124 {
127 m_axisSignalsBlocked=block;
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 134 //algorithm defined by Paul S.Heckbert GraphicalGems I
@@ -69,8 +69,8 public:
69 69 qreal spanY() const;
70 70 bool isEmpty() const;
71 71
72 void blockAxisSignals(bool block);
73 bool axisSignalsBlocked() const { return m_axisSignalsBlocked; }
72 void blockRangeSignals(bool block);
73 bool rangeSignalsBlocked() const { return m_signalsBlocked; }
74 74
75 75 friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const AbstractDomain &domain1, const AbstractDomain &domain2);
76 76 friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const AbstractDomain &domain1, const AbstractDomain &domain2);
@@ -105,7 +105,7 protected:
105 105 qreal m_minY;
106 106 qreal m_maxY;
107 107 QSizeF m_size;
108 bool m_axisSignalsBlocked;
108 bool m_signalsBlocked;
109 109 };
110 110
111 111 QTCOMMERCIALCHART_END_NAMESPACE
@@ -42,6 +42,7 void XYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
42 42 m_minX = minX;
43 43 m_maxX = maxX;
44 44 axisXChanged = true;
45 if(!m_signalsBlocked)
45 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 50 m_minY = minY;
50 51 m_maxY = maxY;
51 52 axisYChanged = true;
53 if(!m_signalsBlocked)
52 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