summaryrefslogtreecommitdiffstats
path: root/src/datavisualization
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2013-12-05 11:26:25 +0200
committerTomi Korpipää <tomi.korpipaa@digia.com>2013-12-05 12:00:39 +0200
commita665bdb2010c3833f47d364945007cccc00aed2b (patch)
treeb364646695ccf068d409c785a10531e04f3c261d /src/datavisualization
parente57ed8602ac02ff86e3c08362ca4fbe23fe05bfb (diff)
QML docs + enum moving
Task-number: QTRD-2670 Task-number: QTRD-2505 Change-Id: I51a870f9a57b093e8216759a5577e161ff3afd60 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src/datavisualization')
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-abstractdeclarative.qdoc4
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc23
-rw-r--r--src/datavisualization/engine/abstract3dcontroller.cpp4
-rw-r--r--src/datavisualization/engine/abstract3dcontroller_p.h2
-rw-r--r--src/datavisualization/engine/q3dcamera.cpp342
-rw-r--r--src/datavisualization/engine/q3dcamera.h45
-rw-r--r--src/datavisualization/engine/q3dcamera_p.h2
-rw-r--r--src/datavisualization/engine/q3dlight.cpp25
-rw-r--r--src/datavisualization/engine/q3dscene.cpp114
-rw-r--r--src/datavisualization/global/qdatavisualizationenums.h40
-rw-r--r--src/datavisualization/global/qtdatavisualizationenums.qdoc55
-rw-r--r--src/datavisualization/input/q3dinputhandler.cpp16
-rw-r--r--src/datavisualization/input/qabstract3dinputhandler.cpp53
-rw-r--r--src/datavisualization/input/qabstract3dinputhandler.h19
-rw-r--r--src/datavisualization/input/qabstract3dinputhandler_p.h2
-rw-r--r--src/datavisualization/input/qtouch3dinputhandler.cpp18
-rw-r--r--src/datavisualization/utils/camerahelper.cpp50
-rw-r--r--src/datavisualization/utils/camerahelper_p.h3
18 files changed, 521 insertions, 296 deletions
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-abstractdeclarative.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-abstractdeclarative.qdoc
index f0fa9e29..7493709f 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-abstractdeclarative.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-abstractdeclarative.qdoc
@@ -42,8 +42,8 @@
*/
/*!
- \qmlproperty AbstractGraph3D.CameraPreset AbstractGraph3D::cameraPreset
- Camera preset.
+ \qmlproperty AbstractInputHandler3D AbstractGraph3D::inputHandler
+ Input handler. You can disable default input handlers by setting this property to \c null.
*/
/*!
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc
index b64c3c03..fc1b732c 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc
@@ -40,19 +40,6 @@
*/
/*!
- * \qmlmethod void Bars3D::setBarColor(const QColor &baseColor, bool uniform)
- * Set bar color using your own color. \a baseColor sets the base color of a bar. The \a uniform
- * -flag is used to define if color needs to be uniform throughout bar's length, or will the colors
- * be applied by height, starting with dark at the bottom. It is \c true by default.
- *
- * Calling this method overrides colors from theme.
- *
- * \sa AbstractGraph3D::theme
- *
- * \warning This method is subject to change.
- */
-
-/*!
* \qmlproperty CategoryAxis3D Bars3D::rowAxis
* A user-defined row axis.
*
@@ -95,16 +82,6 @@
*/
/*!
- * \qmlproperty int Bars3D::rows
- * Row count of data window.
- */
-
-/*!
- * \qmlproperty int Bars3D::columns
- * Column count of data window.
- */
-
-/*!
* \qmlproperty list<QBar3DSeries> Bars3D::seriesList
* This property holds the series of the graph.
* By default, this property contains an empty list.
diff --git a/src/datavisualization/engine/abstract3dcontroller.cpp b/src/datavisualization/engine/abstract3dcontroller.cpp
index 7165ca58..915a0bc7 100644
--- a/src/datavisualization/engine/abstract3dcontroller.cpp
+++ b/src/datavisualization/engine/abstract3dcontroller.cpp
@@ -952,11 +952,11 @@ void Abstract3DController::handleAxisLabelFormatChanged(const QString &format)
handleAxisLabelFormatChangedBySender(sender());
}
-void Abstract3DController::handleInputStateChanged(QDataVis::InputState state)
+void Abstract3DController::handleInputStateChanged(QAbstract3DInputHandler::InputState state)
{
// When in automatic slicing mode, input state change to overview disables slice mode
if (m_selectionMode.testFlag(QDataVis::SelectionSlice)
- && state == QDataVis::InputStateOnOverview) {
+ && state == QAbstract3DInputHandler::InputStateOnPrimaryView) {
setSlicingActive(false);
}
diff --git a/src/datavisualization/engine/abstract3dcontroller_p.h b/src/datavisualization/engine/abstract3dcontroller_p.h
index 4ecfacdc..2874cbcb 100644
--- a/src/datavisualization/engine/abstract3dcontroller_p.h
+++ b/src/datavisualization/engine/abstract3dcontroller_p.h
@@ -295,7 +295,7 @@ public slots:
void handleAxisSubSegmentCountChanged(int count);
void handleAxisAutoAdjustRangeChanged(bool autoAdjust);
void handleAxisLabelFormatChanged(const QString &format);
- void handleInputStateChanged(QDataVis::InputState state);
+ void handleInputStateChanged(QAbstract3DInputHandler::InputState state);
void handleInputPositionChanged(const QPoint &position);
void handleSeriesVisibilityChanged(bool visible);
void handlePixelRatioChanged(float ratio);
diff --git a/src/datavisualization/engine/q3dcamera.cpp b/src/datavisualization/engine/q3dcamera.cpp
index bc936436..6378051c 100644
--- a/src/datavisualization/engine/q3dcamera.cpp
+++ b/src/datavisualization/engine/q3dcamera.cpp
@@ -29,19 +29,192 @@
QT_DATAVISUALIZATION_BEGIN_NAMESPACE
/*!
- \class Q3DCamera
- \inmodule QtDataVisualization
- \brief Representation of a camera in 3D space.
- \since Qt Data Visualization 1.0
+ * \class Q3DCamera
+ * \inmodule QtDataVisualization
+ * \brief Representation of a camera in 3D space.
+ * \since Qt Data Visualization 1.0
+ *
+ * Q3DCamera represents a basic orbit around centerpoint 3D camera that is used when rendering the
+ * data visualization. The class offers simple methods for setting the orbit point in rotations,
+ * but allows also setting the 4x4 view matrix directly in case a more customized camera behavior is
+ * needed.
+ */
+
+/*!
+ * \enum Q3DCamera::CameraPreset
+ *
+ * Predefined positions for camera.
+ *
+ * \value CameraPresetNone
+ * Used to indicate a preset has not been set, or the scene has been rotated freely.
+ * \value CameraPresetFrontLow
+ * \value CameraPresetFront
+ * \value CameraPresetFrontHigh
+ * \value CameraPresetLeftLow
+ * \value CameraPresetLeft
+ * \value CameraPresetLeftHigh
+ * \value CameraPresetRightLow
+ * \value CameraPresetRight
+ * \value CameraPresetRightHigh
+ * \value CameraPresetBehindLow
+ * \value CameraPresetBehind
+ * \value CameraPresetBehindHigh
+ * \value CameraPresetIsometricLeft
+ * \value CameraPresetIsometricLeftHigh
+ * \value CameraPresetIsometricRight
+ * \value CameraPresetIsometricRightHigh
+ * \value CameraPresetDirectlyAbove
+ * \value CameraPresetDirectlyAboveCW45
+ * \value CameraPresetDirectlyAboveCCW45
+ * \value CameraPresetFrontBelow
+ * In Q3DBars from CameraPresetFrontBelow onward these only work for graphs including negative
+ * values. They act as Preset...Low for positive-only values.
+ * \value CameraPresetLeftBelow
+ * \value CameraPresetRightBelow
+ * \value CameraPresetBehindBelow
+ * \value CameraPresetDirectlyBelow
+ * Acts as CameraPresetFrontLow for positive-only bars.
+ */
+
+/*!
+ * \qmltype Camera3D
+ * \inqmlmodule QtDataVisualization
+ * \since QtDataVisualization 1.0
+ * \ingroup datavisualization_qml
+ * \instantiates Q3DCamera
+ * \brief Representation of a camera in 3D space.
+ *
+ * Camera3D represents a basic orbit around centerpoint 3D camera that is used when rendering the
+ * data visualization. The class offers simple methods for setting the orbit point in rotations,
+ * but allows also setting the 4x4 view matrix directly in case a more customized camera behavior is
+ * needed.
+ */
+
+/*!
+ * \qmlproperty float Camera3D::xRotation
+ *
+ * This property contains the X-rotation angle of the camera around the target point in degrees
+ * starting from the current base position set by the setBaseOrientation method.
+ */
+
+/*!
+ * \qmlproperty float Camera3D::yRotation
+ *
+ * This property contains the Y-rotation angle of the camera around the target point in degrees
+ * starting from the current base position set by the setBaseOrientation method.
+ */
+
+/*!
+ * \qmlproperty float Camera3D::minXRotation
+ *
+ * This property contains the current minimum X-rotation for the camera.
+ * The full circle range is \c{[-180, 180]} and the minimum value is limited to \c -180.
+ * Also the value can't be higher than the maximum, and is adjusted if necessary.
+ *
+ * \sa wrapXRotation, maxXRotation
+ */
+
+/*!
+ * \qmlproperty float Camera3D::minYRotation
+ *
+ * This property contains the current minimum Y-rotation for the camera.
+ * The full Y angle range is \c{[-90, 90]} and the minimum value is limited to \c -90.
+ * Also the value can't be higher than the maximum, and is adjusted if necessary.
+ *
+ * \sa wrapYRotation, maxYRotation
+ */
+
+/*!
+ * \qmlproperty float Camera3D::maxXRotation
+ *
+ * This property contains the current maximum X-rotation for the camera.
+ * The full circle range is \c{[-180, 180]} and the maximum value is limited to \c 180.
+ * Also the value can't be lower than the minimum, and is adjusted if necessary.
+ *
+ * \sa wrapXRotation, minXRotation
+ */
+
+/*!
+ * \qmlproperty float Camera3D::maxYRotation
+ *
+ * This property contains the current maximum Y-rotation for the camera.
+ * The full Y angle range is \c{[-90, 90]} and the maximum value is limited to \c 90.
+ * Also the value can't be lower than the minimum, and is adjusted if necessary.
+ *
+ * \sa wrapYRotation, minYRotation
+ */
+
+/*!
+ * \qmlmethod void Camera3D::setBaseOrientation(vector3d basePosition, vector3d target, vector3d baseUp)
+ *
+ * Sets the base values for the camera that are used when calculating the camera position using the
+ * rotation values. The base position of the camera is defined by \a basePosition, expectation is
+ * that the x and y values are 0. Look at target point is defined by \a target and the camera
+ * rotates around it. Up direction for the camera is defined by \a baseUp, normally this is a
+ * vector with only y value set to 1.
+ */
+
+/*!
+ * \qmlproperty matrix4x4 Camera3D::viewMatrix
+ *
+ * This property contains the view matrix used in the 3D calculations. When the default orbiting
+ * camera behavior is sufficient, there is no need to touch this property. If the default
+ * behavior is insufficient, the view matrix can be set directly.
+ * \note When setting the view matrix directly remember to set viewMatrixAutoUpdateEnabled
+ * property to \c false.
+ */
+
+/*!
+ * \qmlproperty bool Camera3D::viewMatrixAutoUpdateEnabled
+ *
+ * This property determines if view matrix is automatically updated each render cycle using the
+ * current base orientation and rotations. If set to \c false, no automatic recalculation is done and
+ * the view matrix can be set using the viewMatrix property.
+ */
+
+/*!
+ * \qmlproperty Camera3D.CameraPreset Camera3D::cameraPreset
+ *
+ * This property contains the currently active camera preset, which is one of
+ * \l{Q3DCamera::CameraPreset}{Camera3D.CameraPreset}. If no preset is active the value
+ * is \l{Q3DCamera::CameraPresetNone}{Camera3D.CameraPresetNone}.
+ * \note The base camera orientation set by setBaseOrientation will affect the presets as all
+ * calculations are based on those values.
+ */
+
+/*!
+ * \qmlproperty float Camera3D::zoomLevel
+ *
+ * This property contains the the camera zoom level in percentage. 100.0 means there is no zoom
+ * in or out set in the camera.
+ */
- Q3DCamera represents a basic orbit around centerpoint 3D camera that is used when rendering the data visualization.
- The class offers simple methods for setting the orbit point in rotations, but allows also setting the 4x4 viewmatrix
- directly in case a more customized camera behavior is needed.
-*/
+/*!
+ * \qmlproperty bool Camera3D::wrapXRotation
+ *
+ * This property determines the behavior of the minimum and maximum limits in the X-rotation.
+ * By default the X-rotation wraps from minimum value to maximum and from maximum to minimum.
+ *
+ * If set to \c true the X-rotation of the camera is wrapped from minimum to maximum and from maximum
+ * to minimum. If set to \c false the X-rotation of the camera is limited to the sector determined by
+ * minimum and maximum values.
+ */
/*!
- * Constructs a new 3D camera with position set to origo, up direction facing towards the Y-axis and looking at origo by default. An
- * optional \a parent parameter can be given and is then passed to QObject constructor.
+ * \qmlproperty bool Camera3D::wrapYRotation
+ *
+ * This property determines the behavior of the minimum and maximum limits in the Y-rotation.
+ * By default the Y-rotation is limited between the minimum and maximum values without any wrapping.
+ *
+ * If \c true the Y-rotation of the camera is wrapped from minimum to maximum and from maximum
+ * to minimum. If \c false the Y-rotation of the camera is limited to the sector determined by minimum
+ * and maximum values.
+ */
+
+/*!
+ * Constructs a new 3D camera with position set to origin, up direction facing towards the Y-axis
+ * and looking at origin by default. An optional \a parent parameter can be given and is then passed
+ * to QObject constructor.
*/
Q3DCamera::Q3DCamera(QObject *parent) :
Q3DObject(parent),
@@ -97,8 +270,8 @@ void Q3DCamera::copyValuesFrom(const Q3DObject &source)
/*!
* \property Q3DCamera::xRotation
*
- * This property contains the X-rotation angle of the camera around the target point in degrees starting from
- * the current base position set by the setBaseOrientation() methods.
+ * This property contains the X-rotation angle of the camera around the target point in degrees
+ * starting from the current base position set by the setBaseOrientation() method.
*/
float Q3DCamera::xRotation() const {
return d_ptr->m_xRotation;
@@ -113,8 +286,8 @@ void Q3DCamera::setXRotation(float rotation)
if (d_ptr->m_xRotation != rotation) {
d_ptr->setXRotation(rotation);
- if (d_ptr->m_activePreset != QDataVis::CameraPresetNone) {
- d_ptr->m_activePreset = QDataVis::CameraPresetNone;
+ if (d_ptr->m_activePreset != CameraPresetNone) {
+ d_ptr->m_activePreset = CameraPresetNone;
setDirty(true);
}
@@ -125,8 +298,8 @@ void Q3DCamera::setXRotation(float rotation)
/*!
* \property Q3DCamera::yRotation
*
- * This property contains the Y-rotation angle of the camera around the target point in degrees starting from
- * the current base position set by the setBaseOrientation() methods.
+ * This property contains the Y-rotation angle of the camera around the target point in degrees
+ * starting from the current base position set by the setBaseOrientation() method.
*/
float Q3DCamera::yRotation() const {
return d_ptr->m_yRotation;
@@ -141,8 +314,8 @@ void Q3DCamera::setYRotation(float rotation)
if (d_ptr->m_yRotation != rotation) {
d_ptr->setYRotation(rotation);
- if (d_ptr->m_activePreset != QDataVis::CameraPresetNone) {
- d_ptr->m_activePreset = QDataVis::CameraPresetNone;
+ if (d_ptr->m_activePreset != CameraPresetNone) {
+ d_ptr->m_activePreset = CameraPresetNone;
setDirty(true);
}
@@ -154,7 +327,7 @@ void Q3DCamera::setYRotation(float rotation)
* \property Q3DCamera::minXRotation
*
* This property contains the current minimum X-rotation for the camera.
- * The full circle range is [-180, 180] and the minimum value is limited to -180.
+ * The full circle range is \c{[-180, 180]} and the minimum value is limited to \c -180.
* Also the value can't be higher than the maximum, and is adjusted if necessary.
*
* \sa wrapXRotation, maxXRotation
@@ -164,9 +337,6 @@ float Q3DCamera::minXRotation() const
return d_ptr->m_minXRotation;
}
-/*!
- * \internal
- */
void Q3DCamera::setMinXRotation(float minRotation)
{
minRotation = qBound(-180.0f, minRotation, 180.0f);
@@ -186,7 +356,7 @@ void Q3DCamera::setMinXRotation(float minRotation)
* \property Q3DCamera::minYRotation
*
* This property contains the current minimum Y-rotation for the camera.
- * The full Y angle range is [-90,90] and the minimum value is limited to -90.
+ * The full Y angle range is \c{[-90, 90]} and the minimum value is limited to \c -90.
* Also the value can't be higher than the maximum, and is adjusted if necessary.
*
* \sa wrapYRotation, maxYRotation
@@ -196,9 +366,6 @@ float Q3DCamera::minYRotation() const
return d_ptr->m_minYRotation;
}
-/*!
- * \internal
- */
void Q3DCamera::setMinYRotation(float minRotation)
{
minRotation = qBound(-90.0f, minRotation, 90.0f);
@@ -218,7 +385,7 @@ void Q3DCamera::setMinYRotation(float minRotation)
* \property Q3DCamera::maxXRotation
*
* This property contains the current maximum X-rotation for the camera.
- * The full circle range is [-180,180] and the maximum value is limited to 180.
+ * The full circle range is \c{[-180, 180]} and the maximum value is limited to \c 180.
* Also the value can't be lower than the minimum, and is adjusted if necessary.
*
* \sa wrapXRotation, minXRotation
@@ -228,9 +395,6 @@ float Q3DCamera::maxXRotation() const
return d_ptr->m_maxXRotation;
}
-/*!
- * \internal
- */
void Q3DCamera::setMaxXRotation(float maxRotation)
{
maxRotation = qBound(-180.0f, maxRotation, 180.0f);
@@ -251,7 +415,7 @@ void Q3DCamera::setMaxXRotation(float maxRotation)
* \property Q3DCamera::maxYRotation
*
* This property contains the current maximum Y-rotation for the camera.
- * The full Y angle range is [-90,90] and the maximum value is limited to 90.
+ * The full Y angle range is \c{[-90, 90]} and the maximum value is limited to \c 90.
* Also the value can't be lower than the minimum, and is adjusted if necessary.
*
* \sa wrapYRotation, minYRotation
@@ -261,9 +425,6 @@ float Q3DCamera::maxYRotation() const
return d_ptr->m_maxYRotation;
}
-/*!
- * \internal
- */
void Q3DCamera::setMaxYRotation(float maxRotation)
{
maxRotation = qBound(-90.0f, maxRotation, 90.0f);
@@ -281,10 +442,11 @@ void Q3DCamera::setMaxYRotation(float maxRotation)
}
/*!
- * Sets the base values for the camera that are used when calculating the camera position using the rotation values.
- * The base position of the camera is defined by \a basePosition, expectation is that the x and y values are 0.
- * Look at target point is defined by \a target and the camera rotates around it. Up direction for the camera is
- * defined by \a baseUp, normally this is a vector with only y values set to 1.
+ * Sets the base values for the camera that are used when calculating the camera position using the
+ * rotation values. The base position of the camera is defined by \a basePosition, expectation is
+ * that the x and y values are 0. Look at target point is defined by \a target and the camera
+ * rotates around it. Up direction for the camera is defined by \a baseUp, normally this is a
+ * vector with only y value set to 1.
*/
void Q3DCamera::setBaseOrientation(const QVector3D &basePosition,
const QVector3D &target,
@@ -303,9 +465,11 @@ void Q3DCamera::setBaseOrientation(const QVector3D &basePosition,
/*!
* \property Q3DCamera::viewMatrix
*
- * This property contains the view matrix used in the 3D calculations. When the default orbiting camera behavior is sufficient,
- * there is no need to touch this property. But if the default behavior is insufficient, the view matrix can be set directly.
- * When setting the view matrix directly remember to set Q3DCamera::viewMatrixAutoUpdateEnabled to false.
+ * This property contains the view matrix used in the 3D calculations. When the default orbiting
+ * camera behavior is sufficient, there is no need to touch this property. If the default
+ * behavior is insufficient, the view matrix can be set directly.
+ * \note When setting the view matrix directly remember to set viewMatrixAutoUpdateEnabled to
+ * \c false.
*/
QMatrix4x4 Q3DCamera::viewMatrix() const
{
@@ -324,9 +488,9 @@ void Q3DCamera::setViewMatrix(const QMatrix4x4 &viewMatrix)
/*!
* \property Q3DCamera::viewMatrixAutoUpdateEnabled
*
- * This property determines if view matrix is automatically updated each render cycle using the current base orientation and
- * rotations. If set to false, no automatic recalculation is done and the view matrix can be set using the
- * Q3DMatrix::viewMatrix property.
+ * This property determines if view matrix is automatically updated each render cycle using the
+ * current base orientation and rotations. If set to \c false, no automatic recalculation is done
+ * and the view matrix can be set using the viewMatrix property.
*/
bool Q3DCamera::isViewMatrixAutoUpdateEnabled() const
{
@@ -342,141 +506,141 @@ void Q3DCamera::setViewMatrixAutoUpdateEnabled(bool isEnabled)
/*!
* \property Q3DCamera::cameraPreset
*
- * This property contains the currently active camera preset,
- * if no preset is active the value is QDataVis::CameraPresetNone.
+ * This property contains the currently active camera preset, if no preset is active the value
+ * is CameraPresetNone.
* \note The base camera orientation set by setBaseOrientation() will affect
* the presets as all calculations are based on those values.
*/
-QDataVis::CameraPreset Q3DCamera::cameraPreset() const
+Q3DCamera::CameraPreset Q3DCamera::cameraPreset() const
{
return d_ptr->m_activePreset;
}
-void Q3DCamera::setCameraPreset(QDataVis::CameraPreset preset)
+void Q3DCamera::setCameraPreset(CameraPreset preset)
{
switch (preset) {
- case QDataVis::CameraPresetFrontLow: {
+ case CameraPresetFrontLow: {
setXRotation(0.0f);
setYRotation(0.0f);
break;
}
- case QDataVis::CameraPresetFront: {
+ case CameraPresetFront: {
setXRotation(0.0f);
setYRotation(22.5f);
break;
}
- case QDataVis::CameraPresetFrontHigh: {
+ case CameraPresetFrontHigh: {
setXRotation(0.0f);
setYRotation(45.0f);
break;
}
- case QDataVis::CameraPresetLeftLow: {
+ case CameraPresetLeftLow: {
setXRotation(90.0f);
setYRotation(0.0f);
break;
}
- case QDataVis::CameraPresetLeft: {
+ case CameraPresetLeft: {
setXRotation(90.0f);
setYRotation(22.5f);
break;
}
- case QDataVis::CameraPresetLeftHigh: {
+ case CameraPresetLeftHigh: {
setXRotation(90.0f);
setYRotation(45.0f);
break;
}
- case QDataVis::CameraPresetRightLow: {
+ case CameraPresetRightLow: {
setXRotation(-90.0f);
setYRotation(0.0f);
break;
}
- case QDataVis::CameraPresetRight: {
+ case CameraPresetRight: {
setXRotation(-90.0f);
setYRotation(22.5f);
break;
}
- case QDataVis::CameraPresetRightHigh: {
+ case CameraPresetRightHigh: {
setXRotation(-90.0f);
setYRotation(45.0f);
break;
}
- case QDataVis::CameraPresetBehindLow: {
+ case CameraPresetBehindLow: {
setXRotation(180.0f);
setYRotation(0.0f);
break;
}
- case QDataVis::CameraPresetBehind: {
+ case CameraPresetBehind: {
setXRotation(180.0f);
setYRotation(22.5f);
break;
}
- case QDataVis::CameraPresetBehindHigh: {
+ case CameraPresetBehindHigh: {
setXRotation(180.0f);
setYRotation(45.0f);
break;
}
- case QDataVis::CameraPresetIsometricLeft: {
+ case CameraPresetIsometricLeft: {
setXRotation(45.0f);
setYRotation(22.5f);
break;
}
- case QDataVis::CameraPresetIsometricLeftHigh: {
+ case CameraPresetIsometricLeftHigh: {
setXRotation(45.0f);
setYRotation(45.0f);
break;
}
- case QDataVis::CameraPresetIsometricRight: {
+ case CameraPresetIsometricRight: {
setXRotation(-45.0f);
setYRotation(22.5f);
break;
}
- case QDataVis::CameraPresetIsometricRightHigh: {
+ case CameraPresetIsometricRightHigh: {
setXRotation(-45.0f);
setYRotation(45.0f);
break;
}
- case QDataVis::CameraPresetDirectlyAbove: {
+ case CameraPresetDirectlyAbove: {
setXRotation(0.0f);
setYRotation(90.0f);
break;
}
- case QDataVis::CameraPresetDirectlyAboveCW45: {
+ case CameraPresetDirectlyAboveCW45: {
setXRotation(-45.0f);
setYRotation(90.0f);
break;
}
- case QDataVis::CameraPresetDirectlyAboveCCW45: {
+ case CameraPresetDirectlyAboveCCW45: {
setXRotation(45.0f);
setYRotation(90.0f);
break;
}
- case QDataVis::CameraPresetFrontBelow: {
+ case CameraPresetFrontBelow: {
setXRotation(0.0f);
setYRotation(-45.0f);
break;
}
- case QDataVis::CameraPresetLeftBelow: {
+ case CameraPresetLeftBelow: {
setXRotation(90.0f);
setYRotation(-45.0f);
break;
}
- case QDataVis::CameraPresetRightBelow: {
+ case CameraPresetRightBelow: {
setXRotation(-90.0f);
setYRotation(-45.0f);
break;
}
- case QDataVis::CameraPresetBehindBelow: {
+ case CameraPresetBehindBelow: {
setXRotation(180.0f);
setYRotation(-45.0f);
break;
}
- case QDataVis::CameraPresetDirectlyBelow: {
+ case CameraPresetDirectlyBelow: {
setXRotation(0.0f);
setYRotation(-90.0f);
break;
}
default:
- preset = QDataVis::CameraPresetNone;
+ preset = CameraPresetNone;
break;
}
@@ -490,8 +654,8 @@ void Q3DCamera::setCameraPreset(QDataVis::CameraPreset preset)
/*!
* \property Q3DCamera::zoomLevel
*
- * This property contains the the camera zoom level in percentages.
- * 100% means there is no zoom in or out set in the camera.
+ * This property contains the the camera zoom level in percentage. \c 100.0f means there is no zoom
+ * in or out set in the camera.
*/
int Q3DCamera::zoomLevel() const
{
@@ -510,10 +674,12 @@ void Q3DCamera::setZoomLevel(int zoomLevel)
/*!
* Calculates and returns a position relative to the camera using the given parameters
* and the current camera viewMatrix property.
- * \a relativePosition defines the relative 3D offset to the current camera position.
- * \a fixedRotation is optional, if given fixes rotation of the calculated point around the data visualization area to the given value in degrees.
- * \a distanceModifier is also optional, if given modifies the distance of the calculated point from the data visualization.
- * \return Calculated position relative to this camera's position.
+ * The relative 3D offset to the current camera position is defined in \a relativePosition.
+ * An optional fixed rotation of the calculated point around the data visualization area can be
+ * given in \a fixedRotation. The rotation is given in degrees.
+ * An optional \a distanceModifier modifies the distance of the calculated point from the data
+ * visualization.
+ * \return calculated position relative to this camera's position.
*/
QVector3D Q3DCamera::calculatePositionRelativeToCamera(const QVector3D &relativePosition,
float fixedRotation,
@@ -547,8 +713,9 @@ QVector3D Q3DCamera::calculatePositionRelativeToCamera(const QVector3D &relative
* This property determines the behavior of the minimum and maximum limits in the X-rotation.
* By default the X-rotation wraps from minimum value to maximum and from maximum to minimum.
*
- * If set to true the X-rotation of the camera is wrapped from minimum to maximum and from maximum to minimum.
- * If set to false the X-rotation of the camera is limited to the sector determined by minimum and maximum values.
+ * If set to \c true the X-rotation of the camera is wrapped from minimum to maximum and from
+ * maximum to minimum. If set to \c false the X-rotation of the camera is limited to the sector
+ * determined by minimum and maximum values.
*/
bool Q3DCamera::wrapXRotation() const
{
@@ -566,8 +733,9 @@ void Q3DCamera::setWrapXRotation(bool isEnabled)
* This property determines the behavior of the minimum and maximum limits in the Y-rotation.
* By default the Y-rotation is limited between the minimum and maximum values without any wrapping.
*
- * If true the Y-rotation of the camera is wrapped from minimum to maximum and from maximum to minimum.
- * If false the Y-rotation of the camera is limited to the sector determined by minimum and maximum values.
+ * If \c true the Y-rotation of the camera is wrapped from minimum to maximum and from maximum to
+ * minimum. If \c false the Y-rotation of the camera is limited to the sector determined by minimum
+ * and maximum values.
*/
bool Q3DCamera::wrapYRotation() const
{
@@ -580,8 +748,10 @@ void Q3DCamera::setWrapYRotation(bool isEnabled)
}
/*!
- * Utility function that sets the camera rotations and distance.\a horizontal and \a vertical define the camera rotations to be used.
- * Optional \a zoom parameter can be given to set the zoom of the camera in range of 10-500%.
+ * Utility function that sets the camera rotations and distance.\a horizontal and \a vertical
+ * define the camera rotations to be used.
+ * Optional \a zoom parameter can be given to set the zoom percentage of the camera in range of
+ * \c{10.0f - 500.0f}.
*/
void Q3DCamera::setCameraPosition(float horizontal, float vertical, float zoom)
{
@@ -602,7 +772,7 @@ Q3DCameraPrivate::Q3DCameraPrivate(Q3DCamera *q) :
m_wrapXRotation(true),
m_wrapYRotation(false),
m_zoomLevel(100),
- m_activePreset(QDataVis::CameraPresetNone)
+ m_activePreset(Q3DCamera::CameraPresetNone)
{
}
diff --git a/src/datavisualization/engine/q3dcamera.h b/src/datavisualization/engine/q3dcamera.h
index 6a9d8a0d..8019da8b 100644
--- a/src/datavisualization/engine/q3dcamera.h
+++ b/src/datavisualization/engine/q3dcamera.h
@@ -32,6 +32,7 @@ class Q3DCameraPrivate;
class QT_DATAVISUALIZATION_EXPORT Q3DCamera : public Q3DObject
{
Q_OBJECT
+ Q_ENUMS(CameraPreset)
Q_PROPERTY(float xRotation READ xRotation WRITE setXRotation NOTIFY xRotationChanged)
Q_PROPERTY(float yRotation READ yRotation WRITE setYRotation NOTIFY yRotationChanged)
Q_PROPERTY(float minXRotation READ minXRotation NOTIFY minXRotationChanged)
@@ -40,11 +41,39 @@ class QT_DATAVISUALIZATION_EXPORT Q3DCamera : public Q3DObject
Q_PROPERTY(float maxYRotation READ maxYRotation NOTIFY maxYRotationChanged)
Q_PROPERTY(int zoomLevel READ zoomLevel WRITE setZoomLevel NOTIFY zoomLevelChanged)
Q_PROPERTY(QMatrix4x4 viewMatrix READ viewMatrix WRITE setViewMatrix NOTIFY viewMatrixChanged)
- Q_PROPERTY(QtDataVisualization::QDataVis::CameraPreset cameraPreset READ cameraPreset WRITE setCameraPreset NOTIFY cameraPresetChanged)
+ Q_PROPERTY(CameraPreset cameraPreset READ cameraPreset WRITE setCameraPreset NOTIFY cameraPresetChanged)
Q_PROPERTY(bool viewMatrixAutoUpdateEnabled READ isViewMatrixAutoUpdateEnabled WRITE setViewMatrixAutoUpdateEnabled NOTIFY viewMatrixAutoUpdateChanged)
Q_PROPERTY(bool wrapXRotation READ wrapXRotation WRITE setWrapXRotation NOTIFY wrapXRotationChanged)
Q_PROPERTY(bool wrapYRotation READ wrapYRotation WRITE setWrapYRotation NOTIFY wrapYRotationChanged)
- Q_ENUMS(QtDataVisualization::QDataVis::CameraPreset)
+
+public:
+ enum CameraPreset {
+ CameraPresetNone = -1,
+ CameraPresetFrontLow = 0,
+ CameraPresetFront,
+ CameraPresetFrontHigh,
+ CameraPresetLeftLow,
+ CameraPresetLeft,
+ CameraPresetLeftHigh,
+ CameraPresetRightLow,
+ CameraPresetRight,
+ CameraPresetRightHigh,
+ CameraPresetBehindLow,
+ CameraPresetBehind,
+ CameraPresetBehindHigh,
+ CameraPresetIsometricLeft,
+ CameraPresetIsometricLeftHigh,
+ CameraPresetIsometricRight,
+ CameraPresetIsometricRightHigh,
+ CameraPresetDirectlyAbove,
+ CameraPresetDirectlyAboveCW45,
+ CameraPresetDirectlyAboveCCW45,
+ CameraPresetFrontBelow,
+ CameraPresetLeftBelow,
+ CameraPresetRightBelow,
+ CameraPresetBehindBelow,
+ CameraPresetDirectlyBelow
+ };
public:
Q3DCamera(QObject *parent = 0);
@@ -75,15 +104,15 @@ public:
bool isViewMatrixAutoUpdateEnabled() const;
void setViewMatrixAutoUpdateEnabled(bool isEnabled);
- QDataVis::CameraPreset cameraPreset() const;
- void setCameraPreset(QDataVis::CameraPreset preset);
+ CameraPreset cameraPreset() const;
+ void setCameraPreset(CameraPreset preset);
int zoomLevel() const;
void setZoomLevel(int zoomLevel);
- void setBaseOrientation(const QVector3D &defaultPosition,
- const QVector3D &defaultTarget,
- const QVector3D &defaultUp);
+ Q_INVOKABLE void setBaseOrientation(const QVector3D &defaultPosition,
+ const QVector3D &defaultTarget,
+ const QVector3D &defaultUp);
QVector3D calculatePositionRelativeToCamera(const QVector3D &relativePosition,
float fixedRotation,
@@ -99,7 +128,7 @@ signals:
void maxYRotationChanged(float rotation);
void zoomLevelChanged(int zoomLevel);
void viewMatrixChanged(QMatrix4x4 viewMatrix);
- void cameraPresetChanged(QDataVis::CameraPreset preset);
+ void cameraPresetChanged(CameraPreset preset);
void viewMatrixAutoUpdateChanged(bool enabled);
void wrapXRotationChanged(bool isEnabled);
void wrapYRotationChanged(bool isEnabled);
diff --git a/src/datavisualization/engine/q3dcamera_p.h b/src/datavisualization/engine/q3dcamera_p.h
index 63f47cf0..ac32248e 100644
--- a/src/datavisualization/engine/q3dcamera_p.h
+++ b/src/datavisualization/engine/q3dcamera_p.h
@@ -71,7 +71,7 @@ public:
bool m_wrapXRotation;
bool m_wrapYRotation;
int m_zoomLevel;
- QDataVis::CameraPreset m_activePreset;
+ Q3DCamera::CameraPreset m_activePreset;
friend class Bars3DRenderer;
friend class Surface3DRenderer;
diff --git a/src/datavisualization/engine/q3dlight.cpp b/src/datavisualization/engine/q3dlight.cpp
index 742b0ce7..bc43c3d7 100644
--- a/src/datavisualization/engine/q3dlight.cpp
+++ b/src/datavisualization/engine/q3dlight.cpp
@@ -23,16 +23,27 @@
QT_DATAVISUALIZATION_BEGIN_NAMESPACE
/*!
- \class Q3DLight
- \inmodule QtDataVisualization
- \brief Representation of a light source in 3D space.
- \since Qt Data Visualization 1.0
+ * \class Q3DLight
+ * \inmodule QtDataVisualization
+ * \brief Representation of a light source in 3D space.
+ * \since Qt Data Visualization 1.0
+ *
+ * Q3DLight represents a monochrome non variable light source in 3D space.
+ */
- Q3DLight represents a monochrome non variable light source in 3D space.
-*/
+/*!
+ * \qmltype Light3D
+ * \inqmlmodule QtDataVisualization
+ * \since QtDataVisualization 1.0
+ * \ingroup datavisualization_qml
+ * \instantiates Q3DLight
+ * \brief Representation of a light source in 3D space.
+ *
+ * Light3D represents a monochrome non variable light source in 3D space.
+ */
/*!
- * Constructs a new 3D light located at origo. An optional \a parent parameter can be given
+ * Constructs a new 3D light located at origin. An optional \a parent parameter can be given
* and is then passed to QObject constructor.
*/
Q3DLight::Q3DLight(QObject *parent) :
diff --git a/src/datavisualization/engine/q3dscene.cpp b/src/datavisualization/engine/q3dscene.cpp
index cfef3dcf..c7c54bd3 100644
--- a/src/datavisualization/engine/q3dscene.cpp
+++ b/src/datavisualization/engine/q3dscene.cpp
@@ -44,6 +44,90 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
/*!
+ * \qmltype Scene3D
+ * \inqmlmodule QtDataVisualization
+ * \since QtDataVisualization 1.0
+ * \ingroup datavisualization_qml
+ * \instantiates Q3DScene
+ * \brief Scene3D type provides description of the 3D scene being visualized.
+ *
+ * The 3D scene contains a single active camera and a single active light source.
+ * Visualized data is assumed to be at a fixed location.
+ *
+ * The 3D scene also keeps track of the viewport in which visualization rendering is done,
+ * the primary subviewport inside the viewport where the main 3D data visualization view resides
+ * and the secondary subviewport where the 2D sliced view of the data resides.
+ *
+ * Also the scene has flag for tracking if the secondary 2D slicing view is currently active or not.
+ * \note Not all visualizations support the secondary 2D slicing view.
+ */
+
+/*!
+ * \qmlproperty rect Scene3D::viewport
+ *
+ * This property contains the current viewport rectangle where all 3D rendering
+ * is targeted.
+ */
+
+/*!
+ * \qmlproperty rect Scene3D::primarySubViewport
+ *
+ * This property contains the current subviewport rectangle inside the viewport where the
+ * primary view of the data visualization is targeted to.
+ */
+
+/*!
+ * \qmlproperty rect Scene3D::secondarySubViewport
+ *
+ * This property contains the secondary viewport rectangle inside the viewport. The secondary
+ * viewport is used for drawing the 2D slice view in some visualizations.
+ */
+
+/*!
+ * \qmlproperty point Scene3D::selectionQueryPosition
+ *
+ * This property contains the coordinates for the user input that should be processed
+ * by the scene as selection. If this is set to value other than \c{(-1, -1)} the
+ * graph tries to select a data item at the given point within the primary viewport.
+ * After the rendering pass the property is returned to its default state of \c{(-1, -1)}.
+ */
+
+/*!
+ * \qmlproperty bool Scene3D::slicingActive
+ *
+ * This property contains whether 2D slicing view is currently active or not.
+ * \note Not all visualizations support the 2D slicing view.
+ */
+
+/*!
+ * \qmlproperty bool Scene3D::secondarySubviewOnTop
+ *
+ * This property contains whether 2D slicing view is currently drawn on top or if the 3D view is
+ * drawn on top.
+ */
+
+/*!
+ * \qmlproperty Camera3D Scene3D::activeCamera
+ *
+ * This property contains the currently active camera in the 3D scene.
+ * When a Camera3D is set in the property it gets automatically added as child of the scene.
+ */
+
+/*!
+ * \qmlproperty Light3D Scene3D::activeLight
+ *
+ * This property contains the currently active light in the 3D scene.
+ * When a Light3D is set in the property it gets automatically added as child of the scene.
+ */
+
+/*!
+ * \qmlproperty float Scene3D::devicePixelRatio
+ *
+ * This property contains the current device pixel ratio that is used when mapping input
+ * coordinates to pixel coordinates.
+ */
+
+/*!
* Constructs a basic scene with one light and one camera in it. An
* optional \a parent parameter can be given and is then passed to QObject constructor.
*/
@@ -102,7 +186,7 @@ void Q3DScene::setViewportSize(int width, int height)
/*!
* \property Q3DScene::primarySubViewport
*
- * This property contains the current main viewport rectangle inside the viewport where the
+ * This property contains the current subviewport rectangle inside the viewport where the
* primary view of the data visualization is targeted to.
*/
QRect Q3DScene::primarySubViewport() const
@@ -123,7 +207,7 @@ void Q3DScene::setPrimarySubViewport(const QRect &primarySubViewport)
* Returns whether the given \a point resides inside the primary subview or not.
* The method takes care of correctly mapping between OpenGL coordinates used in the
* viewport definitions and the Qt event coordinate system used in the input system.
- * \return true if the point is inside the primary subview.
+ * \return \c true if the point is inside the primary subview.
*/
bool Q3DScene::isPointInPrimarySubView(const QPoint &point)
{
@@ -142,7 +226,7 @@ bool Q3DScene::isPointInPrimarySubView(const QPoint &point)
* Returns whether the given \a point resides inside the secondary subview or not.
* The method takes care of correctly mapping between OpenGL coordinates used in the
* viewport definitions and the Qt event coordinate system used in the input system.
- * \return true if the point is inside the secondary subview.
+ * \return \c true if the point is inside the secondary subview.
*/
bool Q3DScene::isPointInSecondarySubView(const QPoint &point)
{
@@ -179,10 +263,11 @@ void Q3DScene::setSecondarySubViewport(const QRect &secondarySubViewport)
/*!
* \property Q3DScene::selectionQueryPosition
+ *
* This property contains the coordinates for the user input that should be processed
- * by the scene as selection. If this is set to value other than Q3DScene()::invalidSelectionPoint() the
- * graph tries to select a data item at the given \a point within the main viewport.
- * After the rendering pass the property is returned to its default state of Q3DScene()::invalidSelectionPoint().
+ * by the scene as selection. If this is set to value other than invalidSelectionPoint() the
+ * graph tries to select a data item at the given \a point within the primary viewport.
+ * After the rendering pass the property is returned to its default state of invalidSelectionPoint().
*/
void Q3DScene::setSelectionQueryPosition(const QPoint &point)
{
@@ -232,7 +317,8 @@ void Q3DScene::setSlicingActive(bool isSlicing)
/*!
* \property Q3DScene::secondarySubviewOnTop
*
- * This property contains whether 2D slicing view is currently drawn on top or if the 3D view is drawn on top.
+ * This property contains whether 2D slicing view is currently drawn on top or if the 3D view is
+ * drawn on top.
*/
bool Q3DScene::isSecondarySubviewOnTop() const
{
@@ -253,7 +339,8 @@ void Q3DScene::setSecondarySubviewOnTop(bool isSecondaryOnTop)
* \property Q3DScene::activeCamera
*
* This property contains the currently active camera in the 3D scene.
- * When a new Q3DCamera objects is set in the property it gets automatically added as child of the scene.
+ * When a new Q3DCamera objects is set in the property it gets automatically added as child of
+ * the scene.
*/
Q3DCamera *Q3DScene::activeCamera() const
{
@@ -299,7 +386,8 @@ void Q3DScene::setActiveCamera(Q3DCamera *camera)
* \property Q3DScene::activeLight
*
* This property contains the currently active light in the 3D scene.
- * When a new Q3DLight objects is set in the property it gets automatically added as child of the scene.
+ * When a new Q3DLight objects is set in the property it gets automatically added as child of
+ * the scene.
*/
Q3DLight *Q3DScene::activeLight() const
{
@@ -341,9 +429,11 @@ void Q3DScene::setDevicePixelRatio(float pixelRatio)
}
/*!
- * Calculates and sets the light position relative to the currently active camera using the given parameters.
- * \a relativePosition defines the relative 3D offset to the current camera position.
- * Optional \a fixedRotation fixes the light rotation around the data visualization area to the given value in degrees.
+ * Calculates and sets the light position relative to the currently active camera using the given
+ * parameters.
+ * The relative 3D offset to the current camera position is defined in \a relativePosition.
+ * Optional \a fixedRotation fixes the light rotation around the data visualization area to the
+ * given value in degrees.
* Optional \a distanceModifier modifies the distance of the light from the data visualization.
*/
void Q3DScene::setLightPositionRelativeToCamera(const QVector3D &relativePosition,
diff --git a/src/datavisualization/global/qdatavisualizationenums.h b/src/datavisualization/global/qdatavisualizationenums.h
index e3cdf669..fcbf63a9 100644
--- a/src/datavisualization/global/qdatavisualizationenums.h
+++ b/src/datavisualization/global/qdatavisualizationenums.h
@@ -28,50 +28,10 @@ namespace QtDataVisualization {
class QT_DATAVISUALIZATION_EXPORT QDataVis : public QObject
{
Q_OBJECT
- Q_ENUMS(CameraPreset)
Q_ENUMS(ShadowQuality)
Q_FLAGS(SelectionFlag SelectionFlags)
public:
- // TODO: Move to input handler (QTRD-2505)
- enum InputState {
- InputStateNone = 0,
- InputStateOnScene,
- InputStateOnOverview,
- InputStateOnSlice,
- InputStateRotating,
- InputStateOnPinch
- };
-
- // TODO: Move to camera (QTRD-2505)
- enum CameraPreset {
- CameraPresetNone = -1,
- CameraPresetFrontLow = 0,
- CameraPresetFront,
- CameraPresetFrontHigh,
- CameraPresetLeftLow,
- CameraPresetLeft,
- CameraPresetLeftHigh,
- CameraPresetRightLow,
- CameraPresetRight,
- CameraPresetRightHigh,
- CameraPresetBehindLow,
- CameraPresetBehind,
- CameraPresetBehindHigh,
- CameraPresetIsometricLeft,
- CameraPresetIsometricLeftHigh,
- CameraPresetIsometricRight,
- CameraPresetIsometricRightHigh,
- CameraPresetDirectlyAbove,
- CameraPresetDirectlyAboveCW45,
- CameraPresetDirectlyAboveCCW45,
- CameraPresetFrontBelow,
- CameraPresetLeftBelow,
- CameraPresetRightBelow,
- CameraPresetBehindBelow,
- CameraPresetDirectlyBelow
- };
-
enum SelectionFlag {
SelectionNone = 0,
SelectionItem = 1,
diff --git a/src/datavisualization/global/qtdatavisualizationenums.qdoc b/src/datavisualization/global/qtdatavisualizationenums.qdoc
index 4bedcefe..f3fa406c 100644
--- a/src/datavisualization/global/qtdatavisualizationenums.qdoc
+++ b/src/datavisualization/global/qtdatavisualizationenums.qdoc
@@ -37,61 +37,6 @@
*/
/*!
- \enum QtDataVisualization::QDataVis::InputState
-
- Predefined input states for mouse and touch based input handlers. All states are not valid with all input handlers.
-
- \value InputStateNone
- Default "no input received" state.
- \value InputStateOnScene
- Mouse or touch input received on the 3D scene.
- \value InputStateOnOverview
- Mouse or touch input received on the overview area.
- \value InputStateOnSlice
- Mouse or touch input received on the slice view area.
- \value InputStateRotating
- Rotation of the 3D geometry ongoing.
- \value InputStateOnPinch
- Pinch/punch multitouch input received.
-*/
-
-/*!
- \enum QtDataVisualization::QDataVis::CameraPreset
-
- Predefined positions for camera.
-
- \value CameraPresetNone
- Used to indicate a preset has not been set, or the scene has been rotated freely.
- \value CameraPresetFrontLow
- \value CameraPresetFront
- \value CameraPresetFrontHigh
- \value CameraPresetLeftLow
- \value CameraPresetLeft
- \value CameraPresetLeftHigh
- \value CameraPresetRightLow
- \value CameraPresetRight
- \value CameraPresetRightHigh
- \value CameraPresetBehindLow
- \value CameraPresetBehind
- \value CameraPresetBehindHigh
- \value CameraPresetIsometricLeft
- \value CameraPresetIsometricLeftHigh
- \value CameraPresetIsometricRight
- \value CameraPresetIsometricRightHigh
- \value CameraPresetDirectlyAbove
- \value CameraPresetDirectlyAboveCW45
- \value CameraPresetDirectlyAboveCCW45
- \value CameraPresetFrontBelow
- In Q3DBars from CameraPresetFrontBelow onward these only work for graphs including negative
- values. They act as Preset...Low for positive-only values.
- \value CameraPresetLeftBelow
- \value CameraPresetRightBelow
- \value CameraPresetBehindBelow
- \value CameraPresetDirectlyBelow
- Acts as CameraPresetFrontLow for positive -only bars.
-*/
-
-/*!
\enum QtDataVisualization::QDataVis::SelectionFlag
Item selection modes. Values of this enumeration can be combined with OR operator.
diff --git a/src/datavisualization/input/q3dinputhandler.cpp b/src/datavisualization/input/q3dinputhandler.cpp
index ec00ae1f..53a66b52 100644
--- a/src/datavisualization/input/q3dinputhandler.cpp
+++ b/src/datavisualization/input/q3dinputhandler.cpp
@@ -91,14 +91,14 @@ void Q3DInputHandler::mousePressEvent(QMouseEvent *event, const QPoint &mousePos
if (Qt::LeftButton == event->button()) {
if (scene()->isSlicingActive()) {
if (scene()->isPointInPrimarySubView(mousePos)) {
- setInputState(QDataVis::InputStateOnOverview);
+ setInputState(InputStateOnPrimaryView);
} else if (scene()->isPointInSecondarySubView(mousePos)) {
- setInputState(QDataVis::InputStateOnSlice);
+ setInputState(InputStateOnSecondaryView);
} else {
- setInputState(QDataVis::InputStateNone);
+ setInputState(InputStateNone);
}
} else {
- setInputState(QDataVis::InputStateOnScene);
+ setInputState(InputStateOnScene);
// update mouse positions to prevent jumping when releasing or repressing a button
setInputPosition(mousePos);
scene()->setSelectionQueryPosition(mousePos);
@@ -109,7 +109,7 @@ void Q3DInputHandler::mousePressEvent(QMouseEvent *event, const QPoint &mousePos
} else if (Qt::RightButton == event->button()) {
// disable rotating when in slice view
if (!scene()->isSlicingActive())
- setInputState(QDataVis::InputStateRotating);
+ setInputState(InputStateRotating);
// update mouse positions to prevent jumping when releasing or repressing a button
setInputPosition(mousePos);
}
@@ -126,11 +126,11 @@ void Q3DInputHandler::mouseReleaseEvent(QMouseEvent *event, const QPoint &mouseP
#if defined (Q_OS_ANDROID)
Q_UNUSED(mousePos);
#else
- if (QDataVis::InputStateRotating == inputState()) {
+ if (InputStateRotating == inputState()) {
// update mouse positions to prevent jumping when releasing or repressing a button
setInputPosition(mousePos);
}
- setInputState(QDataVis::InputStateNone);
+ setInputState(InputStateNone);
#endif
}
@@ -144,7 +144,7 @@ void Q3DInputHandler::mouseMoveEvent(QMouseEvent *event, const QPoint &mousePos)
#if defined (Q_OS_ANDROID)
Q_UNUSED(mousePos);
#else
- if (QDataVis::InputStateRotating == inputState()) {
+ if (InputStateRotating == inputState()) {
// Calculate mouse movement since last frame
float xRotation = scene()->activeCamera()->xRotation();
float yRotation = scene()->activeCamera()->yRotation();
diff --git a/src/datavisualization/input/qabstract3dinputhandler.cpp b/src/datavisualization/input/qabstract3dinputhandler.cpp
index 8a8313ef..0aa8372c 100644
--- a/src/datavisualization/input/qabstract3dinputhandler.cpp
+++ b/src/datavisualization/input/qabstract3dinputhandler.cpp
@@ -20,15 +20,46 @@
QT_DATAVISUALIZATION_BEGIN_NAMESPACE
/*!
- \class QAbstract3DInputHandler
- \inmodule QtDataVisualization
- \brief The base class for implementations of input handlers.
- \since Qt Data Visualization 1.0
+ * \class QAbstract3DInputHandler
+ * \inmodule QtDataVisualization
+ * \brief The base class for implementations of input handlers.
+ * \since Qt Data Visualization 1.0
+ *
+ * QAbstract3DInputHandler is the base class that is subclassed by different input handling implementations
+ * that take input events and translate those to camera and light movements. Input handlers also translate
+ * raw input events to slicing and selection events in the scene.
+ */
+
+/*!
+ * \enum QAbstract3DInputHandler::InputState
+ *
+ * Predefined input states for mouse and touch based input handlers. All states are not valid
+ * with all input handlers.
+ *
+ * \value InputStateNone
+ * Default "no input received" state.
+ * \value InputStateOnScene
+ * Mouse or touch input received on the 3D scene.
+ * \value InputStateOnPrimaryView
+ * Mouse or touch input received on the primary view area.
+ * \value InputStateOnSecondaryView
+ * Mouse or touch input received on the secondary view area.
+ * \value InputStateRotating
+ * Rotation of the 3D geometry ongoing.
+ * \value InputStatePinching
+ * Pinch/punch multitouch input ongoing.
+ */
- QAbstract3DInputHandler is the base class that is subclassed by different input handling implementations
- that take input events and translate those to camera and light movements. Input handlers also translate
- raw input events to slicing and selection events in the scene.
-*/
+/*!
+ * \qmltype AbstractInputHandler3D
+ * \inqmlmodule QtDataVisualization
+ * \since QtDataVisualization 1.0
+ * \ingroup datavisualization_qml
+ * \instantiates QAbstract3DInputHandler
+ * \brief Base type for all QtDataVisualization input handlers.
+ *
+ * This type is uncreatable.
+ */
/*!
* Constructs the base class. An optional \a parent parameter can be given
@@ -112,12 +143,12 @@ void QAbstract3DInputHandler::wheelEvent(QWheelEvent *event)
* Current enumerated input state based on the processed input events.
* When the state changes inputStateChanged() is emitted.
*/
-QDataVis::InputState QAbstract3DInputHandler::inputState()
+QAbstract3DInputHandler::InputState QAbstract3DInputHandler::inputState()
{
return d_ptr->m_inputState;
}
-void QAbstract3DInputHandler::setInputState(QDataVis::InputState inputState)
+void QAbstract3DInputHandler::setInputState(InputState inputState)
{
if (inputState != d_ptr->m_inputState) {
d_ptr->m_inputState = inputState;
@@ -201,7 +232,7 @@ QAbstract3DInputHandlerPrivate::QAbstract3DInputHandlerPrivate(QAbstract3DInputH
q_ptr(q),
m_prevDistance(0),
m_previousInputPos(QPoint(0,0)),
- m_inputState(QDataVis::InputStateNone),
+ m_inputState(QAbstract3DInputHandler::InputStateNone),
m_inputPosition(QPoint(0,0)),
m_scene(0)
{
diff --git a/src/datavisualization/input/qabstract3dinputhandler.h b/src/datavisualization/input/qabstract3dinputhandler.h
index fed6e3e0..313abef3 100644
--- a/src/datavisualization/input/qabstract3dinputhandler.h
+++ b/src/datavisualization/input/qabstract3dinputhandler.h
@@ -30,11 +30,22 @@ class QAbstract3DInputHandlerPrivate;
class QT_DATAVISUALIZATION_EXPORT QAbstract3DInputHandler : public QObject
{
Q_OBJECT
- Q_PROPERTY(QtDataVisualization::QDataVis::InputState inputState READ inputState WRITE setInputState NOTIFY inputStateChanged)
+ Q_ENUMS(InputState)
+ Q_PROPERTY(InputState inputState READ inputState WRITE setInputState NOTIFY inputStateChanged)
Q_PROPERTY(QPoint inputPosition READ inputPosition WRITE setInputPosition NOTIFY positionChanged)
Q_PROPERTY(Q3DScene *scene READ scene WRITE setScene NOTIFY sceneChanged)
public:
+ enum InputState {
+ InputStateNone = 0,
+ InputStateOnScene,
+ InputStateOnPrimaryView,
+ InputStateOnSecondaryView,
+ InputStateRotating,
+ InputStatePinching
+ };
+
+public:
explicit QAbstract3DInputHandler(QObject *parent = 0);
virtual ~QAbstract3DInputHandler();
@@ -48,8 +59,8 @@ public:
public:
// TODO: Check if the inputState needs to be visible outside of subclasses in the final architecture
- QDataVis::InputState inputState();
- void setInputState(QDataVis::InputState inputState);
+ InputState inputState();
+ void setInputState(InputState inputState);
QPoint inputPosition() const;
void setInputPosition(const QPoint &position);
@@ -59,7 +70,7 @@ public:
signals:
void positionChanged(QPoint position);
- void inputStateChanged(QDataVis::InputState state);
+ void inputStateChanged(InputState state);
void sceneChanged(const Q3DScene *scene);
protected:
diff --git a/src/datavisualization/input/qabstract3dinputhandler_p.h b/src/datavisualization/input/qabstract3dinputhandler_p.h
index cad1c667..205abf66 100644
--- a/src/datavisualization/input/qabstract3dinputhandler_p.h
+++ b/src/datavisualization/input/qabstract3dinputhandler_p.h
@@ -53,7 +53,7 @@ public:
GLfloat m_defaultYRotation;
private:
- QDataVis::InputState m_inputState;
+ QAbstract3DInputHandler::InputState m_inputState;
QPoint m_inputPosition;
QRect m_mainViewPort;
diff --git a/src/datavisualization/input/qtouch3dinputhandler.cpp b/src/datavisualization/input/qtouch3dinputhandler.cpp
index b36fdb99..32b8c609 100644
--- a/src/datavisualization/input/qtouch3dinputhandler.cpp
+++ b/src/datavisualization/input/qtouch3dinputhandler.cpp
@@ -99,18 +99,18 @@ void QTouch3DInputHandler::touchEvent(QTouchEvent *event)
if (event->type() == QEvent::TouchBegin) {
if (scene()->isSlicingActive()) {
if (scene()->isPointInPrimarySubView(pointerPos.toPoint()))
- setInputState(QDataVis::InputStateOnOverview);
+ setInputState(InputStateOnPrimaryView);
else if (scene()->isPointInSecondarySubView(pointerPos.toPoint()))
- setInputState(QDataVis::InputStateOnSlice);
+ setInputState(InputStateOnSecondaryView);
else
- setInputState(QDataVis::InputStateNone);
+ setInputState(InputStateNone);
} else {
// Handle possible tap-and-hold selection
d_ptr->m_startHoldPos = pointerPos;
d_ptr->m_touchHoldPos = d_ptr->m_startHoldPos;
d_ptr->m_holdTimer->start();
// Start rotating
- setInputState(QDataVis::InputStateRotating);
+ setInputState(InputStateRotating);
setInputPosition(pointerPos.toPoint());
}
} else if (event->type() == QEvent::TouchEnd) {
@@ -151,7 +151,7 @@ void QTouch3DInputHandlerPrivate::handlePinchZoom(float distance)
int prevDist = q_ptr->prevDistance();
if (prevDist > 0 && qAbs(prevDist - newDistance) < maxPinchJitter)
return;
- q_ptr->setInputState(QDataVis::InputStateOnPinch);
+ q_ptr->setInputState(QAbstract3DInputHandler::InputStatePinching);
Q3DCamera *camera = q_ptr->scene()->activeCamera();
int zoomLevel = camera->zoomLevel();
float zoomRate = qSqrt(qSqrt(zoomLevel));
@@ -172,7 +172,7 @@ void QTouch3DInputHandlerPrivate::handleTapAndHold()
QPointF distance = m_startHoldPos - m_touchHoldPos;
if (distance.manhattanLength() < maxTapAndHoldJitter) {
q_ptr->setInputPosition(m_touchHoldPos.toPoint());
- q_ptr->setInputState(QDataVis::InputStateOnScene);
+ q_ptr->setInputState(QAbstract3DInputHandler::InputStateOnScene);
}
}
@@ -180,16 +180,16 @@ void QTouch3DInputHandlerPrivate::handleSelection(const QPointF &position)
{
QPointF distance = m_startHoldPos - position;
if (distance.manhattanLength() < maxSelectionJitter)
- q_ptr->setInputState(QDataVis::InputStateOnScene);
+ q_ptr->setInputState(QAbstract3DInputHandler::InputStateOnScene);
else
- q_ptr->setInputState(QDataVis::InputStateNone);
+ q_ptr->setInputState(QAbstract3DInputHandler::InputStateNone);
q_ptr->setPreviousInputPos(position.toPoint());
q_ptr->scene()->setSelectionQueryPosition(position.toPoint());
}
void QTouch3DInputHandlerPrivate::handleRotation(const QPointF &position)
{
- if (QDataVis::InputStateRotating == q_ptr->inputState()) {
+ if (QAbstract3DInputHandler::InputStateRotating == q_ptr->inputState()) {
Q3DScene *scene = q_ptr->scene();
Q3DCamera *camera = scene->activeCamera();
float xRotation = camera->xRotation();
diff --git a/src/datavisualization/utils/camerahelper.cpp b/src/datavisualization/utils/camerahelper.cpp
index 29ed4d57..9e7e58aa 100644
--- a/src/datavisualization/utils/camerahelper.cpp
+++ b/src/datavisualization/utils/camerahelper.cpp
@@ -155,125 +155,125 @@ QPointF CameraHelper::getCameraRotations()
return rotations;
}
-void CameraHelper::setCameraPreset(QDataVis::CameraPreset preset)
+void CameraHelper::setCameraPreset(Q3DCamera::CameraPreset preset)
{
switch (preset) {
- case QDataVis::CameraPresetFrontLow: {
+ case Q3DCamera::CameraPresetFrontLow: {
qDebug("CameraPresetFrontLow");
CameraHelper::setCameraRotation(QPointF(0.0f, 0.0f));
break;
}
- case QDataVis::CameraPresetFront: {
+ case Q3DCamera::CameraPresetFront: {
qDebug("CameraPresetFront");
CameraHelper::setCameraRotation(QPointF(0.0f, 22.5f));
break;
}
- case QDataVis::CameraPresetFrontHigh: {
+ case Q3DCamera::CameraPresetFrontHigh: {
qDebug("CameraPresetFrontHigh");
CameraHelper::setCameraRotation(QPointF(0.0f, 45.0f));
break;
}
- case QDataVis::CameraPresetLeftLow: {
+ case Q3DCamera::CameraPresetLeftLow: {
qDebug("CameraPresetLeftLow");
CameraHelper::setCameraRotation(QPointF(90.0f, 0.0f));
break;
}
- case QDataVis::CameraPresetLeft: {
+ case Q3DCamera::CameraPresetLeft: {
qDebug("CameraPresetLeft");
CameraHelper::setCameraRotation(QPointF(90.0f, 22.5f));
break;
}
- case QDataVis::CameraPresetLeftHigh: {
+ case Q3DCamera::CameraPresetLeftHigh: {
qDebug("CameraPresetLeftHigh");
CameraHelper::setCameraRotation(QPointF(90.0f, 45.0f));
break;
}
- case QDataVis::CameraPresetRightLow: {
+ case Q3DCamera::CameraPresetRightLow: {
qDebug("CameraPresetRightLow");
CameraHelper::setCameraRotation(QPointF(-90.0f, 0.0f));
break;
}
- case QDataVis::CameraPresetRight: {
+ case Q3DCamera::CameraPresetRight: {
qDebug("CameraPresetRight");
CameraHelper::setCameraRotation(QPointF(-90.0f, 22.5f));
break;
}
- case QDataVis::CameraPresetRightHigh: {
+ case Q3DCamera::CameraPresetRightHigh: {
qDebug("CameraPresetRightHigh");
CameraHelper::setCameraRotation(QPointF(-90.0f, 45.0f));
break;
}
- case QDataVis::CameraPresetBehindLow: {
+ case Q3DCamera::CameraPresetBehindLow: {
qDebug("CameraPresetBehindLow");
CameraHelper::setCameraRotation(QPointF(180.0f, 0.0f));
break;
}
- case QDataVis::CameraPresetBehind: {
+ case Q3DCamera::CameraPresetBehind: {
qDebug("CameraPresetBehind");
CameraHelper::setCameraRotation(QPointF(180.0f, 22.5f));
break;
}
- case QDataVis::CameraPresetBehindHigh: {
+ case Q3DCamera::CameraPresetBehindHigh: {
qDebug("CameraPresetBehindHigh");
CameraHelper::setCameraRotation(QPointF(180.0f, 45.0f));
break;
}
- case QDataVis::CameraPresetIsometricLeft: {
+ case Q3DCamera::CameraPresetIsometricLeft: {
qDebug("CameraPresetIsometricLeft");
CameraHelper::setCameraRotation(QPointF(45.0f, 22.5f));
break;
}
- case QDataVis::CameraPresetIsometricLeftHigh: {
+ case Q3DCamera::CameraPresetIsometricLeftHigh: {
qDebug("CameraPresetIsometricLeftHigh");
CameraHelper::setCameraRotation(QPointF(45.0f, 45.0f));
break;
}
- case QDataVis::CameraPresetIsometricRight: {
+ case Q3DCamera::CameraPresetIsometricRight: {
qDebug("CameraPresetIsometricRight");
CameraHelper::setCameraRotation(QPointF(-45.0f, 22.5f));
break;
}
- case QDataVis::CameraPresetIsometricRightHigh: {
+ case Q3DCamera::CameraPresetIsometricRightHigh: {
qDebug("CameraPresetIsometricRightHigh");
CameraHelper::setCameraRotation(QPointF(-45.0f, 45.0f));
break;
}
- case QDataVis::CameraPresetDirectlyAbove: {
+ case Q3DCamera::CameraPresetDirectlyAbove: {
qDebug("CameraPresetDirectlyAbove");
CameraHelper::setCameraRotation(QPointF(0.0f, 90.0f));
break;
}
- case QDataVis::CameraPresetDirectlyAboveCW45: {
+ case Q3DCamera::CameraPresetDirectlyAboveCW45: {
qDebug("CameraPresetDirectlyAboveCW45");
CameraHelper::setCameraRotation(QPointF(-45.0f, 90.0f));
break;
}
- case QDataVis::CameraPresetDirectlyAboveCCW45: {
+ case Q3DCamera::CameraPresetDirectlyAboveCCW45: {
qDebug("CameraPresetDirectlyAboveCCW45");
CameraHelper::setCameraRotation(QPointF(45.0f, 90.0f));
break;
}
- case QDataVis::CameraPresetFrontBelow: {
+ case Q3DCamera::CameraPresetFrontBelow: {
qDebug("CameraPresetFrontBelow");
CameraHelper::setCameraRotation(QPointF(0.0f, -45.0f));
break;
}
- case QDataVis::CameraPresetLeftBelow: {
+ case Q3DCamera::CameraPresetLeftBelow: {
qDebug("CameraPresetLeftBelow");
CameraHelper::setCameraRotation(QPointF(90.0f, -45.0f));
break;
}
- case QDataVis::CameraPresetRightBelow: {
+ case Q3DCamera::CameraPresetRightBelow: {
qDebug("CameraPresetRightBelow");
CameraHelper::setCameraRotation(QPointF(-90.0f, -45.0f));
break;
}
- case QDataVis::CameraPresetBehindBelow: {
+ case Q3DCamera::CameraPresetBehindBelow: {
qDebug("CameraPresetBehindBelow");
CameraHelper::setCameraRotation(QPointF(180.0f, -45.0f));
break;
}
- case QDataVis::CameraPresetDirectlyBelow: {
+ case Q3DCamera::CameraPresetDirectlyBelow: {
qDebug("CameraPresetDirectlyBelow");
CameraHelper::setCameraRotation(QPointF(0.0f, -90.0f));
break;
diff --git a/src/datavisualization/utils/camerahelper_p.h b/src/datavisualization/utils/camerahelper_p.h
index 1ef4d257..50de93a8 100644
--- a/src/datavisualization/utils/camerahelper_p.h
+++ b/src/datavisualization/utils/camerahelper_p.h
@@ -30,6 +30,7 @@
#define CAMERAPOSITIONER_P_H
#include "datavisualizationglobal_p.h"
+#include "q3dcamera.h"
#include "q3dbars.h"
#include <QObject>
@@ -82,7 +83,7 @@ public:
GLfloat fixedRotation = 0.0f,
GLfloat distanceModifier = 0.0f);
void updateMousePos(const QPoint &mousePos);
- void setCameraPreset(QDataVis::CameraPreset preset);
+ void setCameraPreset(Q3DCamera::CameraPreset preset);
};
QT_DATAVISUALIZATION_END_NAMESPACE