##// END OF EJS Templates
Added isZoomed method to ChartView...
Titta Heikkala -
r2813:643291cd617f
parent child
Show More
@@ -265,6 +265,11 QT_CHARTS_BEGIN_NAMESPACE
265 265 */
266 266
267 267 /*!
268 \qmlmethod ChartView::isZoomed()
269 Returns true if any series has a zoomed domain.
270 */
271
272 /*!
268 273 \qmlmethod ChartView::scrollLeft(real pixels)
269 274 Scrolls to left by \a pixels. This is a convenience function that suits for example for key navigation.
270 275 */
@@ -879,6 +884,11 void DeclarativeChart::zoomReset()
879 884 m_chart->zoomReset();
880 885 }
881 886
887 bool DeclarativeChart::isZoomed()
888 {
889 return m_chart->isZoomed();
890 }
891
882 892 void DeclarativeChart::scrollLeft(qreal pixels)
883 893 {
884 894 m_chart->scroll(-pixels, 0);
@@ -173,6 +173,7 public:
173 173 Q_REVISION(5) Q_INVOKABLE void zoomIn(const QRectF &rectangle);
174 174 Q_REVISION(5) Q_INVOKABLE void zoomOut();
175 175 Q_REVISION(5) Q_INVOKABLE void zoomReset();
176 Q_REVISION(5) Q_INVOKABLE bool isZoomed();
176 177 Q_INVOKABLE void scrollLeft(qreal pixels);
177 178 Q_INVOKABLE void scrollRight(qreal pixels);
178 179 Q_INVOKABLE void scrollUp(qreal pixels);
@@ -1119,6 +1119,7 Module {
1119 1119 }
1120 1120 Method { name: "zoomOut"; revision: 5 }
1121 1121 Method { name: "zoomReset"; revision: 5 }
1122 Method { name: "isZoomed"; revision: 5; type: "bool" }
1122 1123 Method {
1123 1124 name: "scrollLeft"
1124 1125 Parameter { name: "pixels"; type: "double" }
@@ -94,6 +94,7 Rectangle {
94 94
95 95 // zoom x 2.5
96 96 chartView.zoom(1.5);
97 verify(chartView.isZoomed());
97 98 verify(chartView.axisX().max < xMax);
98 99 verify(chartView.axisX().min > xMin);
99 100 verify(chartView.axisY().max < yMax);
@@ -105,6 +106,7 Rectangle {
105 106
106 107 // zoom x 0.5
107 108 chartView.zoom(0.5);
109 verify(chartView.isZoomed());
108 110 verify(chartView.axisX().max > xMax);
109 111 verify(chartView.axisX().min < xMin);
110 112 verify(chartView.axisY().max > yMax);
@@ -117,6 +119,7 Rectangle {
117 119 // zoom x -1
118 120 // negative value has no effect
119 121 chartView.zoom(-1);
122 verify(chartView.isZoomed());
120 123 verify(chartView.axisX().max === xMax);
121 124 verify(chartView.axisX().min === xMin);
122 125 verify(chartView.axisY().max === yMax);
@@ -124,6 +127,7 Rectangle {
124 127
125 128 // zoom in
126 129 chartView.zoomIn();
130 verify(chartView.isZoomed());
127 131 verify(chartView.axisX().max < xMax);
128 132 verify(chartView.axisX().min > xMin);
129 133 verify(chartView.axisY().max < yMax);
@@ -139,6 +143,7 Rectangle {
139 143 zoomRect.width = 120;
140 144 zoomRect.height = 120;
141 145 chartView.zoomIn(zoomRect);
146 verify(chartView.isZoomed());
142 147 verify(chartView.axisX().max < xMax);
143 148 verify(chartView.axisX().min > xMin);
144 149 verify(chartView.axisY().max < yMax);
@@ -150,6 +155,7 Rectangle {
150 155
151 156 // zoom out
152 157 chartView.zoomOut();
158 verify(chartView.isZoomed());
153 159 verify(chartView.axisX().max > xMax);
154 160 verify(chartView.axisX().min < xMin);
155 161 verify(chartView.axisY().max > yMax);
@@ -161,6 +167,7 Rectangle {
161 167
162 168 // zoom reset
163 169 chartView.zoomReset();
170 verify(!chartView.isZoomed());
164 171 verify(chartView.axisX().max === xMaxOriginal);
165 172 verify(chartView.axisX().min === xMinOriginal);
166 173 verify(chartView.axisY().max === yMaxOriginal);
General Comments 0
You need to be logged in to leave comments. Login now