@@ -44,7 +44,6 ChartView { | |||
|
44 | 44 | titleText: "EUR" |
|
45 | 45 | min: 0 |
|
46 | 46 | max: 40000 |
|
47 | niceNumbersEnabled: true | |
|
48 | 47 | labelFormat: "%.0f" |
|
49 | 48 | tickCount: 5 |
|
50 | 49 | } |
@@ -70,6 +69,7 ChartView { | |||
|
70 | 69 | } |
|
71 | 70 | chartViewHighlighted.title = selectedSeries.name; |
|
72 | 71 | axisY.max = maxVal; |
|
72 | axisY.applyNiceNumbers() | |
|
73 | 73 | } |
|
74 | 74 | } |
|
75 | 75 |
@@ -80,7 +80,6 void ChartAxisElement::connectSlots() | |||
|
80 | 80 | QObject::connect(axis(), SIGNAL(shadesVisibleChanged(bool)), this, SLOT(handleShadesVisibleChanged(bool))); |
|
81 | 81 | QObject::connect(axis(), SIGNAL(labelsAngleChanged(int)), this, SLOT(handleLabelsAngleChanged(int))); |
|
82 | 82 | QObject::connect(axis(), SIGNAL(linePenChanged(const QPen&)), this, SLOT(handleArrowPenChanged(const QPen&))); |
|
83 | QObject::connect(axis(), SIGNAL(labelsPenChanged(const QPen&)), this, SLOT(handleLabelsPenChanged(const QPen&))); | |
|
84 | 83 | QObject::connect(axis(), SIGNAL(labelsBrushChanged(const QBrush&)), this, SLOT(handleLabelsBrushChanged(const QBrush&))); |
|
85 | 84 | QObject::connect(axis(), SIGNAL(labelsFontChanged(const QFont&)), this, SLOT(handleLabelsFontChanged(const QFont&))); |
|
86 | 85 | QObject::connect(axis(), SIGNAL(gridLinePenChanged(const QPen&)), this, SLOT(handleGridPenChanged(const QPen&))); |
@@ -88,7 +87,6 void ChartAxisElement::connectSlots() | |||
|
88 | 87 | QObject::connect(axis(), SIGNAL(shadesBrushChanged(const QBrush&)), this, SLOT(handleShadesBrushChanged(const QBrush&))); |
|
89 | 88 | QObject::connect(axis(), SIGNAL(titleTextChanged(const QString&)), this, SLOT(handleTitleTextChanged(const QString&))); |
|
90 | 89 | QObject::connect(axis(), SIGNAL(titleFontChanged(const QFont&)), this, SLOT(handleTitleFontChanged(const QFont&))); |
|
91 | QObject::connect(axis(), SIGNAL(titlePenChanged(const QPen&)), this, SLOT(handleTitlePenChanged(const QPen&))); | |
|
92 | 90 | QObject::connect(axis(), SIGNAL(titleBrushChanged(const QBrush&)), this, SLOT(handleTitleBrushChanged(const QBrush&))); |
|
93 | 91 | QObject::connect(axis(), SIGNAL(titleVisibleChanged(bool)), this, SLOT(handleTitleVisibleChanged(bool))); |
|
94 | 92 | QObject::connect(axis()->d_ptr.data(), SIGNAL(rangeChanged(qreal, qreal)), this, SLOT(handleRangeChanged(qreal, qreal))); |
@@ -132,11 +130,6 void ChartAxisElement::handleLabelsAngleChanged(int angle) | |||
|
132 | 130 | presenter()->layout()->invalidate(); |
|
133 | 131 | } |
|
134 | 132 | |
|
135 | void ChartAxisElement::handleLabelsPenChanged(const QPen &pen) | |
|
136 | { | |
|
137 | Q_UNUSED(pen) | |
|
138 | } | |
|
139 | ||
|
140 | 133 | void ChartAxisElement::handleLabelsBrushChanged(const QBrush &brush) |
|
141 | 134 | { |
|
142 | 135 | foreach (QGraphicsItem *item, m_labels->childItems()) |
@@ -159,11 +152,6 void ChartAxisElement::handleTitleTextChanged(const QString &title) | |||
|
159 | 152 | m_title->setHtml(title); |
|
160 | 153 | } |
|
161 | 154 | |
|
162 | void ChartAxisElement::handleTitlePenChanged(const QPen &pen) | |
|
163 | { | |
|
164 | Q_UNUSED(pen) | |
|
165 | } | |
|
166 | ||
|
167 | 155 | void ChartAxisElement::handleTitleBrushChanged(const QBrush &brush) |
|
168 | 156 | { |
|
169 | 157 | m_title->setDefaultTextColor(brush.color()); |
@@ -116,10 +116,8 public Q_SLOTS: | |||
|
116 | 116 | virtual void handleShadesPenChanged(const QPen &pen) = 0; |
|
117 | 117 | virtual void handleArrowPenChanged(const QPen &pen) = 0; |
|
118 | 118 | virtual void handleGridPenChanged(const QPen &pen) = 0; |
|
119 | void handleLabelsPenChanged(const QPen &pen); | |
|
120 | 119 | void handleLabelsBrushChanged(const QBrush &brush); |
|
121 | 120 | void handleLabelsFontChanged(const QFont &font); |
|
122 | void handleTitlePenChanged(const QPen &pen); | |
|
123 | 121 | void handleTitleBrushChanged(const QBrush &brush); |
|
124 | 122 | void handleTitleFontChanged(const QFont &font); |
|
125 | 123 | void handleTitleTextChanged(const QString &title); |
@@ -92,12 +92,6 QT_CHARTS_BEGIN_NAMESPACE | |||
|
92 | 92 | */ |
|
93 | 93 | |
|
94 | 94 | /*! |
|
95 | \property QAbstractAxis::labelsPen | |
|
96 | \deprecated | |
|
97 | The pen of the labels. | |
|
98 | */ | |
|
99 | ||
|
100 | /*! | |
|
101 | 95 | \property QAbstractAxis::labelsBrush |
|
102 | 96 | The brush of the labels. Only the color of the brush is relevant. |
|
103 | 97 | */ |
@@ -220,12 +214,6 QT_CHARTS_BEGIN_NAMESPACE | |||
|
220 | 214 | */ |
|
221 | 215 | |
|
222 | 216 | /*! |
|
223 | \property QAbstractAxis::titlePen | |
|
224 | \deprecated | |
|
225 | The pen of the title text. | |
|
226 | */ | |
|
227 | ||
|
228 | /*! | |
|
229 | 217 | \property QAbstractAxis::titleBrush |
|
230 | 218 | The brush of the title text. Only the color of the brush is relevant. |
|
231 | 219 | */ |
@@ -299,12 +287,6 QT_CHARTS_BEGIN_NAMESPACE | |||
|
299 | 287 | */ |
|
300 | 288 | |
|
301 | 289 | /*! |
|
302 | \fn void QAbstractAxis::labelsPenChanged(const QPen& pen) | |
|
303 | \deprecated | |
|
304 | The pen of the axis labels has changed to \a pen. | |
|
305 | */ | |
|
306 | ||
|
307 | /*! | |
|
308 | 290 | \fn void QAbstractAxis::labelsBrushChanged(const QBrush& brush) |
|
309 | 291 | The brush of the axis labels has changed to \a brush. |
|
310 | 292 | */ |
@@ -369,12 +351,6 QT_CHARTS_BEGIN_NAMESPACE | |||
|
369 | 351 | */ |
|
370 | 352 | |
|
371 | 353 | /*! |
|
372 | \fn void QAbstractAxis::titlePenChanged(const QPen& pen) | |
|
373 | \deprecated | |
|
374 | The pen of the axis shades has changed to \a pen. | |
|
375 | */ | |
|
376 | ||
|
377 | /*! | |
|
378 | 354 | \fn void QAbstractAxis::titleBrushChanged(const QBrush& brush) |
|
379 | 355 | The brush of the axis title has changed to \a brush. |
|
380 | 356 | */ |
@@ -548,22 +524,6 bool QAbstractAxis::labelsVisible() const | |||
|
548 | 524 | return d_ptr->m_labelsVisible; |
|
549 | 525 | } |
|
550 | 526 | |
|
551 | void QAbstractAxis::setLabelsPen(const QPen &pen) | |
|
552 | { | |
|
553 | if (d_ptr->m_labelsPen != pen) { | |
|
554 | d_ptr->m_labelsPen = pen; | |
|
555 | emit labelsPenChanged(pen); | |
|
556 | } | |
|
557 | } | |
|
558 | ||
|
559 | QPen QAbstractAxis::labelsPen() const | |
|
560 | { | |
|
561 | if (d_ptr->m_labelsPen == QChartPrivate::defaultPen()) | |
|
562 | return QPen(); | |
|
563 | else | |
|
564 | return d_ptr->m_labelsPen; | |
|
565 | } | |
|
566 | ||
|
567 | 527 | /*! |
|
568 | 528 | Sets \a brush used to draw labels. |
|
569 | 529 | */ |
@@ -648,22 +608,6 bool QAbstractAxis::isTitleVisible() const | |||
|
648 | 608 | return d_ptr->m_titleVisible; |
|
649 | 609 | } |
|
650 | 610 | |
|
651 | void QAbstractAxis::setTitlePen(const QPen &pen) | |
|
652 | { | |
|
653 | if (d_ptr->m_titlePen != pen) { | |
|
654 | d_ptr->m_titlePen = pen; | |
|
655 | emit titlePenChanged(pen); | |
|
656 | } | |
|
657 | } | |
|
658 | ||
|
659 | QPen QAbstractAxis::titlePen() const | |
|
660 | { | |
|
661 | if (d_ptr->m_titlePen == QChartPrivate::defaultPen()) | |
|
662 | return QPen(); | |
|
663 | else | |
|
664 | return d_ptr->m_titlePen; | |
|
665 | } | |
|
666 | ||
|
667 | 611 | /*! |
|
668 | 612 | Sets \a brush used to draw title. |
|
669 | 613 | */ |
@@ -877,7 +821,7 void QAbstractAxis::setRange(const QVariant &min, const QVariant &max) | |||
|
877 | 821 | /*! |
|
878 | 822 | Returns the orientation in which the axis is being used (Vertical or Horizontal) |
|
879 | 823 | */ |
|
880 | Qt::Orientation QAbstractAxis::orientation() | |
|
824 | Qt::Orientation QAbstractAxis::orientation() const | |
|
881 | 825 | { |
|
882 | 826 | return d_ptr->orientation(); |
|
883 | 827 | } |
@@ -901,12 +845,10 QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q) | |||
|
901 | 845 | m_gridLineVisible(true), |
|
902 | 846 | m_gridLinePen(QChartPrivate::defaultPen()), |
|
903 | 847 | m_labelsVisible(true), |
|
904 | m_labelsPen(QChartPrivate::defaultPen()), | |
|
905 | 848 | m_labelsBrush(QChartPrivate::defaultBrush()), |
|
906 | 849 | m_labelsFont(QChartPrivate::defaultFont()), |
|
907 | 850 | m_labelsAngle(0), |
|
908 | 851 | m_titleVisible(true), |
|
909 | m_titlePen(QChartPrivate::defaultPen()), | |
|
910 | 852 | m_titleBrush(QChartPrivate::defaultBrush()), |
|
911 | 853 | m_titleFont(QChartPrivate::defaultFont()), |
|
912 | 854 | m_shadesVisible(false), |
@@ -949,15 +891,11 void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced) | |||
|
949 | 891 | |
|
950 | 892 | if (forced || QChartPrivate::defaultBrush() == m_labelsBrush) |
|
951 | 893 | q_ptr->setLabelsBrush(theme->labelBrush()); |
|
952 | if (forced || QChartPrivate::defaultPen() == m_labelsPen) | |
|
953 | q_ptr->setLabelsPen(Qt::NoPen); // NoPen for performance reasons | |
|
954 | 894 | if (forced || QChartPrivate::defaultFont() == m_labelsFont) |
|
955 | 895 | q_ptr->setLabelsFont(theme->labelFont()); |
|
956 | 896 | |
|
957 | 897 | if (forced || QChartPrivate::defaultBrush() == m_titleBrush) |
|
958 | 898 | q_ptr->setTitleBrush(theme->labelBrush()); |
|
959 | if (forced || QChartPrivate::defaultPen() == m_titlePen) | |
|
960 | q_ptr->setTitlePen(Qt::NoPen); // NoPen for performance reasons | |
|
961 | 899 | if (forced || QChartPrivate::defaultFont() == m_titleFont) { |
|
962 | 900 | QFont font(m_labelsFont); |
|
963 | 901 | font.setBold(true); |
@@ -39,7 +39,6 class QT_CHARTS_EXPORT QAbstractAxis : public QObject | |||
|
39 | 39 | Q_PROPERTY(QColor color READ linePenColor WRITE setLinePenColor NOTIFY colorChanged) |
|
40 | 40 | //labels |
|
41 | 41 | Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged) |
|
42 | Q_PROPERTY(QPen labelsPen READ labelsPen WRITE setLabelsPen NOTIFY labelsPenChanged) | |
|
43 | 42 | Q_PROPERTY(QBrush labelsBrush READ labelsBrush WRITE setLabelsBrush NOTIFY labelsBrushChanged) |
|
44 | 43 | Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle NOTIFY labelsAngleChanged) |
|
45 | 44 | Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont NOTIFY labelsFontChanged) |
@@ -55,7 +54,6 class QT_CHARTS_EXPORT QAbstractAxis : public QObject | |||
|
55 | 54 | Q_PROPERTY(QBrush shadesBrush READ shadesBrush WRITE setShadesBrush NOTIFY shadesBrushChanged) |
|
56 | 55 | //title |
|
57 | 56 | Q_PROPERTY(QString titleText READ titleText WRITE setTitleText NOTIFY titleTextChanged) |
|
58 | Q_PROPERTY(QPen titlePen READ titlePen WRITE setTitlePen NOTIFY titlePenChanged) | |
|
59 | 57 | Q_PROPERTY(QBrush titleBrush READ titleBrush WRITE setTitleBrush NOTIFY titleBrushChanged) |
|
60 | 58 | Q_PROPERTY(bool titleVisible READ isTitleVisible WRITE setTitleVisible NOTIFY titleVisibleChanged) |
|
61 | 59 | Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont NOTIFY titleFontChanged) |
@@ -108,8 +106,6 public: | |||
|
108 | 106 | //labels handling |
|
109 | 107 | bool labelsVisible() const; |
|
110 | 108 | void setLabelsVisible(bool visible = true); |
|
111 | void setLabelsPen(const QPen &pen); | |
|
112 | QPen labelsPen() const; | |
|
113 | 109 | void setLabelsBrush(const QBrush &brush); |
|
114 | 110 | QBrush labelsBrush() const; |
|
115 | 111 | void setLabelsFont(const QFont &font); |
@@ -122,8 +118,6 public: | |||
|
122 | 118 | //title handling |
|
123 | 119 | bool isTitleVisible() const; |
|
124 | 120 | void setTitleVisible(bool visible = true); |
|
125 | void setTitlePen(const QPen &pen); | |
|
126 | QPen titlePen() const; | |
|
127 | 121 | void setTitleBrush(const QBrush &brush); |
|
128 | 122 | QBrush titleBrush() const; |
|
129 | 123 | void setTitleFont(const QFont &font); |
@@ -143,7 +137,7 public: | |||
|
143 | 137 | void setShadesBorderColor(QColor color); |
|
144 | 138 | QColor shadesBorderColor() const; |
|
145 | 139 | |
|
146 | Qt::Orientation orientation(); | |
|
140 | Qt::Orientation orientation() const; | |
|
147 | 141 | Qt::Alignment alignment() const; |
|
148 | 142 | |
|
149 | 143 | //range handling |
@@ -156,7 +150,6 Q_SIGNALS: | |||
|
156 | 150 | void linePenChanged(const QPen &pen); |
|
157 | 151 | void lineVisibleChanged(bool visible); |
|
158 | 152 | void labelsVisibleChanged(bool visible); |
|
159 | void labelsPenChanged(const QPen &pen); | |
|
160 | 153 | void labelsBrushChanged(const QBrush &brush); |
|
161 | 154 | void labelsFontChanged(const QFont &pen); |
|
162 | 155 | void labelsAngleChanged(int angle); |
@@ -165,7 +158,6 Q_SIGNALS: | |||
|
165 | 158 | void colorChanged(QColor color); |
|
166 | 159 | void labelsColorChanged(QColor color); |
|
167 | 160 | void titleTextChanged(const QString &title); |
|
168 | void titlePenChanged(const QPen &pen); | |
|
169 | 161 | void titleBrushChanged(const QBrush &brush); |
|
170 | 162 | void titleVisibleChanged(bool visible); |
|
171 | 163 | void titleFontChanged(const QFont &font); |
@@ -100,13 +100,11 private: | |||
|
100 | 100 | QPen m_gridLinePen; |
|
101 | 101 | |
|
102 | 102 | bool m_labelsVisible; |
|
103 | QPen m_labelsPen; | |
|
104 | 103 | QBrush m_labelsBrush; |
|
105 | 104 | QFont m_labelsFont; |
|
106 | 105 | int m_labelsAngle; |
|
107 | 106 | |
|
108 | 107 | bool m_titleVisible; |
|
109 | QPen m_titlePen; | |
|
110 | 108 | QBrush m_titleBrush; |
|
111 | 109 | QFont m_titleFont; |
|
112 | 110 | QString m_title; |
@@ -172,17 +172,6 QT_CHARTS_BEGIN_NAMESPACE | |||
|
172 | 172 | */ |
|
173 | 173 | |
|
174 | 174 | /*! |
|
175 | \property QValueAxis::niceNumbersEnabled | |
|
176 | \obsolete | |
|
177 | Using this function can lead to unexpected behavior. Use applyNiceNumbers() instead. | |
|
178 | */ | |
|
179 | ||
|
180 | /*! | |
|
181 | \qmlproperty bool ValueAxis::niceNumbersEnabled | |
|
182 | Deprecated; Using this function can lead to unexpected behavior. Use applyNiceNumbers() instead. | |
|
183 | */ | |
|
184 | ||
|
185 | /*! | |
|
186 | 175 | Constructs an axis object which is a child of \a parent. |
|
187 | 176 | */ |
|
188 | 177 | QValueAxis::QValueAxis(QObject *parent) : |
@@ -259,31 +248,6 int QValueAxis::tickCount() const | |||
|
259 | 248 | return d->m_tickCount; |
|
260 | 249 | } |
|
261 | 250 | |
|
262 | void QValueAxis::setNiceNumbersEnabled(bool enable) | |
|
263 | { | |
|
264 | Q_D(QValueAxis); | |
|
265 | qWarning() << "Deprecated; Using this function can lead to unexpected behavior. " \ | |
|
266 | "Use applyNiceNumbers() instead."; | |
|
267 | if(enable) { | |
|
268 | QObject::connect(this,SIGNAL(rangeChanged(qreal,qreal)),this,SLOT(applyNiceNumbers())); | |
|
269 | QObject::connect(this,SIGNAL(tickCountChanged(int)),this,SLOT(applyNiceNumbers())); | |
|
270 | applyNiceNumbers(); | |
|
271 | } | |
|
272 | else { | |
|
273 | QObject::disconnect(this,SIGNAL(rangeChanged(qreal,qreal)),this,SLOT(applyNiceNumbers())); | |
|
274 | QObject::disconnect(this,SIGNAL(tickCountChanged(int)),this,SLOT(applyNiceNumbers())); | |
|
275 | } | |
|
276 | d->m_niceNumbersEnabled=enable; | |
|
277 | } | |
|
278 | ||
|
279 | bool QValueAxis::niceNumbersEnabled() const | |
|
280 | { | |
|
281 | Q_D(const QValueAxis); | |
|
282 | qWarning() << "Deprecated; Using this function can lead to unexpected behavior. " \ | |
|
283 | "Use applyNiceNumbers() instead."; | |
|
284 | return d->m_niceNumbersEnabled; | |
|
285 | } | |
|
286 | ||
|
287 | 251 | void QValueAxis::setLabelFormat(const QString &format) |
|
288 | 252 | { |
|
289 | 253 | Q_D(QValueAxis); |
@@ -333,8 +297,7 QValueAxisPrivate::QValueAxisPrivate(QValueAxis *q) | |||
|
333 | 297 | m_max(0), |
|
334 | 298 | m_tickCount(5), |
|
335 | 299 | m_format(QString::null), |
|
336 |
m_applying(false) |
|
|
337 | m_niceNumbersEnabled(false) | |
|
300 | m_applying(false) | |
|
338 | 301 | { |
|
339 | 302 | |
|
340 | 303 | } |
@@ -29,7 +29,6 class QT_CHARTS_EXPORT QValueAxis : public QAbstractAxis | |||
|
29 | 29 | { |
|
30 | 30 | Q_OBJECT |
|
31 | 31 | Q_PROPERTY(int tickCount READ tickCount WRITE setTickCount NOTIFY tickCountChanged) |
|
32 | Q_PROPERTY(bool niceNumbersEnabled READ niceNumbersEnabled WRITE setNiceNumbersEnabled) | |
|
33 | 32 | Q_PROPERTY(qreal min READ min WRITE setMin NOTIFY minChanged) |
|
34 | 33 | Q_PROPERTY(qreal max READ max WRITE setMax NOTIFY maxChanged) |
|
35 | 34 | Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged) |
@@ -58,9 +57,6 public: | |||
|
58 | 57 | void setLabelFormat(const QString &format); |
|
59 | 58 | QString labelFormat() const; |
|
60 | 59 | |
|
61 | void setNiceNumbersEnabled(bool enable = true); | |
|
62 | bool niceNumbersEnabled() const; | |
|
63 | ||
|
64 | 60 | public Q_SLOTS: |
|
65 | 61 | void applyNiceNumbers(); |
|
66 | 62 |
@@ -44,8 +44,8 public: | |||
|
44 | 44 | void initializeGraphics(QGraphicsItem* parent); |
|
45 | 45 | void initializeDomain(AbstractDomain *domain); |
|
46 | 46 | |
|
47 |
qreal min() { return m_min; } |
|
|
48 |
qreal max() { return m_max; } |
|
|
47 | qreal min() { return m_min; } | |
|
48 | qreal max() { return m_max; } | |
|
49 | 49 | void setRange(qreal min,qreal max); |
|
50 | 50 | |
|
51 | 51 | protected: |
@@ -59,7 +59,6 private: | |||
|
59 | 59 | int m_tickCount; |
|
60 | 60 | QString m_format; |
|
61 | 61 | bool m_applying; |
|
62 | bool m_niceNumbersEnabled; | |
|
63 | 62 | Q_DECLARE_PUBLIC(QValueAxis) |
|
64 | 63 | }; |
|
65 | 64 |
@@ -102,14 +102,6 QT_CHARTS_BEGIN_NAMESPACE | |||
|
102 | 102 | */ |
|
103 | 103 | |
|
104 | 104 | /*! |
|
105 | \property QChart::minimumMargins | |
|
106 | Minimum margins between the plot area (axes) and the edge of the chart widget. | |
|
107 | This property is deprecated; use margins property instead. | |
|
108 | ||
|
109 | \sa margins | |
|
110 | */ | |
|
111 | ||
|
112 | /*! | |
|
113 | 105 | \property QChart::margins |
|
114 | 106 | Margins between the plot area (axes) and the edge of the chart widget. |
|
115 | 107 | */ |
@@ -503,18 +495,6 QLegend *QChart::legend() const | |||
|
503 | 495 | return d_ptr->m_legend; |
|
504 | 496 | } |
|
505 | 497 | |
|
506 | void QChart::setMinimumMargins(const QMargins &margins) | |
|
507 | { | |
|
508 | qWarning() << "QChart::setMinimumMargins is deprecated. Use QChart::setMargins instead."; | |
|
509 | d_ptr->m_presenter->layout()->setMargins(margins); | |
|
510 | } | |
|
511 | ||
|
512 | QMargins QChart::minimumMargins() const | |
|
513 | { | |
|
514 | qWarning() << "QChart::minimumMargins is deprecated. Use QChart::margins instead."; | |
|
515 | return d_ptr->m_presenter->layout()->margins(); | |
|
516 | } | |
|
517 | ||
|
518 | 498 | void QChart::setMargins(const QMargins &margins) |
|
519 | 499 | { |
|
520 | 500 | d_ptr->m_presenter->layout()->setMargins(margins); |
@@ -43,7 +43,6 class QT_CHARTS_EXPORT QChart : public QGraphicsWidget | |||
|
43 | 43 | Q_PROPERTY(bool dropShadowEnabled READ isDropShadowEnabled WRITE setDropShadowEnabled) |
|
44 | 44 | Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness) |
|
45 | 45 | Q_PROPERTY(QChart::AnimationOptions animationOptions READ animationOptions WRITE setAnimationOptions) |
|
46 | Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins) | |
|
47 | 46 | Q_PROPERTY(QMargins margins READ margins WRITE setMargins) |
|
48 | 47 | Q_PROPERTY(QChart::ChartType chartType READ chartType) |
|
49 | 48 | Q_PROPERTY(bool plotAreaBackgroundVisible READ isPlotAreaBackgroundVisible WRITE setPlotAreaBackgroundVisible) |
@@ -139,9 +138,6 public: | |||
|
139 | 138 | |
|
140 | 139 | QLegend *legend() const; |
|
141 | 140 | |
|
142 | void setMinimumMargins(const QMargins& margins); | |
|
143 | QMargins minimumMargins() const; | |
|
144 | ||
|
145 | 141 | void setMargins(const QMargins &margins); |
|
146 | 142 | QMargins margins() const; |
|
147 | 143 |
@@ -29,7 +29,7 | |||
|
29 | 29 | |
|
30 | 30 | \value NoRubberBand |
|
31 | 31 | \value VerticalRubberBand |
|
32 | \value HorizonalRubberBand | |
|
32 | \value HorizontalRubberBand | |
|
33 | 33 | \value RectangleRubberBand |
|
34 | 34 | */ |
|
35 | 35 | |
@@ -170,7 +170,7 void QChartView::mouseMoveEvent(QMouseEvent *event) | |||
|
170 | 170 | d_ptr->m_rubberBandOrigin.setY(rect.top()); |
|
171 | 171 | height = rect.height(); |
|
172 | 172 | } |
|
173 | if (!d_ptr->m_rubberBandFlags.testFlag(HorizonalRubberBand)) { | |
|
173 | if (!d_ptr->m_rubberBandFlags.testFlag(HorizontalRubberBand)) { | |
|
174 | 174 | d_ptr->m_rubberBandOrigin.setX(rect.left()); |
|
175 | 175 | width = rect.width(); |
|
176 | 176 | } |
@@ -201,7 +201,7 void QChartView::mouseReleaseEvent(QMouseEvent *event) | |||
|
201 | 201 | if (d_ptr->m_rubberBandFlags == VerticalRubberBand) { |
|
202 | 202 | rect.setX(d_ptr->m_chart->plotArea().x()); |
|
203 | 203 | rect.setWidth(d_ptr->m_chart->plotArea().width()); |
|
204 | } else if (d_ptr->m_rubberBandFlags == HorizonalRubberBand) { | |
|
204 | } else if (d_ptr->m_rubberBandFlags == HorizontalRubberBand) { | |
|
205 | 205 | rect.setY(d_ptr->m_chart->plotArea().y()); |
|
206 | 206 | rect.setHeight(d_ptr->m_chart->plotArea().height()); |
|
207 | 207 | } |
@@ -214,12 +214,12 void QChartView::mouseReleaseEvent(QMouseEvent *event) | |||
|
214 | 214 | // Since there is no suitable API for that, use zoomIn with rect bigger than the |
|
215 | 215 | // plot area. |
|
216 | 216 | if (d_ptr->m_rubberBandFlags == VerticalRubberBand |
|
217 | || d_ptr->m_rubberBandFlags == HorizonalRubberBand) { | |
|
217 | || d_ptr->m_rubberBandFlags == HorizontalRubberBand) { | |
|
218 | 218 | QRectF rect = d_ptr->m_chart->plotArea(); |
|
219 | 219 | if (d_ptr->m_rubberBandFlags == VerticalRubberBand) { |
|
220 | 220 | qreal adjustment = rect.height() / 2; |
|
221 | 221 | rect.adjust(0, -adjustment, 0, adjustment); |
|
222 | } else if (d_ptr->m_rubberBandFlags == HorizonalRubberBand) { | |
|
222 | } else if (d_ptr->m_rubberBandFlags == HorizontalRubberBand) { | |
|
223 | 223 | qreal adjustment = rect.width() / 2; |
|
224 | 224 | rect.adjust(-adjustment, 0, adjustment, 0); |
|
225 | 225 | } |
@@ -40,7 +40,7 public: | |||
|
40 | 40 | enum RubberBand { |
|
41 | 41 | NoRubberBand = 0x0, |
|
42 | 42 | VerticalRubberBand = 0x1, |
|
43 | HorizonalRubberBand = 0x2, | |
|
43 | HorizontalRubberBand = 0x2, | |
|
44 | 44 | RectangleRubberBand = 0x3 |
|
45 | 45 | }; |
|
46 | 46 |
@@ -132,40 +132,10 QT_CHARTS_BEGIN_NAMESPACE | |||
|
132 | 132 | */ |
|
133 | 133 | |
|
134 | 134 | /*! |
|
135 | \qmlproperty real ChartView::topMargin | |
|
136 | Deprecated; use margins instead. | |
|
137 | */ | |
|
138 | ||
|
139 | /*! | |
|
140 | \qmlproperty real ChartView::bottomMargin | |
|
141 | Deprecated; use margins instead. | |
|
142 | */ | |
|
143 | ||
|
144 | /*! | |
|
145 | \qmlproperty real ChartView::leftMargin | |
|
146 | Deprecated; use margins instead. | |
|
147 | */ | |
|
148 | ||
|
149 | /*! | |
|
150 | \qmlproperty real ChartView::rightMargin | |
|
151 | Deprecated; use margins instead. | |
|
152 | */ | |
|
153 | ||
|
154 | /*! | |
|
155 | \qmlproperty Margins ChartView::minimumMargins | |
|
156 | Deprecated; use margins instead. | |
|
157 | The minimum margins allowed between the outer bounds and the plotArea of the ChartView. Margins | |
|
158 | area of ChartView is used for drawing title, axes and legend. Please note that setting the | |
|
159 | properties of minimumMargins may be bigger than the defined value, depending on other ChartView | |
|
160 | properties that affect it's layout. If you need to know the actual plotting area used at any | |
|
161 | given time, you can check ChartView::plotArea instead. | |
|
162 | */ | |
|
163 | ||
|
164 | /*! | |
|
165 | 135 | \qmlproperty rect ChartView::plotArea |
|
166 | 136 | The area on the ChartView that is used for drawing series. This is the ChartView rect without the |
|
167 | 137 | margins. |
|
168 |
\sa ChartView::m |
|
|
138 | \sa ChartView::margins | |
|
169 | 139 | */ |
|
170 | 140 | |
|
171 | 141 | /*! |
@@ -314,10 +284,14 void DeclarativeChart::initChart(QChart::ChartType type) | |||
|
314 | 284 | m_margins->setLeft(m_chart->margins().left()); |
|
315 | 285 | m_margins->setRight(m_chart->margins().right()); |
|
316 | 286 | m_margins->setBottom(m_chart->margins().bottom()); |
|
317 |
connect(m_margins, SIGNAL(topChanged(int,int,int,int)), |
|
|
318 | connect(m_margins, SIGNAL(bottomChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int))); | |
|
319 |
connect(m_margins, SIGNAL( |
|
|
320 | connect(m_margins, SIGNAL(rightChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int))); | |
|
287 | connect(m_margins, SIGNAL(topChanged(int,int,int,int)), | |
|
288 | this, SLOT(changeMargins(int,int,int,int))); | |
|
289 | connect(m_margins, SIGNAL(bottomChanged(int,int,int,int)), | |
|
290 | this, SLOT(changeMargins(int,int,int,int))); | |
|
291 | connect(m_margins, SIGNAL(leftChanged(int,int,int,int)), | |
|
292 | this, SLOT(changeMargins(int,int,int,int))); | |
|
293 | connect(m_margins, SIGNAL(rightChanged(int,int,int,int)), | |
|
294 | this, SLOT(changeMargins(int,int,int,int))); | |
|
321 | 295 | connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), this, SLOT(handleSeriesAdded(QAbstractSeries*))); |
|
322 | 296 | connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), this, SIGNAL(seriesRemoved(QAbstractSeries*))); |
|
323 | 297 | connect(m_chart, &QChart::plotAreaChanged, this, &DeclarativeChart::plotAreaChanged); |
@@ -328,10 +302,10 void DeclarativeChart::handleSeriesAdded(QAbstractSeries *series) | |||
|
328 | 302 | emit seriesAdded(series); |
|
329 | 303 | } |
|
330 | 304 | |
|
331 |
void DeclarativeChart::changeM |
|
|
305 | void DeclarativeChart::changeMargins(int top, int bottom, int left, int right) | |
|
332 | 306 | { |
|
333 | 307 | m_chart->setMargins(QMargins(left, top, right, bottom)); |
|
334 |
emit m |
|
|
308 | emit marginsChanged(); | |
|
335 | 309 | } |
|
336 | 310 | |
|
337 | 311 | DeclarativeChart::~DeclarativeChart() |
@@ -793,30 +767,6 void DeclarativeChart::setBackgroundRoundness(qreal diameter) | |||
|
793 | 767 | } |
|
794 | 768 | } |
|
795 | 769 | |
|
796 | qreal DeclarativeChart::topMargin() | |
|
797 | { | |
|
798 | qWarning() << "ChartView.topMargin is deprecated. Use margins instead."; | |
|
799 | return m_chart->margins().top(); | |
|
800 | } | |
|
801 | ||
|
802 | qreal DeclarativeChart::bottomMargin() | |
|
803 | { | |
|
804 | qWarning() << "ChartView.bottomMargin is deprecated. Use margins instead."; | |
|
805 | return m_chart->margins().bottom(); | |
|
806 | } | |
|
807 | ||
|
808 | qreal DeclarativeChart::leftMargin() | |
|
809 | { | |
|
810 | qWarning() << "ChartView.leftMargin is deprecated. Use margins instead."; | |
|
811 | return m_chart->margins().left(); | |
|
812 | } | |
|
813 | ||
|
814 | qreal DeclarativeChart::rightMargin() | |
|
815 | { | |
|
816 | qWarning() << "ChartView.rightMargin is deprecated. Use margins instead."; | |
|
817 | return m_chart->margins().right(); | |
|
818 | } | |
|
819 | ||
|
820 | 770 | void DeclarativeChart::zoom(qreal factor) |
|
821 | 771 | { |
|
822 | 772 | m_chart->zoom(factor); |
@@ -995,11 +945,6 void DeclarativeChart::setAxisY(QAbstractAxis *axis, QAbstractSeries *series) | |||
|
995 | 945 | seriesAxisAttachHelper(series, axis, Qt::Vertical, Qt::AlignLeft); |
|
996 | 946 | } |
|
997 | 947 | |
|
998 | void DeclarativeChart::createDefaultAxes() | |
|
999 | { | |
|
1000 | qWarning() << "ChartView.createDefaultAxes() is deprecated. Axes are created automatically."; | |
|
1001 | } | |
|
1002 | ||
|
1003 | 948 | QAbstractAxis *DeclarativeChart::defaultAxis(Qt::Orientation orientation, QAbstractSeries *series) |
|
1004 | 949 | { |
|
1005 | 950 | if (!series) { |
@@ -47,11 +47,6 class DeclarativeChart : public QQuickPaintedItem | |||
|
47 | 47 | Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged) |
|
48 | 48 | Q_PROPERTY(bool dropShadowEnabled READ dropShadowEnabled WRITE setDropShadowEnabled NOTIFY dropShadowEnabledChanged) |
|
49 | 49 | Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness NOTIFY backgroundRoundnessChanged REVISION 3) |
|
50 | Q_PROPERTY(qreal topMargin READ topMargin) | |
|
51 | Q_PROPERTY(qreal bottomMargin READ bottomMargin) | |
|
52 | Q_PROPERTY(qreal leftMargin READ leftMargin) | |
|
53 | Q_PROPERTY(qreal rightMargin READ rightMargin) | |
|
54 | Q_PROPERTY(DeclarativeMargins *minimumMargins READ minimumMargins NOTIFY minimumMarginsChanged REVISION 1) | |
|
55 | 50 | Q_PROPERTY(DeclarativeMargins *margins READ margins NOTIFY marginsChanged REVISION 2) |
|
56 | 51 | Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged REVISION 1) |
|
57 | 52 | Q_PROPERTY(QColor plotAreaColor READ plotAreaColor WRITE setPlotAreaColor NOTIFY plotAreaColorChanged REVISION 3) |
@@ -144,11 +139,6 public: | |||
|
144 | 139 | void setBackgroundRoundness(qreal diameter); |
|
145 | 140 | |
|
146 | 141 | // Margins & plotArea |
|
147 | qreal topMargin(); | |
|
148 | qreal bottomMargin(); | |
|
149 | qreal leftMargin(); | |
|
150 | qreal rightMargin(); | |
|
151 | DeclarativeMargins *minimumMargins() { return m_margins; } | |
|
152 | 142 | DeclarativeMargins *margins() { return m_margins; } |
|
153 | 143 | QRectF plotArea() { return m_chart->plotArea(); } |
|
154 | 144 | |
@@ -170,7 +160,6 public: | |||
|
170 | 160 | Q_INVOKABLE void removeAllSeries() { m_chart->removeAllSeries(); } |
|
171 | 161 | Q_INVOKABLE void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0); |
|
172 | 162 | Q_INVOKABLE void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0); |
|
173 | Q_INVOKABLE void createDefaultAxes(); | |
|
174 | 163 | Q_INVOKABLE QAbstractAxis *axisX(QAbstractSeries *series = 0); |
|
175 | 164 | Q_INVOKABLE QAbstractAxis *axisY(QAbstractSeries *series = 0); |
|
176 | 165 | Q_INVOKABLE void zoom(qreal factor); |
@@ -184,7 +173,6 Q_SIGNALS: | |||
|
184 | 173 | void titleColorChanged(QColor color); |
|
185 | 174 | void backgroundColorChanged(); |
|
186 | 175 | void dropShadowEnabledChanged(bool enabled); |
|
187 | void minimumMarginsChanged(); | |
|
188 | 176 | Q_REVISION(2) void marginsChanged(); |
|
189 | 177 | void plotAreaChanged(QRectF plotArea); |
|
190 | 178 | void seriesAdded(QAbstractSeries *series); |
@@ -195,7 +183,7 Q_SIGNALS: | |||
|
195 | 183 | Q_REVISION(4) void localeChanged(); |
|
196 | 184 | |
|
197 | 185 | private Q_SLOTS: |
|
198 |
void changeM |
|
|
186 | void changeMargins(int top, int bottom, int left, int right); | |
|
199 | 187 | void handleAxisXSet(QAbstractAxis *axis); |
|
200 | 188 | void handleAxisYSet(QAbstractAxis *axis); |
|
201 | 189 | void handleAxisXTopSet(QAbstractAxis *axis); |
@@ -522,17 +522,6 Module { | |||
|
522 | 522 | Property { name: "backgroundColor"; type: "QColor" } |
|
523 | 523 | Property { name: "dropShadowEnabled"; type: "bool" } |
|
524 | 524 | Property { name: "backgroundRoundness"; revision: 3; type: "double" } |
|
525 | Property { name: "topMargin"; type: "double"; isReadonly: true } | |
|
526 | Property { name: "bottomMargin"; type: "double"; isReadonly: true } | |
|
527 | Property { name: "leftMargin"; type: "double"; isReadonly: true } | |
|
528 | Property { name: "rightMargin"; type: "double"; isReadonly: true } | |
|
529 | Property { | |
|
530 | name: "minimumMargins" | |
|
531 | revision: 1 | |
|
532 | type: "DeclarativeMargins" | |
|
533 | isReadonly: true | |
|
534 | isPointer: true | |
|
535 | } | |
|
536 | 525 | Property { |
|
537 | 526 | name: "margins" |
|
538 | 527 | revision: 2 |
@@ -634,7 +623,6 Module { | |||
|
634 | 623 | name: "setAxisY" |
|
635 | 624 | Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true } |
|
636 | 625 | } |
|
637 | Method { name: "createDefaultAxes" } | |
|
638 | 626 | Method { |
|
639 | 627 | name: "axisX" |
|
640 | 628 | type: "QAbstractAxis*" |
@@ -1500,7 +1488,6 Module { | |||
|
1500 | 1488 | Property { name: "linePen"; type: "QPen" } |
|
1501 | 1489 | Property { name: "color"; type: "QColor" } |
|
1502 | 1490 | Property { name: "labelsVisible"; type: "bool" } |
|
1503 | Property { name: "labelsPen"; type: "QPen" } | |
|
1504 | 1491 | Property { name: "labelsBrush"; type: "QBrush" } |
|
1505 | 1492 | Property { name: "labelsAngle"; type: "int" } |
|
1506 | 1493 | Property { name: "labelsFont"; type: "QFont" } |
@@ -1513,7 +1500,6 Module { | |||
|
1513 | 1500 | Property { name: "shadesPen"; type: "QPen" } |
|
1514 | 1501 | Property { name: "shadesBrush"; type: "QBrush" } |
|
1515 | 1502 | Property { name: "titleText"; type: "string" } |
|
1516 | Property { name: "titlePen"; type: "QPen" } | |
|
1517 | 1503 | Property { name: "titleBrush"; type: "QBrush" } |
|
1518 | 1504 | Property { name: "titleVisible"; type: "bool" } |
|
1519 | 1505 | Property { name: "titleFont"; type: "QFont" } |
@@ -1536,10 +1522,6 Module { | |||
|
1536 | 1522 | Parameter { name: "visible"; type: "bool" } |
|
1537 | 1523 | } |
|
1538 | 1524 | Signal { |
|
1539 | name: "labelsPenChanged" | |
|
1540 | Parameter { name: "pen"; type: "QPen" } | |
|
1541 | } | |
|
1542 | Signal { | |
|
1543 | 1525 | name: "labelsBrushChanged" |
|
1544 | 1526 | Parameter { name: "brush"; type: "QBrush" } |
|
1545 | 1527 | } |
@@ -1572,10 +1554,6 Module { | |||
|
1572 | 1554 | Parameter { name: "title"; type: "string" } |
|
1573 | 1555 | } |
|
1574 | 1556 | Signal { |
|
1575 | name: "titlePenChanged" | |
|
1576 | Parameter { name: "pen"; type: "QPen" } | |
|
1577 | } | |
|
1578 | Signal { | |
|
1579 | 1557 | name: "titleBrushChanged" |
|
1580 | 1558 | Parameter { name: "brush"; type: "QBrush" } |
|
1581 | 1559 | } |
@@ -2297,7 +2275,6 Module { | |||
|
2297 | 2275 | ] |
|
2298 | 2276 | exportMetaObjectRevisions: [0, 0, 0] |
|
2299 | 2277 | Property { name: "tickCount"; type: "int" } |
|
2300 | Property { name: "niceNumbersEnabled"; type: "bool" } | |
|
2301 | 2278 | Property { name: "min"; type: "double" } |
|
2302 | 2279 | Property { name: "max"; type: "double" } |
|
2303 | 2280 | Property { name: "labelFormat"; type: "string" } |
@@ -56,7 +56,6 void tst_QAbstractAxis::qabstractaxis() | |||
|
56 | 56 | QCOMPARE(m_axis->labelsAngle(), 0); |
|
57 | 57 | QCOMPARE(m_axis->labelsBrush(), QBrush()); |
|
58 | 58 | QCOMPARE(m_axis->labelsFont(), QFont()); |
|
59 | QCOMPARE(m_axis->labelsPen(), QPen()); | |
|
60 | 59 | QCOMPARE(m_axis->labelsVisible(), true); |
|
61 | 60 | QCOMPARE(m_axis->orientation(), Qt::Orientation(0)); |
|
62 | 61 | m_axis->setLineVisible(false); |
@@ -68,7 +67,6 void tst_QAbstractAxis::qabstractaxis() | |||
|
68 | 67 | m_axis->setLabelsBrush(QBrush()); |
|
69 | 68 | m_axis->setLabelsColor(QColor()); |
|
70 | 69 | m_axis->setLabelsFont(QFont()); |
|
71 | m_axis->setLabelsPen(QPen()); | |
|
72 | 70 | m_axis->setLabelsVisible(false); |
|
73 | 71 | m_axis->setMax(QVariant()); |
|
74 | 72 | m_axis->setMin(QVariant()); |
@@ -443,48 +441,6 void tst_QAbstractAxis::labelsFont() | |||
|
443 | 441 | |
|
444 | 442 | } |
|
445 | 443 | |
|
446 | void tst_QAbstractAxis::labelsPen_data() | |
|
447 | { | |
|
448 | QTest::addColumn<QPen>("labelsPen"); | |
|
449 | QTest::newRow("null") << QPen(); | |
|
450 | QTest::newRow("blue") << QPen(Qt::blue); | |
|
451 | QTest::newRow("black") << QPen(Qt::black); | |
|
452 | QTest::newRow("red") << QPen(Qt::red); | |
|
453 | } | |
|
454 | ||
|
455 | void tst_QAbstractAxis::labelsPen() | |
|
456 | { | |
|
457 | QFETCH(QPen, labelsPen); | |
|
458 | ||
|
459 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
|
460 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
|
461 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
|
462 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
|
463 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
|
464 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
|
465 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
|
466 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
|
467 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
|
468 | ||
|
469 | m_axis->setLabelsPen(labelsPen); | |
|
470 | QCOMPARE(m_axis->labelsPen(), labelsPen); | |
|
471 | ||
|
472 | QCOMPARE(spy0.count(), 0); | |
|
473 | QCOMPARE(spy1.count(), 0); | |
|
474 | QCOMPARE(spy2.count(), 0); | |
|
475 | QCOMPARE(spy3.count(), 0); | |
|
476 | QCOMPARE(spy4.count(), 0); | |
|
477 | QCOMPARE(spy5.count(), 0); | |
|
478 | QCOMPARE(spy6.count(), 0); | |
|
479 | QCOMPARE(spy7.count(), 0); | |
|
480 | QCOMPARE(spy8.count(), 0); | |
|
481 | ||
|
482 | m_chart->setAxisX(m_axis, m_series); | |
|
483 | m_view->show(); | |
|
484 | QTest::qWaitForWindowShown(m_view); | |
|
485 | //TODO QCOMPARE(m_axis->labelsPen(), labelsPen); | |
|
486 | } | |
|
487 | ||
|
488 | 444 | void tst_QAbstractAxis::labelsVisible_data() |
|
489 | 445 | { |
|
490 | 446 | QTest::addColumn<bool>("labelsVisible"); |
@@ -57,8 +57,6 private slots: | |||
|
57 | 57 | void labelsColor(); |
|
58 | 58 | void labelsFont_data(); |
|
59 | 59 | void labelsFont(); |
|
60 | void labelsPen_data(); | |
|
61 | void labelsPen(); | |
|
62 | 60 | void labelsVisible_data(); |
|
63 | 61 | void labelsVisible(); |
|
64 | 62 | void orientation_data(); |
@@ -120,11 +120,11 void tst_QChartView::rubberBand_data() | |||
|
120 | 120 | QTest::addColumn<QPoint>("max"); |
|
121 | 121 | |
|
122 | 122 | if (isPolarTest()) { |
|
123 | QTest::newRow("HorizonalRubberBand") << QChartView::RubberBands(QChartView::HorizonalRubberBand) << 0 << 0 << QPoint(5,5) << QPoint(5,5); | |
|
123 | QTest::newRow("HorizontalRubberBand") << QChartView::RubberBands(QChartView::HorizontalRubberBand) << 0 << 0 << QPoint(5,5) << QPoint(5,5); | |
|
124 | 124 | QTest::newRow("VerticalRubberBand") << QChartView::RubberBands(QChartView::VerticalRubberBand) << 0 << 0 << QPoint(5,5) << QPoint(5,5); |
|
125 | 125 | QTest::newRow("RectangleRubberBand") << QChartView::RubberBands(QChartView::RectangleRubberBand) << 0 << 0 << QPoint(5,5) << QPoint(5,5); |
|
126 | 126 | } else { |
|
127 | QTest::newRow("HorizonalRubberBand") << QChartView::RubberBands(QChartView::HorizonalRubberBand) << 0 << 1 << QPoint(5,5) << QPoint(5,5); | |
|
127 | QTest::newRow("HorizontalRubberBand") << QChartView::RubberBands(QChartView::HorizontalRubberBand) << 0 << 1 << QPoint(5,5) << QPoint(5,5); | |
|
128 | 128 | QTest::newRow("VerticalRubberBand") << QChartView::RubberBands(QChartView::VerticalRubberBand) << 1 << 0 << QPoint(5,5) << QPoint(5,5); |
|
129 | 129 | QTest::newRow("RectangleRubberBand") << QChartView::RubberBands(QChartView::RectangleRubberBand) << 1 << 1 << QPoint(5,5) << QPoint(5,5); |
|
130 | 130 | } |
@@ -32,10 +32,6 Rectangle { | |||
|
32 | 32 | function test_chartViewProperties() { |
|
33 | 33 | compare(chartView.animationOptions, ChartView.NoAnimation, "ChartView.animationOptions"); |
|
34 | 34 | verify(chartView.backgroundColor != undefined); |
|
35 | verify(chartView.bottomMargin > 0, "ChartView.bottomMargin"); | |
|
36 | verify(chartView.topMargin > 0, "ChartView.topMargin"); | |
|
37 | verify(chartView.leftMargin > 0, "ChartView.leftMargin"); | |
|
38 | verify(chartView.rightMargin > 0, "ChartView.rightMargin"); | |
|
39 | 35 | compare(chartView.count, 0, "ChartView.count"); |
|
40 | 36 | compare(chartView.dropShadowEnabled, false, "ChartView.dropShadowEnabled"); |
|
41 | 37 | verify(chartView.plotArea.height > 0, "ChartView.plotArea.height"); |
@@ -103,7 +103,6 void tst_QValueAxis::qvalueaxis() | |||
|
103 | 103 | |
|
104 | 104 | QVERIFY(qFuzzyCompare(m_valuesaxis->max(), 0)); |
|
105 | 105 | QVERIFY(qFuzzyCompare(m_valuesaxis->min(), 0)); |
|
106 | QCOMPARE(m_valuesaxis->niceNumbersEnabled(), false); | |
|
107 | 106 | QCOMPARE(m_valuesaxis->tickCount(), 5); |
|
108 | 107 | QCOMPARE(m_valuesaxis->type(), QAbstractAxis::AxisTypeValue); |
|
109 | 108 | |
@@ -113,7 +112,6 void tst_QValueAxis::qvalueaxis() | |||
|
113 | 112 | |
|
114 | 113 | QVERIFY(!qFuzzyCompare(m_valuesaxis->max(), 0)); |
|
115 | 114 | QVERIFY(!qFuzzyCompare(m_valuesaxis->min(), 0)); |
|
116 | QCOMPARE(m_valuesaxis->niceNumbersEnabled(), false); | |
|
117 | 115 | QCOMPARE(m_valuesaxis->tickCount(), 5); |
|
118 | 116 | } |
|
119 | 117 |
@@ -68,7 +68,7 MainWidget::MainWidget(QWidget *parent) : | |||
|
68 | 68 | |
|
69 | 69 | // Create chart view with the chart |
|
70 | 70 | m_chartView = new QChartView(m_chart, this); |
|
71 | m_chartView->setRubberBand(QChartView::HorizonalRubberBand); | |
|
71 | m_chartView->setRubberBand(QChartView::HorizontalRubberBand); | |
|
72 | 72 | |
|
73 | 73 | // Another grid layout as a main layout |
|
74 | 74 | QGridLayout *mainLayout = new QGridLayout(); |
@@ -60,8 +60,6 MainWindow::MainWindow(QWidget *parent) : | |||
|
60 | 60 | m_plotAreaBackgroundBrush(new QBrush(Qt::NoBrush)), |
|
61 | 61 | m_angularShadesPen(new QPen(Qt::NoPen)), |
|
62 | 62 | m_radialShadesPen(new QPen(Qt::NoPen)), |
|
63 | m_labelPen(new QPen(Qt::NoPen)), | |
|
64 | m_titlePen(new QPen(Qt::NoPen)), | |
|
65 | 63 | m_gridPen(new QPen(QRgb(0x010101))), // Note: Pure black is default color, so it gets overridden by |
|
66 | 64 | m_arrowPen(new QPen(QRgb(0x010101))), // default theme if set to that initially. This is an example of workaround. |
|
67 | 65 | m_backgroundPen(new QPen(Qt::NoPen)), |
@@ -429,14 +427,12 void MainWindow::setAngularAxis(MainWindow::AxisMode mode) | |||
|
429 | 427 | m_angularAxis->setLabelsAngle(m_labelsAngle); |
|
430 | 428 | m_angularAxis->setLabelsFont(m_currentLabelFont); |
|
431 | 429 | m_angularAxis->setLabelsBrush(*m_labelBrush); |
|
432 | m_angularAxis->setLabelsPen(*m_labelPen); | |
|
433 | 430 | m_angularAxis->setLabelsVisible(m_labelsVisible); |
|
434 | 431 | m_angularAxis->setShadesBrush(*m_angularShadesBrush); |
|
435 | 432 | m_angularAxis->setShadesPen(*m_angularShadesPen); |
|
436 | 433 | m_angularAxis->setShadesVisible(m_angularShadesVisible); |
|
437 | 434 | m_angularAxis->setTitleFont(m_currentTitleFont); |
|
438 | 435 | m_angularAxis->setTitleBrush(*m_titleBrush); |
|
439 | m_angularAxis->setTitlePen(*m_titlePen); | |
|
440 | 436 | m_angularAxis->setTitleVisible(m_titleVisible); |
|
441 | 437 | m_angularAxis->setTitleText(m_angularTitle); |
|
442 | 438 | m_angularAxis->setGridLinePen(*m_gridPen); |
@@ -499,14 +495,12 void MainWindow::setRadialAxis(MainWindow::AxisMode mode) | |||
|
499 | 495 | m_radialAxis->setLabelsAngle(m_labelsAngle); |
|
500 | 496 | m_radialAxis->setLabelsFont(m_currentLabelFont); |
|
501 | 497 | m_radialAxis->setLabelsBrush(*m_labelBrush); |
|
502 | m_radialAxis->setLabelsPen(*m_labelPen); | |
|
503 | 498 | m_radialAxis->setLabelsVisible(m_labelsVisible); |
|
504 | 499 | m_radialAxis->setShadesBrush(*m_radialShadesBrush); |
|
505 | 500 | m_radialAxis->setShadesPen(*m_radialShadesPen); |
|
506 | 501 | m_radialAxis->setShadesVisible(m_radialShadesVisible); |
|
507 | 502 | m_radialAxis->setTitleFont(m_currentTitleFont); |
|
508 | 503 | m_radialAxis->setTitleBrush(*m_titleBrush); |
|
509 | m_radialAxis->setTitlePen(*m_titlePen); | |
|
510 | 504 | m_radialAxis->setTitleVisible(m_titleVisible); |
|
511 | 505 | m_radialAxis->setTitleText(m_radialTitle); |
|
512 | 506 | m_radialAxis->setGridLinePen(*m_gridPen); |
@@ -750,22 +744,18 void MainWindow::animationIndexChanged(int index) | |||
|
750 | 744 | void MainWindow::labelsIndexChanged(int index) |
|
751 | 745 | { |
|
752 | 746 | delete m_labelBrush; |
|
753 | delete m_labelPen; | |
|
754 | 747 | |
|
755 | 748 | switch (index) { |
|
756 | 749 | case 0: |
|
757 | 750 | m_labelBrush = new QBrush(Qt::NoBrush); |
|
758 | m_labelPen = new QPen(Qt::NoPen); | |
|
759 | 751 | m_labelsVisible = false; |
|
760 | 752 | break; |
|
761 | 753 | case 1: |
|
762 | 754 | m_labelBrush = new QBrush(Qt::black); |
|
763 | m_labelPen = new QPen(Qt::NoPen); | |
|
764 | 755 | m_labelsVisible = true; |
|
765 | 756 | break; |
|
766 | 757 | case 2: |
|
767 | 758 | m_labelBrush = new QBrush(Qt::white); |
|
768 | m_labelPen = new QPen(Qt::blue); | |
|
769 | 759 | m_labelsVisible = true; |
|
770 | 760 | break; |
|
771 | 761 | default: |
@@ -773,50 +763,42 void MainWindow::labelsIndexChanged(int index) | |||
|
773 | 763 | } |
|
774 | 764 | |
|
775 | 765 | m_radialAxis->setLabelsBrush(*m_labelBrush); |
|
776 | m_radialAxis->setLabelsPen(*m_labelPen); | |
|
777 | 766 | m_radialAxis->setLabelsVisible(m_labelsVisible); |
|
778 | 767 | m_angularAxis->setLabelsBrush(*m_labelBrush); |
|
779 | m_angularAxis->setLabelsPen(*m_labelPen); | |
|
780 | 768 | m_angularAxis->setLabelsVisible(m_labelsVisible); |
|
781 | 769 | } |
|
782 | 770 | |
|
783 | 771 | void MainWindow::titleIndexChanged(int index) |
|
784 | 772 | { |
|
785 | 773 | delete m_titleBrush; |
|
786 | delete m_titlePen; | |
|
787 | 774 | |
|
788 | 775 | switch (index) { |
|
789 | 776 | case 0: |
|
790 | 777 | m_titleBrush = new QBrush(Qt::NoBrush); |
|
791 | m_titlePen = new QPen(Qt::NoPen); | |
|
792 | 778 | m_titleVisible = false; |
|
793 | 779 | m_angularTitle = QString(); |
|
794 | 780 | m_radialTitle = QString(); |
|
795 | 781 | break; |
|
796 | 782 | case 1: |
|
797 | 783 | m_titleBrush = new QBrush(Qt::NoBrush); |
|
798 | m_titlePen = new QPen(Qt::NoPen); | |
|
799 | 784 | m_titleVisible = true; |
|
800 | 785 | m_angularTitle = QString(); |
|
801 | 786 | m_radialTitle = QString(); |
|
802 | 787 | break; |
|
803 | 788 | case 2: |
|
804 | 789 | m_titleBrush = new QBrush(Qt::NoBrush); |
|
805 | m_titlePen = new QPen(Qt::NoPen); | |
|
806 | 790 | m_titleVisible = false; |
|
807 | 791 | m_angularTitle = QString("Invisible Ang. Title!"); |
|
808 | 792 | m_radialTitle = QString("Invisible Rad. Title!"); |
|
809 | 793 | break; |
|
810 | 794 | case 3: |
|
811 | 795 | m_titleBrush = new QBrush(Qt::black); |
|
812 | m_titlePen = new QPen(Qt::NoPen); | |
|
813 | 796 | m_titleVisible = true; |
|
814 | 797 | m_angularTitle = QString("Angular Title"); |
|
815 | 798 | m_radialTitle = QString("Radial Title"); |
|
816 | 799 | break; |
|
817 | 800 | case 4: |
|
818 | 801 | m_titleBrush = new QBrush(Qt::white); |
|
819 | m_titlePen = new QPen(Qt::blue); | |
|
820 | 802 | m_titleVisible = true; |
|
821 | 803 | m_angularTitle = QString("Angular Blue Title"); |
|
822 | 804 | m_radialTitle = QString("Radial Blue Title"); |
@@ -826,11 +808,9 void MainWindow::titleIndexChanged(int index) | |||
|
826 | 808 | } |
|
827 | 809 | |
|
828 | 810 | m_radialAxis->setTitleBrush(*m_titleBrush); |
|
829 | m_radialAxis->setTitlePen(*m_titlePen); | |
|
830 | 811 | m_radialAxis->setTitleVisible(m_titleVisible); |
|
831 | 812 | m_radialAxis->setTitleText(m_radialTitle); |
|
832 | 813 | m_angularAxis->setTitleBrush(*m_titleBrush); |
|
833 | m_angularAxis->setTitlePen(*m_titlePen); | |
|
834 | 814 | m_angularAxis->setTitleVisible(m_titleVisible); |
|
835 | 815 | m_angularAxis->setTitleText(m_angularTitle); |
|
836 | 816 | } |
@@ -125,8 +125,6 private: | |||
|
125 | 125 | QBrush *m_plotAreaBackgroundBrush; |
|
126 | 126 | QPen *m_angularShadesPen; |
|
127 | 127 | QPen *m_radialShadesPen; |
|
128 | QPen *m_labelPen; | |
|
129 | QPen *m_titlePen; | |
|
130 | 128 | QPen *m_gridPen; |
|
131 | 129 | QPen *m_arrowPen; |
|
132 | 130 | QPen *m_backgroundPen; |
@@ -85,10 +85,6 Rectangle { | |||
|
85 | 85 | text: "Default + User defined" |
|
86 | 86 | onClicked: viewName = "DefaultAndUserDefined"; |
|
87 | 87 | } |
|
88 | Button { | |
|
89 | text: "Legacy" | |
|
90 | onClicked: viewName = "Legacy"; | |
|
91 | } | |
|
92 | 88 | } |
|
93 | 89 | } |
|
94 | 90 | } |
@@ -13,6 +13,5 | |||
|
13 | 13 | <file>qml/qmlchartaxis/CreatingDynamically.qml</file> |
|
14 | 14 | <file>qml/qmlchartaxis/SwitchingDynamically.qml</file> |
|
15 | 15 | <file>qml/qmlchartaxis/DefaultAndUserDefined.qml</file> |
|
16 | <file>qml/qmlchartaxis/Legacy.qml</file> | |
|
17 | 16 | </qresource> |
|
18 | 17 | </RCC> |
@@ -95,10 +95,10 ChartView { | |||
|
95 | 95 | color: "transparent" |
|
96 | 96 | border.color: "red" |
|
97 | 97 | anchors.fill: parent |
|
98 |
anchors.topMargin: chartView.m |
|
|
99 |
anchors.bottomMargin: chartView.m |
|
|
100 |
anchors.leftMargin: chartView.m |
|
|
101 |
anchors.rightMargin: chartView.m |
|
|
98 | anchors.topMargin: chartView.margins.top | |
|
99 | anchors.bottomMargin: chartView.margins.bottom | |
|
100 | anchors.leftMargin: chartView.margins.left | |
|
101 | anchors.rightMargin: chartView.margins.right | |
|
102 | 102 | opacity: 0.0 |
|
103 | 103 | onOpacityChanged: if (opacity > 0.9) opacity = 0.0; |
|
104 | 104 | Behavior on opacity { |
@@ -105,10 +105,6 Row { | |||
|
105 | 105 | |
|
106 | 106 | onClicked: axis.tickCount--; |
|
107 | 107 | } |
|
108 | Button { | |
|
109 | text: "axis nice nmb" | |
|
110 | onClicked: axis.niceNumbersEnabled = !axis.niceNumbersEnabled; | |
|
111 | } | |
|
112 | 108 | |
|
113 | 109 | FontEditor { |
|
114 | 110 | id: fontEditor |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now