From 604d8a652cc088a4b3a4307ec291916757e03201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Tue, 13 May 2014 08:26:06 +0300 Subject: API to query custom item selection Task-number: QTRD-3046 + Added missing elementSelected signal to QML Change-Id: I5e79d8e910d2730e3d2ae5550ce576f01aac0b18 Change-Id: I5e79d8e910d2730e3d2ae5550ce576f01aac0b18 Reviewed-by: Miikka Heikkinen --- src/datavisualization/engine/qabstract3dgraph.cpp | 30 ++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src/datavisualization/engine/qabstract3dgraph.cpp') diff --git a/src/datavisualization/engine/qabstract3dgraph.cpp b/src/datavisualization/engine/qabstract3dgraph.cpp index 13d7972a..f2942026 100644 --- a/src/datavisualization/engine/qabstract3dgraph.cpp +++ b/src/datavisualization/engine/qabstract3dgraph.cpp @@ -452,6 +452,34 @@ QAbstract3DAxis *QAbstract3DGraph::selectedAxis() const return d_ptr->m_visualController->selectedAxis(); } +/*! + * Can be used to query the index of the selected custom item after receiving elementSelected signal + * with QAbstract3DGraph::ElementCustomItem type. Selection is valid until the next elementSelected + * signal. + * + * \return index of the selected custom item, or -1. + * + * \since Qt Data Visualization 1.1 + */ +int QAbstract3DGraph::selectedCustomItemIndex() const +{ + return d_ptr->m_visualController->selectedCustomItemIndex(); +} + +/*! + * Can be used to get the selected custom item after receiving elementSelected signal with + * QAbstract3DGraph::ElementCustomItem type. Ownership of the item remains with the graph. + * Selection is valid until the next elementSelected signal. + * + * \return pointer to the selected custom item, or null. + * + * \since Qt Data Visualization 1.1 + */ +QCustom3DItem *QAbstract3DGraph::selectedCustomItem() const +{ + return d_ptr->m_visualController->selectedCustomItem(); +} + /*! * Renders current frame to an image of \a imageSize. Default size is the window size. Image is * rendered with antialiasing level given in \a msaaSamples. Default level is \c{0}. @@ -476,7 +504,7 @@ QImage QAbstract3DGraph::renderToImage(int msaaSamples, const QSize &imageSize) * Signal can be used for example for implementing custom input handlers, as demonstrated in this * \l {Axis Range Dragging With Labels Example}{example}. * - * \sa selectedLabelIndex(), selectedAxis() + * \sa selectedLabelIndex(), selectedAxis(), selectedCustomItemIndex(), selectedCustomItem() */ /*! -- cgit v1.2.3