@@ -108,7 +108,7 public Q_SLOTS: | |||
|
108 | 108 | |
|
109 | 109 | void updateWidth(double width) |
|
110 | 110 | { |
|
111 |
if (width |
|
|
111 | if (!qFuzzyIsNull(width - m_pen.widthF())) { | |
|
112 | 112 | m_pen.setWidthF(width); |
|
113 | 113 | emit changed(); |
|
114 | 114 | } |
@@ -337,7 +337,7 void Axis::setLayout(QVector<qreal> &layout) | |||
|
337 | 337 | |
|
338 | 338 | bool Axis::isEmpty() |
|
339 | 339 | { |
|
340 |
return m_rect.isEmpty() || m_min |
|
|
340 | return m_rect.isEmpty() || qFuzzyIsNull(m_min - m_max) || m_ticksCount==0; | |
|
341 | 341 | } |
|
342 | 342 | |
|
343 | 343 | //handlers |
@@ -390,7 +390,8 void Axis::handleAxisUpdated() | |||
|
390 | 390 | |
|
391 | 391 | void Axis::handleRangeChanged(qreal min, qreal max,int tickCount) |
|
392 | 392 | { |
|
393 |
if (min |
|
|
393 | if (qFuzzyIsNull(min - max) || tickCount < 2) | |
|
394 | return; | |
|
394 | 395 | |
|
395 | 396 | m_min = min; |
|
396 | 397 | m_max = max; |
@@ -328,13 +328,13 void QChartAxis::setMax(qreal max) | |||
|
328 | 328 | void QChartAxis::setRange(qreal min, qreal max) |
|
329 | 329 | { |
|
330 | 330 | bool changed = false; |
|
331 |
if (m_min |
|
|
331 | if (!qFuzzyIsNull(m_min - min)) { | |
|
332 | 332 | m_min = min; |
|
333 | 333 | changed = true; |
|
334 | 334 | emit minChanged(min); |
|
335 | 335 | } |
|
336 | 336 | |
|
337 |
if (m_max |
|
|
337 | if (!qFuzzyIsNull(m_max - max)) { | |
|
338 | 338 | m_max = max; |
|
339 | 339 | changed = true; |
|
340 | 340 | emit maxChanged(max); |
@@ -139,7 +139,7 QVector<QRectF> BarChartItem::calculateLayout() | |||
|
139 | 139 | value->setPos(xPos, yPos-barHeight / 2); |
|
140 | 140 | value->setPen(barSet->floatingValuePen()); |
|
141 | 141 | |
|
142 |
if (m_series->valueAt(set,category) |
|
|
142 | if (!qFuzzyIsNull(m_series->valueAt(set,category))) { | |
|
143 | 143 | value->setValueString(QString::number(m_series->valueAt(set, category))); |
|
144 | 144 | } else { |
|
145 | 145 | value->setValueString(QString("")); |
@@ -58,7 +58,7 QVector<QRectF> PercentBarChartItem::calculateLayout() | |||
|
58 | 58 | value->setPos(xPos, yPos-barHeight / 2); |
|
59 | 59 | value->setPen(barSet->floatingValuePen()); |
|
60 | 60 | |
|
61 |
if (m_series->valueAt(set,category) |
|
|
61 | if (!qFuzzyIsNull(m_series->valueAt(set,category))) { | |
|
62 | 62 | int p = m_series->percentageAt(set,category) * 100; |
|
63 | 63 | QString vString(QString::number(p)); |
|
64 | 64 | vString.truncate(3); |
@@ -64,7 +64,7 QVector<QRectF> StackedBarChartItem::calculateLayout() | |||
|
64 | 64 | value->setPos(xPos, yPos-barHeight / 2); |
|
65 | 65 | value->setPen(barSet->floatingValuePen()); |
|
66 | 66 | |
|
67 |
if (m_series->valueAt(set, category) |
|
|
67 | if (!qFuzzyIsNull(m_series->valueAt(set, category))) { | |
|
68 | 68 | value->setValueString(QString::number(m_series->valueAt(set,category))); |
|
69 | 69 | } else { |
|
70 | 70 | value->setValueString(QString("")); |
@@ -39,7 +39,7 void Domain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY,int tickXCo | |||
|
39 | 39 | tickYChanged=true; |
|
40 | 40 | } |
|
41 | 41 | |
|
42 |
if(m_minX |
|
|
42 | if (!qFuzzyIsNull(m_minX - minX) || !qFuzzyIsNull(m_maxX - maxX)) { | |
|
43 | 43 | if(m_niceNumbers) looseNiceNumbers(minX, maxX, m_tickXCount); |
|
44 | 44 | m_minX=minX; |
|
45 | 45 | m_maxX=maxX; |
@@ -48,7 +48,7 void Domain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY,int tickXCo | |||
|
48 | 48 | emit rangeXChanged(minX,maxX, m_tickXCount); |
|
49 | 49 | } |
|
50 | 50 | |
|
51 |
if(m_minY |
|
|
51 | if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) { | |
|
52 | 52 | if(m_niceNumbers) looseNiceNumbers(minY, maxY, m_tickYCount); |
|
53 | 53 | m_minY=minY; |
|
54 | 54 | m_maxY=maxY; |
@@ -124,7 +124,7 qreal Domain::spanY() const | |||
|
124 | 124 | |
|
125 | 125 | bool Domain::isEmpty() const |
|
126 | 126 | { |
|
127 |
return spanX() |
|
|
127 | return qFuzzyIsNull(spanX()) || qFuzzyIsNull(spanY()); | |
|
128 | 128 | } |
|
129 | 129 | |
|
130 | 130 | void Domain::zoomIn(const QRectF& rect, const QSizeF& size) |
@@ -235,10 +235,10 qreal Domain::niceNumber(qreal x,bool ceiling) | |||
|
235 | 235 | |
|
236 | 236 | bool operator== (const Domain &domain1, const Domain &domain2) |
|
237 | 237 | { |
|
238 |
return (domain1.m_maxX |
|
|
239 |
domain1.m_maxY |
|
|
240 |
domain1.m_minX |
|
|
241 |
domain1.m_minY |
|
|
238 | return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX) && | |
|
239 | qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY) && | |
|
240 | qFuzzyIsNull(domain1.m_minX - domain2.m_minX) && | |
|
241 | qFuzzyIsNull(domain1.m_minY - domain2.m_minY)); | |
|
242 | 242 | } |
|
243 | 243 | |
|
244 | 244 | bool operator!= (const Domain &domain1, const Domain &domain2) |
@@ -56,7 +56,7 public: | |||
|
56 | 56 | |
|
57 | 57 | bool operator!=(const PieSliceData &other) |
|
58 | 58 | { |
|
59 |
if (m_value |
|
|
59 | if (!qFuzzyIsNull(m_value - other.m_value)) | |
|
60 | 60 | return true; |
|
61 | 61 | |
|
62 | 62 | if (m_slicePen != other.m_slicePen || |
@@ -89,7 +89,7 qreal QScatterSeries::size() const | |||
|
89 | 89 | */ |
|
90 | 90 | void QScatterSeries::setSize(qreal size) |
|
91 | 91 | { |
|
92 |
if (m_size |
|
|
92 | if (!qFuzzyIsNull(m_size - size)) { | |
|
93 | 93 | m_size = size; |
|
94 | 94 | emit updated(); |
|
95 | 95 | } |
@@ -143,7 +143,7 void XYChartItem::handleGeometryChanged(const QRectF &rect) | |||
|
143 | 143 | |
|
144 | 144 | bool XYChartItem::isEmpty() |
|
145 | 145 | { |
|
146 |
return !m_clipRect.isValid() || |
|
|
146 | return !m_clipRect.isValid() || qFuzzyIsNull(m_maxX - m_minX) || qFuzzyIsNull(m_maxY - m_minY); | |
|
147 | 147 | } |
|
148 | 148 | |
|
149 | 149 | void XYChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event) |
@@ -99,12 +99,12 void tst_Domain::handleAxisRangeXChanged() | |||
|
99 | 99 | domain.handleAxisXChanged(min, max); |
|
100 | 100 | |
|
101 | 101 | QList<QVariant> arg0 = spy0.first(); |
|
102 |
QVERIFY(arg0.at(0).toReal() |
|
|
103 |
QVERIFY(arg0.at(1).toReal() |
|
|
102 | QVERIFY(qFuzzyIsNull(arg0.at(0).toReal() - min)); | |
|
103 | QVERIFY(qFuzzyIsNull(arg0.at(1).toReal() - max)); | |
|
104 | 104 | |
|
105 | 105 | QList<QVariant> arg1 = spy1.first(); |
|
106 |
QVERIFY(arg1.at(0).toReal() |
|
|
107 |
QVERIFY(arg1.at(1).toReal() |
|
|
106 | QVERIFY(qFuzzyIsNull(arg1.at(0).toReal() - min)); | |
|
107 | QVERIFY(qFuzzyIsNull(arg1.at(1).toReal() - max)); | |
|
108 | 108 | |
|
109 | 109 | QCOMPARE(spy0.count(), 1); |
|
110 | 110 | QCOMPARE(spy1.count(), 1); |
@@ -136,12 +136,12 void tst_Domain::handleAxisRangeYChanged() | |||
|
136 | 136 | domain.handleAxisYChanged(min, max,5); |
|
137 | 137 | |
|
138 | 138 | QList<QVariant> arg0 = spy0.first(); |
|
139 |
QVERIFY(arg0.at(2).toReal() |
|
|
140 |
QVERIFY(arg0.at(3).toReal() |
|
|
139 | QVERIFY(qFuzzyIsNull(arg0.at(2).toReal() - min)); | |
|
140 | QVERIFY(qFuzzyIsNull(arg0.at(3).toReal() - max)); | |
|
141 | 141 | |
|
142 | 142 | QList<QVariant> arg1 = spy2.first(); |
|
143 |
QVERIFY(arg1.at(0).toReal() |
|
|
144 |
QVERIFY(arg1.at(1).toReal() |
|
|
143 | QVERIFY(qFuzzyIsNull(arg1.at(0).toReal() - min)); | |
|
144 | QVERIFY(qFuzzyIsNull(arg1.at(1).toReal() - max)); | |
|
145 | 145 | |
|
146 | 146 | QCOMPARE(spy0.count(), 1); |
|
147 | 147 | QCOMPARE(spy1.count(), 0); |
@@ -415,12 +415,12 void tst_Domain::setRangeX() | |||
|
415 | 415 | domain.setRangeX(min, max); |
|
416 | 416 | |
|
417 | 417 | QList<QVariant> arg0 = spy0.first(); |
|
418 |
|
|
|
419 |
|
|
|
418 | QVERIFY(qFuzzyIsNull(arg0.at(0).toReal() - min)); | |
|
419 | QVERIFY(qFuzzyIsNull(arg0.at(1).toReal() - max)); | |
|
420 | 420 | |
|
421 | 421 | QList<QVariant> arg1 = spy1.first(); |
|
422 |
|
|
|
423 |
|
|
|
422 | QVERIFY(qFuzzyIsNull(arg1.at(0).toReal() - min)); | |
|
423 | QVERIFY(qFuzzyIsNull(arg1.at(1).toReal() - max)); | |
|
424 | 424 | |
|
425 | 425 | QCOMPARE(spy0.count(), 1); |
|
426 | 426 | QCOMPARE(spy1.count(), 1); |
@@ -450,12 +450,12 void tst_Domain::setRangeY() | |||
|
450 | 450 | domain.setRangeY(min, max); |
|
451 | 451 | |
|
452 | 452 | QList<QVariant> arg0 = spy0.first(); |
|
453 |
|
|
|
454 |
|
|
|
453 | QVERIFY(qFuzzyIsNull(arg0.at(2).toReal() - min)); | |
|
454 | QVERIFY(qFuzzyIsNull(arg0.at(3).toReal() - max)); | |
|
455 | 455 | |
|
456 | 456 | QList<QVariant> arg1 = spy2.first(); |
|
457 |
|
|
|
458 |
|
|
|
457 | QVERIFY(qFuzzyIsNull(arg1.at(0).toReal() - min)); | |
|
458 | QVERIFY(qFuzzyIsNull(arg1.at(1).toReal() - max)); | |
|
459 | 459 | |
|
460 | 460 | QCOMPARE(spy0.count(), 1); |
|
461 | 461 | QCOMPARE(spy1.count(), 0); |
General Comments 0
You need to be logged in to leave comments.
Login now