@@ -544,15 +544,15 void QAbstractAxis::hide() | |||||
544 | } |
|
544 | } | |
545 |
|
545 | |||
546 |
|
546 | |||
547 |
void QAbstractAxis::setMin(const |
|
547 | void QAbstractAxis::setMin(const QVariant &min) | |
548 | { |
|
548 | { | |
549 | d_ptr->setMin(min); |
|
549 | d_ptr->setMin(min); | |
550 | } |
|
550 | } | |
551 |
void QAbstractAxis::setMax(const |
|
551 | void QAbstractAxis::setMax(const QVariant &max) | |
552 | { |
|
552 | { | |
553 | d_ptr->setMax(max); |
|
553 | d_ptr->setMax(max); | |
554 | } |
|
554 | } | |
555 |
void QAbstractAxis::setRange(const |
|
555 | void QAbstractAxis::setRange(const QVariant &min, const QVariant &max) | |
556 | { |
|
556 | { | |
557 | d_ptr->setRange(min,max); |
|
557 | d_ptr->setRange(min,max); | |
558 | } |
|
558 | } |
@@ -101,9 +101,9 public: | |||||
101 | QColor shadesBorderColor() const; |
|
101 | QColor shadesBorderColor() const; | |
102 |
|
102 | |||
103 | //range handling |
|
103 | //range handling | |
104 |
void setMin(const |
|
104 | void setMin(const QVariant &min); | |
105 |
void setMax(const |
|
105 | void setMax(const QVariant &max); | |
106 |
void setRange(const |
|
106 | void setRange(const QVariant &min, const QVariant &max); | |
107 |
|
107 | |||
108 | void show(); |
|
108 | void show(); | |
109 | void hide(); |
|
109 | void hide(); |
@@ -52,9 +52,9 public: | |||||
52 | virtual void updateRange() = 0; |
|
52 | virtual void updateRange() = 0; | |
53 |
|
53 | |||
54 | protected: |
|
54 | protected: | |
55 |
virtual void setMin(const |
|
55 | virtual void setMin(const QVariant &min) = 0; | |
56 |
virtual void setMax(const |
|
56 | virtual void setMax(const QVariant &max) = 0; | |
57 |
virtual void setRange(const |
|
57 | virtual void setRange(const QVariant &min, const QVariant &max, bool force = false) = 0; | |
58 | virtual int ticksCount() const = 0; |
|
58 | virtual int ticksCount() const = 0; | |
59 |
|
59 | |||
60 | public: |
|
60 | public: |
@@ -233,18 +233,23 void QCategoriesAxisPrivate::setRangeCategory(const QString& minCategory, const | |||||
233 | setRange(minIndex -0.5, maxIndex + 0.5); |
|
233 | setRange(minIndex -0.5, maxIndex + 0.5); | |
234 | } |
|
234 | } | |
235 |
|
235 | |||
236 |
void QCategoriesAxisPrivate::setMin(const |
|
236 | void QCategoriesAxisPrivate::setMin(const QVariant &min) | |
237 | { |
|
237 | { | |
238 | setRange(min,m_max); |
|
238 | setRange(min,m_max); | |
239 | } |
|
239 | } | |
240 |
|
240 | |||
241 |
void QCategoriesAxisPrivate::setMax(const |
|
241 | void QCategoriesAxisPrivate::setMax(const QVariant &max) | |
242 | { |
|
242 | { | |
243 | setRange(m_min,max); |
|
243 | setRange(m_min,max); | |
244 | } |
|
244 | } | |
245 |
|
245 | |||
246 |
void QCategoriesAxisPrivate::setRange(const |
|
246 | void QCategoriesAxisPrivate::setRange(const QVariant &min, const QVariant &max, bool force) | |
247 | { |
|
247 | { | |
|
248 | Q_UNUSED(min); | |||
|
249 | Q_UNUSED(max); | |||
|
250 | Q_UNUSED(force); | |||
|
251 | // TODO: refactor | |||
|
252 | /* | |||
248 | if (max <= min) { |
|
253 | if (max <= min) { | |
249 | // max must be greater than min |
|
254 | // max must be greater than min | |
250 | return; |
|
255 | return; | |
@@ -265,6 +270,7 void QCategoriesAxisPrivate::setRange(const qreal min, const qreal max, bool for | |||||
265 | emit this->changed(m_min, m_max, qCeil(m_max) -qCeil(m_min) +1, false); |
|
270 | emit this->changed(m_min, m_max, qCeil(m_max) -qCeil(m_min) +1, false); | |
266 | emit q->categoriesChanged(); |
|
271 | emit q->categoriesChanged(); | |
267 | } |
|
272 | } | |
|
273 | */ | |||
268 | } |
|
274 | } | |
269 |
|
275 | |||
270 | int QCategoriesAxisPrivate::ticksCount() const |
|
276 | int QCategoriesAxisPrivate::ticksCount() const |
@@ -59,6 +59,10 public: | |||||
59 | QString maxCategory() const; |
|
59 | QString maxCategory() const; | |
60 | void setCategoryRange(const QString& minCategory, const QString& maxCategory); |
|
60 | void setCategoryRange(const QString& minCategory, const QString& maxCategory); | |
61 |
|
61 | |||
|
62 | void setMin(const QVariant &min); | |||
|
63 | void setMax(const QVariant &max); | |||
|
64 | void setRange(const QVariant &min, const QVariant &max); | |||
|
65 | ||||
62 | Q_SIGNALS: |
|
66 | Q_SIGNALS: | |
63 | void categoriesChanged(); |
|
67 | void categoriesChanged(); | |
64 |
|
68 |
@@ -53,9 +53,9 private: | |||||
53 | void setRangeCategory(const QString& minCategory, const QString& maxCategory); |
|
53 | void setRangeCategory(const QString& minCategory, const QString& maxCategory); | |
54 |
|
54 | |||
55 | //range handling |
|
55 | //range handling | |
56 |
void setMin(const |
|
56 | void setMin(const QVariant &min); | |
57 |
void setMax(const |
|
57 | void setMax(const QVariant &max); | |
58 |
void setRange(const |
|
58 | void setRange(const QVariant &min, const QVariant &max, bool force = false); | |
59 | int ticksCount() const; |
|
59 | int ticksCount() const; | |
60 |
|
60 | |||
61 | Q_SIGNALS: |
|
61 | Q_SIGNALS: |
@@ -151,6 +151,23 qreal QValuesAxis::max() const | |||||
151 | void QValuesAxis::setRange(qreal min, qreal max) |
|
151 | void QValuesAxis::setRange(qreal min, qreal max) | |
152 | { |
|
152 | { | |
153 | Q_D(QValuesAxis); |
|
153 | Q_D(QValuesAxis); | |
|
154 | bool changed = false; | |||
|
155 | if (!qFuzzyIsNull(d->m_min - min)) { | |||
|
156 | d->m_min = min; | |||
|
157 | changed = true; | |||
|
158 | emit minChanged(min); | |||
|
159 | } | |||
|
160 | ||||
|
161 | if (!qFuzzyIsNull(d->m_max - max)) { | |||
|
162 | d->m_max = max; | |||
|
163 | changed = true; | |||
|
164 | emit maxChanged(max); | |||
|
165 | } | |||
|
166 | ||||
|
167 | if (changed) { | |||
|
168 | emit rangeChanged(d->m_min,d->m_max); | |||
|
169 | emit d->changed(d->m_min, d->m_max, d->m_ticksCount, d->m_niceNumbers); | |||
|
170 | } | |||
154 | d->setRange(min,max); |
|
171 | d->setRange(min,max); | |
155 | } |
|
172 | } | |
156 |
|
173 | |||
@@ -218,36 +235,31 void QValuesAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count) | |||||
218 | } |
|
235 | } | |
219 |
|
236 | |||
220 |
|
237 | |||
221 |
void QValuesAxisPrivate::setMin(const |
|
238 | void QValuesAxisPrivate::setMin(const QVariant &min) | |
222 | { |
|
239 | { | |
223 | setRange(min,m_max); |
|
240 | Q_Q(QValuesAxis); | |
|
241 | bool ok; | |||
|
242 | qreal value = min.toReal(&ok); | |||
|
243 | if(ok) q->setMin(value); | |||
224 | } |
|
244 | } | |
225 |
|
245 | |||
226 |
void QValuesAxisPrivate::setMax(const |
|
246 | void QValuesAxisPrivate::setMax(const QVariant &max) | |
227 | { |
|
247 | { | |
228 | setRange(m_min,max); |
|
248 | Q_Q(QValuesAxis); | |
|
249 | bool ok; | |||
|
250 | qreal value = max.toReal(&ok); | |||
|
251 | if(ok) q->setMax(value); | |||
229 | } |
|
252 | } | |
230 |
|
253 | |||
231 |
void QValuesAxisPrivate::setRange(const |
|
254 | void QValuesAxisPrivate::setRange(const QVariant &min, const QVariant &max, bool force) | |
232 | { |
|
255 | { | |
|
256 | Q_UNUSED(force); // TODO: use this | |||
233 | Q_Q(QValuesAxis); |
|
257 | Q_Q(QValuesAxis); | |
234 | bool changed = false; |
|
258 | bool ok1; | |
235 | if (!qFuzzyIsNull(m_min - min)) { |
|
259 | bool ok2; | |
236 | m_min = min; |
|
260 | qreal value1 = min.toReal(&ok1); | |
237 | changed = true; |
|
261 | qreal value2 = max.toReal(&ok2); | |
238 | emit q->minChanged(min); |
|
262 | if(ok1&&ok2) q->setRange(value1,value2); | |
239 | } |
|
|||
240 |
|
||||
241 | if (!qFuzzyIsNull(m_max - max)) { |
|
|||
242 | m_max = max; |
|
|||
243 | changed = true; |
|
|||
244 | emit q->maxChanged(max); |
|
|||
245 | } |
|
|||
246 |
|
||||
247 | if ((changed) ||(force)) { |
|
|||
248 | emit q->rangeChanged(m_min,m_max); |
|
|||
249 | emit this->changed(m_min, m_max, m_ticksCount, m_niceNumbers); |
|
|||
250 | } |
|
|||
251 | } |
|
263 | } | |
252 |
|
264 | |||
253 | int QValuesAxisPrivate::ticksCount() const |
|
265 | int QValuesAxisPrivate::ticksCount() const |
@@ -53,9 +53,9 public: | |||||
53 | void updateRange(); |
|
53 | void updateRange(); | |
54 |
|
54 | |||
55 | protected: |
|
55 | protected: | |
56 |
void setMin(const |
|
56 | void setMin(const QVariant &min); | |
57 |
void setMax(const |
|
57 | void setMax(const QVariant &max); | |
58 |
void setRange(const |
|
58 | void setRange(const QVariant &min, const QVariant &max, bool force = false); | |
59 | int ticksCount() const; |
|
59 | int ticksCount() const; | |
60 |
|
60 | |||
61 | private: |
|
61 | private: |
General Comments 0
You need to be logged in to leave comments.
Login now