@@ -265,16 +265,16 void AreaChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) | |||||
265 |
|
265 | |||
266 | void AreaChartItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
|
266 | void AreaChartItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) | |
267 | { |
|
267 | { | |
268 |
emit released(m_upper->domain()->calculateDomainPoint( |
|
268 | emit released(m_upper->domain()->calculateDomainPoint(m_lastMousePos)); | |
269 | if (m_lastMousePos == event->pos() && m_mousePressed) |
|
269 | if (m_mousePressed) | |
270 |
emit clicked(m_upper->domain()->calculateDomainPoint( |
|
270 | emit clicked(m_upper->domain()->calculateDomainPoint(m_lastMousePos)); | |
271 | m_mousePressed = false; |
|
271 | m_mousePressed = false; | |
272 | ChartItem::mouseReleaseEvent(event); |
|
272 | ChartItem::mouseReleaseEvent(event); | |
273 | } |
|
273 | } | |
274 |
|
274 | |||
275 | void AreaChartItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) |
|
275 | void AreaChartItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) | |
276 | { |
|
276 | { | |
277 |
emit doubleClicked(m_upper->domain()->calculateDomainPoint( |
|
277 | emit doubleClicked(m_upper->domain()->calculateDomainPoint(m_lastMousePos)); | |
278 | ChartItem::mouseDoubleClickEvent(event); |
|
278 | ChartItem::mouseDoubleClickEvent(event); | |
279 | } |
|
279 | } | |
280 |
|
280 |
@@ -145,11 +145,15 QT_CHARTS_BEGIN_NAMESPACE | |||||
145 |
|
145 | |||
146 | /*! |
|
146 | /*! | |
147 | \fn void QAreaSeries::clicked(const QPointF& point) |
|
147 | \fn void QAreaSeries::clicked(const QPointF& point) | |
148 | \brief Signal is emitted when user clicks the \a point on area chart. |
|
148 | \brief Signal is emitted when user clicks the \a point on area chart. The \a point is the point | |
|
149 | where the press was triggered. | |||
|
150 | \sa pressed, released, doubleClicked | |||
149 | */ |
|
151 | */ | |
150 | /*! |
|
152 | /*! | |
151 | \qmlsignal AreaSeries::onClicked(QPointF point) |
|
153 | \qmlsignal AreaSeries::onClicked(QPointF point) | |
152 | Signal is emitted when user clicks the \a point on area chart. |
|
154 | Signal is emitted when user clicks the \a point on area chart. The \a point is the point where | |
|
155 | the press was triggered. | |||
|
156 | \sa onPressed, onReleased, onDoubleClicked | |||
153 | */ |
|
157 | */ | |
154 |
|
158 | |||
155 | /*! |
|
159 | /*! | |
@@ -168,28 +172,37 QT_CHARTS_BEGIN_NAMESPACE | |||||
168 | /*! |
|
172 | /*! | |
169 | \fn void QAreaSeries::pressed(const QPointF& point) |
|
173 | \fn void QAreaSeries::pressed(const QPointF& point) | |
170 | \brief Signal is emitted when user presses the \a point on area chart. |
|
174 | \brief Signal is emitted when user presses the \a point on area chart. | |
|
175 | \sa clicked, released, doubleClicked | |||
171 | */ |
|
176 | */ | |
172 | /*! |
|
177 | /*! | |
173 | \qmlsignal AreaSeries::onPressed(QPointF point) |
|
178 | \qmlsignal AreaSeries::onPressed(QPointF point) | |
174 | Signal is emitted when user presses the \a point on area chart. |
|
179 | Signal is emitted when user presses the \a point on area chart. | |
|
180 | \sa onClicked, onReleased, onDoubleClicked | |||
175 | */ |
|
181 | */ | |
176 |
|
182 | |||
177 | /*! |
|
183 | /*! | |
178 | \fn void QAreaSeries::released(const QPointF& point) |
|
184 | \fn void QAreaSeries::released(const QPointF& point) | |
179 |
\brief Signal is emitted when user releases the \a point on area |
|
185 | \brief Signal is emitted when user releases a press that was triggered on a \a point on area | |
|
186 | chart. | |||
|
187 | \sa pressed, clicked, doubleClicked | |||
180 | */ |
|
188 | */ | |
181 | /*! |
|
189 | /*! | |
182 | \qmlsignal AreaSeries::onReleased(QPointF point) |
|
190 | \qmlsignal AreaSeries::onReleased(QPointF point) | |
183 | Signal is emitted when user releases the \a point on area chart. |
|
191 | Signal is emitted when user releases a press that was triggered on a \a point on area chart. | |
|
192 | \sa onPressed, onClicked, onDoubleClicked | |||
184 | */ |
|
193 | */ | |
185 |
|
194 | |||
186 | /*! |
|
195 | /*! | |
187 | \fn void QAreaSeries::doubleClicked(const QPointF& point) |
|
196 | \fn void QAreaSeries::doubleClicked(const QPointF& point) | |
188 | \brief Signal is emitted when user doubleclicks the \a point on area chart. |
|
197 | \brief Signal is emitted when user doubleclicks the \a point on area chart. The \a point is the | |
|
198 | point where the first press was triggered. | |||
|
199 | \sa pressed, released, clicked | |||
189 | */ |
|
200 | */ | |
190 | /*! |
|
201 | /*! | |
191 | \qmlsignal AreaSeries::onDoubleClicked(QPointF point) |
|
202 | \qmlsignal AreaSeries::onDoubleClicked(QPointF point) | |
192 | Signal is emitted when user doubleclicks the \a point on area chart. |
|
203 | Signal is emitted when user doubleclicks the \a point on area chart. The \a point is the point | |
|
204 | where the first press was triggered. | |||
|
205 | \sa onPressed, onReleased, onClicked | |||
193 | */ |
|
206 | */ | |
194 |
|
207 | |||
195 | /*! |
|
208 | /*! |
@@ -45,7 +45,6 Bar::~Bar() | |||||
45 | void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
45 | void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event) | |
46 | { |
|
46 | { | |
47 | emit pressed(m_index, m_barset); |
|
47 | emit pressed(m_index, m_barset); | |
48 | m_lastMousePos = event->pos(); |
|
|||
49 | m_mousePressed = true; |
|
48 | m_mousePressed = true; | |
50 | QGraphicsItem::mousePressEvent(event); |
|
49 | QGraphicsItem::mousePressEvent(event); | |
51 | } |
|
50 | } | |
@@ -68,7 +67,7 void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) | |||||
68 | void Bar::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
|
67 | void Bar::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) | |
69 | { |
|
68 | { | |
70 | emit released(m_index, m_barset); |
|
69 | emit released(m_index, m_barset); | |
71 | if (m_lastMousePos == event->pos() && m_mousePressed) |
|
70 | if (m_mousePressed) | |
72 | emit clicked(m_index, m_barset); |
|
71 | emit clicked(m_index, m_barset); | |
73 | m_mousePressed = false; |
|
72 | m_mousePressed = false; | |
74 | QGraphicsItem::mouseReleaseEvent(event); |
|
73 | QGraphicsItem::mouseReleaseEvent(event); |
@@ -64,7 +64,6 private: | |||||
64 | QBarSet *m_barset; |
|
64 | QBarSet *m_barset; | |
65 | bool m_hovering; |
|
65 | bool m_hovering; | |
66 |
|
66 | |||
67 | QPointF m_lastMousePos; |
|
|||
68 | bool m_mousePressed; |
|
67 | bool m_mousePressed; | |
69 | }; |
|
68 | }; | |
70 |
|
69 |
@@ -40,8 +40,8 BoxWhiskers::~BoxWhiskers() | |||||
40 |
|
40 | |||
41 | void BoxWhiskers::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
41 | void BoxWhiskers::mousePressEvent(QGraphicsSceneMouseEvent *event) | |
42 | { |
|
42 | { | |
|
43 | Q_UNUSED(event) | |||
43 | emit pressed(m_boxSet); |
|
44 | emit pressed(m_boxSet); | |
44 | m_lastMousePos = event->pos(); |
|
|||
45 | m_mousePressed = true; |
|
45 | m_mousePressed = true; | |
46 | } |
|
46 | } | |
47 |
|
47 | |||
@@ -59,8 +59,9 void BoxWhiskers::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) | |||||
59 |
|
59 | |||
60 | void BoxWhiskers::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
|
60 | void BoxWhiskers::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) | |
61 | { |
|
61 | { | |
|
62 | Q_UNUSED(event) | |||
62 | emit released(m_boxSet); |
|
63 | emit released(m_boxSet); | |
63 | if (m_lastMousePos == event->pos() && m_mousePressed) |
|
64 | if (m_mousePressed) | |
64 | emit clicked(m_boxSet); |
|
65 | emit clicked(m_boxSet); | |
65 | } |
|
66 | } | |
66 |
|
67 |
@@ -99,7 +99,6 private: | |||||
99 | qreal m_geometryLeft; |
|
99 | qreal m_geometryLeft; | |
100 | qreal m_geometryRight; |
|
100 | qreal m_geometryRight; | |
101 |
|
101 | |||
102 | QPointF m_lastMousePos; |
|
|||
103 | bool m_mousePressed; |
|
102 | bool m_mousePressed; | |
104 | }; |
|
103 | }; | |
105 |
|
104 |
@@ -404,16 +404,16 void LineChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) | |||||
404 |
|
404 | |||
405 | void LineChartItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
|
405 | void LineChartItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) | |
406 | { |
|
406 | { | |
407 |
emit XYChart::released(domain()->calculateDomainPoint( |
|
407 | emit XYChart::released(domain()->calculateDomainPoint(m_lastMousePos)); | |
408 | if (m_lastMousePos == event->pos() && m_mousePressed) |
|
408 | if (m_mousePressed) | |
409 |
emit XYChart::clicked(domain()->calculateDomainPoint( |
|
409 | emit XYChart::clicked(domain()->calculateDomainPoint(m_lastMousePos)); | |
410 | m_mousePressed = false; |
|
410 | m_mousePressed = false; | |
411 | QGraphicsItem::mouseReleaseEvent(event); |
|
411 | QGraphicsItem::mouseReleaseEvent(event); | |
412 | } |
|
412 | } | |
413 |
|
413 | |||
414 | void LineChartItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) |
|
414 | void LineChartItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) | |
415 | { |
|
415 | { | |
416 |
emit XYChart::doubleClicked(domain()->calculateDomainPoint( |
|
416 | emit XYChart::doubleClicked(domain()->calculateDomainPoint(m_lastMousePos)); | |
417 | QGraphicsItem::mouseDoubleClickEvent(event); |
|
417 | QGraphicsItem::mouseDoubleClickEvent(event); | |
418 | } |
|
418 | } | |
419 |
|
419 |
@@ -109,14 +109,13 void PieSliceItem::hoverLeaveEvent(QGraphicsSceneHoverEvent * /*event*/) | |||||
109 | void PieSliceItem::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
109 | void PieSliceItem::mousePressEvent(QGraphicsSceneMouseEvent *event) | |
110 | { |
|
110 | { | |
111 | emit pressed(event->buttons()); |
|
111 | emit pressed(event->buttons()); | |
112 | m_lastMousePos = event->pos(); |
|
|||
113 | m_mousePressed = true; |
|
112 | m_mousePressed = true; | |
114 | } |
|
113 | } | |
115 |
|
114 | |||
116 | void PieSliceItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
|
115 | void PieSliceItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) | |
117 | { |
|
116 | { | |
118 | emit released(event->buttons()); |
|
117 | emit released(event->buttons()); | |
119 | if (m_lastMousePos == event->pos() && m_mousePressed) |
|
118 | if (m_mousePressed) | |
120 | emit clicked(event->buttons()); |
|
119 | emit clicked(event->buttons()); | |
121 | } |
|
120 | } | |
122 |
|
121 |
@@ -86,7 +86,6 private: | |||||
86 | bool m_hovered; |
|
86 | bool m_hovered; | |
87 | QGraphicsTextItem *m_labelItem; |
|
87 | QGraphicsTextItem *m_labelItem; | |
88 |
|
88 | |||
89 | QPointF m_lastMousePos; |
|
|||
90 | bool m_mousePressed; |
|
89 | bool m_mousePressed; | |
91 |
|
90 | |||
92 | friend class PieSliceAnimation; |
|
91 | friend class PieSliceAnimation; |
@@ -304,7 +304,7 QT_CHARTS_BEGIN_NAMESPACE | |||||
304 | */ |
|
304 | */ | |
305 |
|
305 | |||
306 | /*! |
|
306 | /*! | |
307 |
\fn void QPieSeries::clicked(QPieSlice |
|
307 | \fn void QPieSeries::clicked(QPieSlice *slice) | |
308 | This signal is emitted when a \a slice has been clicked. |
|
308 | This signal is emitted when a \a slice has been clicked. | |
309 | \sa QPieSlice::clicked() |
|
309 | \sa QPieSlice::clicked() | |
310 | */ |
|
310 | */ | |
@@ -314,7 +314,7 QT_CHARTS_BEGIN_NAMESPACE | |||||
314 | */ |
|
314 | */ | |
315 |
|
315 | |||
316 | /*! |
|
316 | /*! | |
317 |
\fn void QPieSeries::pressed(QPieSlice |
|
317 | \fn void QPieSeries::pressed(QPieSlice *slice) | |
318 | This signal is emitted when a \a slice has been pressed. |
|
318 | This signal is emitted when a \a slice has been pressed. | |
319 | \sa QPieSlice::pressed() |
|
319 | \sa QPieSlice::pressed() | |
320 | */ |
|
320 | */ | |
@@ -324,7 +324,7 QT_CHARTS_BEGIN_NAMESPACE | |||||
324 | */ |
|
324 | */ | |
325 |
|
325 | |||
326 | /*! |
|
326 | /*! | |
327 |
\fn void QPieSeries::released(QPieSlice |
|
327 | \fn void QPieSeries::released(QPieSlice *slice) | |
328 | This signal is emitted when a \a slice has been released. |
|
328 | This signal is emitted when a \a slice has been released. | |
329 | \sa QPieSlice::released() |
|
329 | \sa QPieSlice::released() | |
330 | */ |
|
330 | */ | |
@@ -334,7 +334,7 QT_CHARTS_BEGIN_NAMESPACE | |||||
334 | */ |
|
334 | */ | |
335 |
|
335 | |||
336 | /*! |
|
336 | /*! | |
337 |
\fn void QPieSeries::doubleClicked(QPieSlice |
|
337 | \fn void QPieSeries::doubleClicked(QPieSlice *slice) | |
338 | This signal is emitted when a \a slice has been doubleClicked. |
|
338 | This signal is emitted when a \a slice has been doubleClicked. | |
339 | \sa QPieSlice::doubleClicked() |
|
339 | \sa QPieSlice::doubleClicked() | |
340 | */ |
|
340 | */ |
@@ -59,8 +59,6 public: | |||||
59 | void markerReleased(QGraphicsItem *item); |
|
59 | void markerReleased(QGraphicsItem *item); | |
60 | void markerDoubleClicked(QGraphicsItem *item); |
|
60 | void markerDoubleClicked(QGraphicsItem *item); | |
61 |
|
61 | |||
62 | void setLastMousePosition(const QPointF pos) {m_lastMousePos = pos;} |
|
|||
63 | QPointF lastMousePosition() const {return m_lastMousePos;} |
|
|||
64 | void setMousePressed(bool pressed = true) {m_mousePressed = pressed;} |
|
62 | void setMousePressed(bool pressed = true) {m_mousePressed = pressed;} | |
65 | bool mousePressed() {return m_mousePressed;} |
|
63 | bool mousePressed() {return m_mousePressed;} | |
66 |
|
64 | |||
@@ -89,7 +87,6 private: | |||||
89 | QFont m_pointLabelsFont; |
|
87 | QFont m_pointLabelsFont; | |
90 | QColor m_pointLabelsColor; |
|
88 | QColor m_pointLabelsColor; | |
91 |
|
89 | |||
92 | QPointF m_lastMousePos; |
|
|||
93 | bool m_mousePressed; |
|
90 | bool m_mousePressed; | |
94 | }; |
|
91 | }; | |
95 |
|
92 | |||
@@ -110,7 +107,6 protected: | |||||
110 | { |
|
107 | { | |
111 | QGraphicsEllipseItem::mousePressEvent(event); |
|
108 | QGraphicsEllipseItem::mousePressEvent(event); | |
112 | m_parent->markerPressed(this); |
|
109 | m_parent->markerPressed(this); | |
113 | m_parent->setLastMousePosition(event->pos()); |
|
|||
114 | m_parent->setMousePressed(); |
|
110 | m_parent->setMousePressed(); | |
115 | } |
|
111 | } | |
116 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event) |
|
112 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event) | |
@@ -127,7 +123,7 protected: | |||||
127 | { |
|
123 | { | |
128 | QGraphicsEllipseItem::mouseReleaseEvent(event); |
|
124 | QGraphicsEllipseItem::mouseReleaseEvent(event); | |
129 | m_parent->markerReleased(this); |
|
125 | m_parent->markerReleased(this); | |
130 |
if (m_parent-> |
|
126 | if (m_parent->mousePressed()) | |
131 | m_parent->markerSelected(this); |
|
127 | m_parent->markerSelected(this); | |
132 | m_parent->setMousePressed(false); |
|
128 | m_parent->setMousePressed(false); | |
133 | } |
|
129 | } | |
@@ -158,7 +154,6 protected: | |||||
158 | { |
|
154 | { | |
159 | QGraphicsRectItem::mousePressEvent(event); |
|
155 | QGraphicsRectItem::mousePressEvent(event); | |
160 | m_parent->markerPressed(this); |
|
156 | m_parent->markerPressed(this); | |
161 | m_parent->setLastMousePosition(event->pos()); |
|
|||
162 | m_parent->setMousePressed(); |
|
157 | m_parent->setMousePressed(); | |
163 | } |
|
158 | } | |
164 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event) |
|
159 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event) | |
@@ -175,7 +170,7 protected: | |||||
175 | { |
|
170 | { | |
176 | QGraphicsRectItem::mouseReleaseEvent(event); |
|
171 | QGraphicsRectItem::mouseReleaseEvent(event); | |
177 | m_parent->markerReleased(this); |
|
172 | m_parent->markerReleased(this); | |
178 |
if (m_parent-> |
|
173 | if (m_parent->mousePressed()) | |
179 | m_parent->markerSelected(this); |
|
174 | m_parent->markerSelected(this); | |
180 | m_parent->setMousePressed(false); |
|
175 | m_parent->setMousePressed(false); | |
181 | } |
|
176 | } |
@@ -484,16 +484,16 void SplineChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) | |||||
484 |
|
484 | |||
485 | void SplineChartItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
|
485 | void SplineChartItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) | |
486 | { |
|
486 | { | |
487 |
emit XYChart::released(domain()->calculateDomainPoint( |
|
487 | emit XYChart::released(domain()->calculateDomainPoint(m_lastMousePos)); | |
488 | if (m_lastMousePos == event->pos() && m_mousePressed) |
|
488 | if (m_mousePressed) | |
489 |
emit XYChart::clicked(domain()->calculateDomainPoint( |
|
489 | emit XYChart::clicked(domain()->calculateDomainPoint(m_lastMousePos)); | |
490 | m_mousePressed = false; |
|
490 | m_mousePressed = false; | |
491 | QGraphicsItem::mouseReleaseEvent(event); |
|
491 | QGraphicsItem::mouseReleaseEvent(event); | |
492 | } |
|
492 | } | |
493 |
|
493 | |||
494 | void SplineChartItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) |
|
494 | void SplineChartItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) | |
495 | { |
|
495 | { | |
496 |
emit XYChart::doubleClicked(domain()->calculateDomainPoint( |
|
496 | emit XYChart::doubleClicked(domain()->calculateDomainPoint(m_lastMousePos)); | |
497 | QGraphicsItem::mouseDoubleClickEvent(event); |
|
497 | QGraphicsItem::mouseDoubleClickEvent(event); | |
498 | } |
|
498 | } | |
499 |
|
499 |
@@ -225,11 +225,14 QT_CHARTS_BEGIN_NAMESPACE | |||||
225 |
|
225 | |||
226 | /*! |
|
226 | /*! | |
227 | \fn void QXYSeries::clicked(const QPointF& point) |
|
227 | \fn void QXYSeries::clicked(const QPointF& point) | |
228 | \brief Signal is emitted when user clicks the \a point on chart. |
|
228 | \brief Signal is emitted when user clicks the \a point on chart. The \a point is the point | |
|
229 | where the press was triggered. | |||
|
230 | \sa pressed, released, doubleClicked | |||
229 | */ |
|
231 | */ | |
230 | /*! |
|
232 | /*! | |
231 | \qmlsignal XYSeries::onClicked(QPointF point) |
|
233 | \qmlsignal XYSeries::onClicked(QPointF point) | |
232 |
Signal is emitted when user clicks the \a point on chart. |
|
234 | Signal is emitted when user clicks the \a point on chart. The \a point is the point where the | |
|
235 | press was triggered. For example: | |||
233 | \code |
|
236 | \code | |
234 | LineSeries { |
|
237 | LineSeries { | |
235 | XYPoint { x: 0; y: 0 } |
|
238 | XYPoint { x: 0; y: 0 } | |
@@ -237,6 +240,7 QT_CHARTS_BEGIN_NAMESPACE | |||||
237 | onClicked: console.log("onClicked: " + point.x + ", " + point.y); |
|
240 | onClicked: console.log("onClicked: " + point.x + ", " + point.y); | |
238 | } |
|
241 | } | |
239 | \endcode |
|
242 | \endcode | |
|
243 | \sa onPressed, onReleased, onDoubleClicked | |||
240 | */ |
|
244 | */ | |
241 |
|
245 | |||
242 | /*! |
|
246 | /*! | |
@@ -255,6 +259,7 QT_CHARTS_BEGIN_NAMESPACE | |||||
255 | /*! |
|
259 | /*! | |
256 | \fn void QXYSeries::pressed(const QPointF& point) |
|
260 | \fn void QXYSeries::pressed(const QPointF& point) | |
257 | \brief Signal is emitted when user presses the \a point on chart. |
|
261 | \brief Signal is emitted when user presses the \a point on chart. | |
|
262 | \sa clicked, released, doubleClicked | |||
258 | */ |
|
263 | */ | |
259 | /*! |
|
264 | /*! | |
260 | \qmlsignal XYSeries::onPressed(QPointF point) |
|
265 | \qmlsignal XYSeries::onPressed(QPointF point) | |
@@ -266,15 +271,18 QT_CHARTS_BEGIN_NAMESPACE | |||||
266 | onPressed: console.log("onPressed: " + point.x + ", " + point.y); |
|
271 | onPressed: console.log("onPressed: " + point.x + ", " + point.y); | |
267 | } |
|
272 | } | |
268 | \endcode |
|
273 | \endcode | |
|
274 | \sa onClicked, onReleased, onDoubleClicked | |||
269 | */ |
|
275 | */ | |
270 |
|
276 | |||
271 | /*! |
|
277 | /*! | |
272 | \fn void QXYSeries::released(const QPointF& point) |
|
278 | \fn void QXYSeries::released(const QPointF& point) | |
273 | \brief Signal is emitted when user releases the \a point on chart. |
|
279 | \brief Signal is emitted when user releases a press that was triggered on a \a point on chart. | |
|
280 | \sa pressed, clicked, doubleClicked | |||
274 | */ |
|
281 | */ | |
275 | /*! |
|
282 | /*! | |
276 | \qmlsignal XYSeries::onReleased(QPointF point) |
|
283 | \qmlsignal XYSeries::onReleased(QPointF point) | |
277 |
Signal is emitted when user releases the \a point on chart. |
|
284 | Signal is emitted when user releases a press that was triggered on a \a point on chart. | |
|
285 | For example: | |||
278 | \code |
|
286 | \code | |
279 | LineSeries { |
|
287 | LineSeries { | |
280 | XYPoint { x: 0; y: 0 } |
|
288 | XYPoint { x: 0; y: 0 } | |
@@ -282,15 +290,19 QT_CHARTS_BEGIN_NAMESPACE | |||||
282 | onReleased: console.log("onReleased: " + point.x + ", " + point.y); |
|
290 | onReleased: console.log("onReleased: " + point.x + ", " + point.y); | |
283 | } |
|
291 | } | |
284 | \endcode |
|
292 | \endcode | |
|
293 | \sa onPressed, onClicked, onDoubleClicked | |||
285 | */ |
|
294 | */ | |
286 |
|
295 | |||
287 | /*! |
|
296 | /*! | |
288 | \fn void QXYSeries::doubleClicked(const QPointF& point) |
|
297 | \fn void QXYSeries::doubleClicked(const QPointF& point) | |
289 | \brief Signal is emitted when user doubleclicks the \a point on chart. |
|
298 | \brief Signal is emitted when user doubleclicks the \a point on chart. The \a point is the | |
|
299 | point where the first press was triggered. | |||
|
300 | \sa pressed, released, clicked | |||
290 | */ |
|
301 | */ | |
291 | /*! |
|
302 | /*! | |
292 | \qmlsignal XYSeries::onDoubleClicked(QPointF point) |
|
303 | \qmlsignal XYSeries::onDoubleClicked(QPointF point) | |
293 |
Signal is emitted when user doubleclicks the \a point on chart. |
|
304 | Signal is emitted when user doubleclicks the \a point on chart. The \a point is the point where | |
|
305 | the first press was triggered. For example: | |||
294 | \code |
|
306 | \code | |
295 | LineSeries { |
|
307 | LineSeries { | |
296 | XYPoint { x: 0; y: 0 } |
|
308 | XYPoint { x: 0; y: 0 } | |
@@ -298,6 +310,7 QT_CHARTS_BEGIN_NAMESPACE | |||||
298 | onDoubleClicked: console.log("onDoubleClicked: " + point.x + ", " + point.y); |
|
310 | onDoubleClicked: console.log("onDoubleClicked: " + point.x + ", " + point.y); | |
299 | } |
|
311 | } | |
300 | \endcode |
|
312 | \endcode | |
|
313 | \sa onPressed, onReleased, onClicked | |||
301 | */ |
|
314 | */ | |
302 |
|
315 | |||
303 | /*! |
|
316 | /*! |
@@ -184,6 +184,8 void tst_QLineSeries::doubleClickedSignal() | |||||
184 | QSignalSpy seriesSpy(lineSeries, SIGNAL(doubleClicked(QPointF))); |
|
184 | QSignalSpy seriesSpy(lineSeries, SIGNAL(doubleClicked(QPointF))); | |
185 |
|
185 | |||
186 | QPointF checkPoint = view.chart()->mapToPosition(linePoint); |
|
186 | QPointF checkPoint = view.chart()->mapToPosition(linePoint); | |
|
187 | // mouseClick needed first to save the position | |||
|
188 | QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, checkPoint.toPoint()); | |||
187 | QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, checkPoint.toPoint()); |
|
189 | QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, checkPoint.toPoint()); | |
188 | QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); |
|
190 | QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); | |
189 |
|
191 |
@@ -177,6 +177,8 void tst_QSplineSeries::doubleClickedSignal() | |||||
177 | QSignalSpy seriesSpy(splineSeries, SIGNAL(doubleClicked(QPointF))); |
|
177 | QSignalSpy seriesSpy(splineSeries, SIGNAL(doubleClicked(QPointF))); | |
178 |
|
178 | |||
179 | QPointF checkPoint = view.chart()->mapToPosition(splinePoint); |
|
179 | QPointF checkPoint = view.chart()->mapToPosition(splinePoint); | |
|
180 | // mouseClick needed first to save the position | |||
|
181 | QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, checkPoint.toPoint()); | |||
180 | QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, checkPoint.toPoint()); |
|
182 | QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, checkPoint.toPoint()); | |
181 | QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); |
|
183 | QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); | |
182 |
|
184 |
@@ -49,13 +49,13 ChartView { | |||||
49 | onBorderColorChanged: console.log("scatterSeries.onBorderColorChanged: " + borderColor); |
|
49 | onBorderColorChanged: console.log("scatterSeries.onBorderColorChanged: " + borderColor); | |
50 | onBorderWidthChanged: console.log("scatterSeries.onBorderChanged: " + borderWidth); |
|
50 | onBorderWidthChanged: console.log("scatterSeries.onBorderChanged: " + borderWidth); | |
51 | onCountChanged: console.log("scatterSeries.onCountChanged: " + count); |
|
51 | onCountChanged: console.log("scatterSeries.onCountChanged: " + count); | |
52 |
onPointLabelsVisibilityChanged: console.log(" |
|
52 | onPointLabelsVisibilityChanged: console.log("scatterSeries.onPointLabelsVisibilityChanged: " | |
53 | + visible); |
|
53 | + visible); | |
54 |
onPointLabelsFormatChanged: console.log(" |
|
54 | onPointLabelsFormatChanged: console.log("scatterSeries.onPointLabelsFormatChanged: " | |
55 | + format); |
|
55 | + format); | |
56 |
onPointLabelsFontChanged: console.log(" |
|
56 | onPointLabelsFontChanged: console.log("scatterSeries.onPointLabelsFontChanged: " | |
57 | + font.family); |
|
57 | + font.family); | |
58 |
onPointLabelsColorChanged: console.log(" |
|
58 | onPointLabelsColorChanged: console.log("scatterSeries.onPointLabelsColorChanged: " | |
59 | + color); |
|
59 | + color); | |
60 | onPressed: console.log(name + ".onPressed: " + point.x + ", " + point.y); |
|
60 | onPressed: console.log(name + ".onPressed: " + point.x + ", " + point.y); | |
61 | onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y); |
|
61 | onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y); | |
@@ -76,4 +76,5 ChartView { | |||||
76 | onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y); |
|
76 | onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y); | |
77 | onDoubleClicked: console.log(name + ".onDoubleClicked: " + point.x + ", " + point.y); |
|
77 | onDoubleClicked: console.log(name + ".onDoubleClicked: " + point.x + ", " + point.y); | |
78 | } |
|
78 | } | |
|
79 | ||||
79 | } |
|
80 | } |
General Comments 0
You need to be logged in to leave comments.
Login now