diff options
author | Tomi Korpipää <tomi.korpipaa@qt.io> | 2016-11-18 13:12:13 +0200 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@qt.io> | 2016-11-18 11:17:22 +0000 |
commit | e584f8753a39d3364aa50b4b89bafa4a0209af7c (patch) | |
tree | d6438e2c66dd3ae5310bce8e0b49bae84cf228cc | |
parent | 4ff14c23b271747cc7a23fd72499d2032d692185 (diff) |
Allow light position modification by user
Change-Id: I7efd56754bae16990fd11081493da0a37698f76b
Task-number: QTRD-1803
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | src/datavisualization/engine/abstract3dcontroller.cpp | 4 | ||||
-rw-r--r-- | src/datavisualization/engine/abstract3drenderer.cpp | 13 | ||||
-rw-r--r-- | src/datavisualization/engine/q3dlight.cpp | 49 | ||||
-rw-r--r-- | src/datavisualization/engine/q3dlight.h | 7 | ||||
-rw-r--r-- | src/datavisualization/engine/q3dlight_p.h | 1 | ||||
-rw-r--r-- | src/datavisualization/engine/q3dobject.cpp | 26 | ||||
-rw-r--r-- | src/datavisualizationqml2/datavisualizationqml2_plugin.cpp | 7 | ||||
-rw-r--r-- | src/datavisualizationqml2/plugins.qmltypes | 452 | ||||
-rw-r--r-- | tests/auto/cpptest/q3dscene-light/tst_light.cpp | 7 | ||||
-rw-r--r-- | tests/auto/qmltest/scene3d/tst_light.qml | 13 |
10 files changed, 555 insertions, 24 deletions
diff --git a/src/datavisualization/engine/abstract3dcontroller.cpp b/src/datavisualization/engine/abstract3dcontroller.cpp index 08949c54..adfe461e 100644 --- a/src/datavisualization/engine/abstract3dcontroller.cpp +++ b/src/datavisualization/engine/abstract3dcontroller.cpp @@ -87,9 +87,7 @@ Abstract3DController::Abstract3DController(QRect initialViewport, Q3DScene *scen setActiveTheme(defaultTheme); m_scene->d_ptr->setViewport(initialViewport); - - // Populate the scene - m_scene->activeLight()->setPosition(defaultLightPos); + m_scene->activeLight()->setAutoPosition(true); // Create initial default input handler QAbstract3DInputHandler *inputHandler; diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp index 4a681554..dd3212ac 100644 --- a/src/datavisualization/engine/abstract3drenderer.cpp +++ b/src/datavisualization/engine/abstract3drenderer.cpp @@ -500,6 +500,11 @@ void Abstract3DRenderer::handleShadowQualityChange() { reInitShaders(); + if (m_cachedScene->activeLight()->isAutoPosition() + || m_cachedShadowQuality > QAbstract3DGraph::ShadowQualityNone) { + m_cachedScene->d_ptr->setLightPositionRelativeToCamera(defaultLightPos); + emit needRender(); + } if (m_isOpenGLES && m_cachedShadowQuality != QAbstract3DGraph::ShadowQualityNone) { emit requestShadowQuality(QAbstract3DGraph::ShadowQualityNone); qWarning("Shadows are not yet supported for OpenGL ES2"); @@ -1994,8 +1999,12 @@ void Abstract3DRenderer::updateCameraViewport() m_oldCameraTarget = adjustedTarget; } m_cachedScene->activeCamera()->d_ptr->updateViewMatrix(m_autoScaleAdjustment); - // Set light position (i.e rotate light with activeCamera, a bit above it) - m_cachedScene->d_ptr->setLightPositionRelativeToCamera(defaultLightPos); + // Set light position (i.e rotate light with activeCamera, a bit above it). + // Check if we want to use automatic light positioning even without shadows + if (m_cachedScene->activeLight()->isAutoPosition() + || m_cachedShadowQuality > QAbstract3DGraph::ShadowQualityNone) { + m_cachedScene->d_ptr->setLightPositionRelativeToCamera(defaultLightPos); + } } QT_END_NAMESPACE_DATAVISUALIZATION diff --git a/src/datavisualization/engine/q3dlight.cpp b/src/datavisualization/engine/q3dlight.cpp index bc337512..8c439023 100644 --- a/src/datavisualization/engine/q3dlight.cpp +++ b/src/datavisualization/engine/q3dlight.cpp @@ -37,7 +37,9 @@ QT_BEGIN_NAMESPACE_DATAVISUALIZATION * \brief Representation of a light source in 3D space. * \since QtDataVisualization 1.0 * - * Q3DLight represents a monochrome non variable light source in 3D space. + * Q3DLight represents a monochrome light source in 3D space. + * + * \note Default light has isAutoPosition() \c true. */ /*! @@ -48,7 +50,18 @@ QT_BEGIN_NAMESPACE_DATAVISUALIZATION * \instantiates Q3DLight * \brief Representation of a light source in 3D space. * - * Light3D represents a monochrome non variable light source in 3D space. + * Light3D represents a monochrome light source in 3D space. + * + * \note Default light has autoPosition \c true. + */ + +/*! + * \qmlproperty bool Light3D::autoPosition + * \since QtDataVisualization 1.3 + * Holds a flag telling if the light position is automatic or not. If true, light position follows + * camera automatically. + * \note Has no effect if shadows are enabled. Remember to disable shadows before setting light's + * position, or it will be overwritten by automatic positioning, if autoPosition is false. */ /*! @@ -68,8 +81,31 @@ Q3DLight::~Q3DLight() { } +/*! + * \property Q3DLight::autoPosition + * \since QtDataVisualization 5.9 + * Holds a flag telling if the light position is automatic or not. If true, light position follows + * camera automatically. + * \note Has no effect if shadows are enabled. Remember to disable shadows before setting light's + * position, or it will be overwritten by automatic positioning, if isAutoPosition() is false. + */ +void Q3DLight::setAutoPosition(bool enabled) +{ + if (enabled != d_ptr->m_automaticLight) { + d_ptr->m_automaticLight = enabled; + setDirty(true); + emit autoPositionChanged(enabled); + } +} + +bool Q3DLight::isAutoPosition() +{ + return d_ptr->m_automaticLight; +} + Q3DLightPrivate::Q3DLightPrivate(Q3DLight *q) : - q_ptr(q) + q_ptr(q), + m_automaticLight(false) { } @@ -79,8 +115,11 @@ Q3DLightPrivate::~Q3DLightPrivate() void Q3DLightPrivate::sync(Q3DLight &other) { - Q_UNUSED(other); - // Do nothing. Only value light has to sync is the position, which we handle internally. + if (q_ptr->isDirty()) { + other.setPosition(q_ptr->position()); + other.setAutoPosition(q_ptr->isAutoPosition()); + q_ptr->setDirty(false); + } } QT_END_NAMESPACE_DATAVISUALIZATION diff --git a/src/datavisualization/engine/q3dlight.h b/src/datavisualization/engine/q3dlight.h index 8dc59d3a..582e600c 100644 --- a/src/datavisualization/engine/q3dlight.h +++ b/src/datavisualization/engine/q3dlight.h @@ -39,11 +39,18 @@ class Q3DLightPrivate; class QT_DATAVISUALIZATION_EXPORT Q3DLight : public Q3DObject { Q_OBJECT + Q_PROPERTY(bool autoPosition READ isAutoPosition WRITE setAutoPosition NOTIFY autoPositionChanged REVISION 1) public: explicit Q3DLight(QObject *parent = Q_NULLPTR); virtual ~Q3DLight(); + void setAutoPosition(bool enabled); + bool isAutoPosition(); + +Q_SIGNALS: + Q_REVISION(1) void autoPositionChanged(bool autoPosition); + private: QScopedPointer<Q3DLightPrivate> d_ptr; diff --git a/src/datavisualization/engine/q3dlight_p.h b/src/datavisualization/engine/q3dlight_p.h index 2e22be47..afb3330b 100644 --- a/src/datavisualization/engine/q3dlight_p.h +++ b/src/datavisualization/engine/q3dlight_p.h @@ -57,6 +57,7 @@ public: void sync(Q3DLight &other); public: + bool m_automaticLight; Q3DLight *q_ptr; }; diff --git a/src/datavisualization/engine/q3dobject.cpp b/src/datavisualization/engine/q3dobject.cpp index 42c9ccd9..f7757293 100644 --- a/src/datavisualization/engine/q3dobject.cpp +++ b/src/datavisualization/engine/q3dobject.cpp @@ -43,6 +43,28 @@ QT_BEGIN_NAMESPACE_DATAVISUALIZATION */ /*! + \qmltype Object3D + \inqmlmodule QtDataVisualization + \since QtDataVisualization 1.0 + \ingroup datavisualization_qml + \instantiates Q3DObject + \brief Simple baseclass for all the objects in the 3D scene. + + Object3D is an uncreatable base type that contains only position information for an object in + 3D scene. The object is considered to be a single point in the coordinate space without + dimensions. +*/ + +/*! + * \qmlproperty vector3d Object3D::position + * + * This property contains the 3D position of the object. + * + * \note Currently setting this property has no effect for Camera3D, as the position is handled + * internally. + */ + +/*! * Constructs a new 3D object with position set to origin by default. An * optional \a parent parameter can be given and is then passed to QObject constructor. */ @@ -84,8 +106,8 @@ Q3DScene *Q3DObject::parentScene() * * This property contains the 3D position of the object. * - * \note Currently setting this property has no effect, as the positions of Q3DObjects in the - * scene are handled internally. + * \note Currently setting this property has no effect for Q3DCamera, as the position is handled + * internally. */ QVector3D Q3DObject::position() const { diff --git a/src/datavisualizationqml2/datavisualizationqml2_plugin.cpp b/src/datavisualizationqml2/datavisualizationqml2_plugin.cpp index d5349150..6dd124b8 100644 --- a/src/datavisualizationqml2/datavisualizationqml2_plugin.cpp +++ b/src/datavisualizationqml2/datavisualizationqml2_plugin.cpp @@ -67,6 +67,8 @@ void QtDataVisualizationQml2Plugin::registerTypes(const char *uri) QLatin1String("Trying to create uncreatable: Q3DTheme, use Theme3D instead.")); qmlRegisterUncreatableType<QAbstract3DInputHandler>(uri, 1, 0, "AbstractInputHandler3D", QLatin1String("Trying to create uncreatable: AbstractInputHandler3D.")); + qmlRegisterUncreatableType<Q3DObject>(uri, 1, 0, "Object3D", + QLatin1String("Trying to create uncreatable: Object3D.")); qmlRegisterType<DeclarativeBars>(uri, 1, 0, "Bars3D"); qmlRegisterType<DeclarativeScatter>(uri, 1, 0, "Scatter3D"); @@ -135,6 +137,11 @@ void QtDataVisualizationQml2Plugin::registerTypes(const char *uri) qmlRegisterType<Q3DInputHandler>(uri, 1, 2, "InputHandler3D"); qmlRegisterType<QTouch3DInputHandler>(uri, 1, 2, "TouchInputHandler3D"); qmlRegisterType<QCustom3DVolume>(uri, 1, 2, "Custom3DVolume"); + + // QtDataVisualization 1.3 + + // New revisions + qmlRegisterType<Q3DLight, 1>(uri, 1, 3, "Light3D"); } QT_END_NAMESPACE_DATAVISUALIZATION diff --git a/src/datavisualizationqml2/plugins.qmltypes b/src/datavisualizationqml2/plugins.qmltypes index 956100ed..3aab437d 100644 --- a/src/datavisualizationqml2/plugins.qmltypes +++ b/src/datavisualizationqml2/plugins.qmltypes @@ -1,12 +1,444 @@ -import QtQuick.tooling 1.1 +import QtQuick.tooling 1.2 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump.exe -nonrelocatable QtDataVisualization 1.2' +// 'qmlplugindump -v -nonrelocatable -defaultplatform QtDataVisualization 1.3' Module { + dependencies: [] + Component { + name: "QAbstractItemModel" + prototype: "QObject" + exports: ["QtDataVisualization/AbstractItemModel 1.0"] + isCreatable: false + exportMetaObjectRevisions: [0] + Enum { + name: "LayoutChangeHint" + values: { + "NoLayoutChangeHint": 0, + "VerticalSortHint": 1, + "HorizontalSortHint": 2 + } + } + Signal { + name: "dataChanged" + Parameter { name: "topLeft"; type: "QModelIndex" } + Parameter { name: "bottomRight"; type: "QModelIndex" } + Parameter { name: "roles"; type: "QVector<int>" } + } + Signal { + name: "dataChanged" + Parameter { name: "topLeft"; type: "QModelIndex" } + Parameter { name: "bottomRight"; type: "QModelIndex" } + } + Signal { + name: "headerDataChanged" + Parameter { name: "orientation"; type: "Qt::Orientation" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "layoutChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } + } + Signal { + name: "layoutChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + } + Signal { name: "layoutChanged" } + Signal { + name: "layoutAboutToBeChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } + } + Signal { + name: "layoutAboutToBeChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + } + Signal { name: "layoutAboutToBeChanged" } + Signal { + name: "rowsAboutToBeInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsAboutToBeRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsAboutToBeInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsAboutToBeRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { name: "modelAboutToBeReset" } + Signal { name: "modelReset" } + Signal { + name: "rowsAboutToBeMoved" + Parameter { name: "sourceParent"; type: "QModelIndex" } + Parameter { name: "sourceStart"; type: "int" } + Parameter { name: "sourceEnd"; type: "int" } + Parameter { name: "destinationParent"; type: "QModelIndex" } + Parameter { name: "destinationRow"; type: "int" } + } + Signal { + name: "rowsMoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + Parameter { name: "destination"; type: "QModelIndex" } + Parameter { name: "row"; type: "int" } + } + Signal { + name: "columnsAboutToBeMoved" + Parameter { name: "sourceParent"; type: "QModelIndex" } + Parameter { name: "sourceStart"; type: "int" } + Parameter { name: "sourceEnd"; type: "int" } + Parameter { name: "destinationParent"; type: "QModelIndex" } + Parameter { name: "destinationColumn"; type: "int" } + } + Signal { + name: "columnsMoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + Parameter { name: "destination"; type: "QModelIndex" } + Parameter { name: "column"; type: "int" } + } + Method { name: "submit"; type: "bool" } + Method { name: "revert" } + Method { + name: "hasIndex" + type: "bool" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "hasIndex" + type: "bool" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + } + Method { + name: "index" + type: "QModelIndex" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "index" + type: "QModelIndex" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + } + Method { + name: "parent" + type: "QModelIndex" + Parameter { name: "child"; type: "QModelIndex" } + } + Method { + name: "sibling" + type: "QModelIndex" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + Parameter { name: "idx"; type: "QModelIndex" } + } + Method { + name: "rowCount" + type: "int" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { name: "rowCount"; type: "int" } + Method { + name: "columnCount" + type: "int" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { name: "columnCount"; type: "int" } + Method { + name: "hasChildren" + type: "bool" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { name: "hasChildren"; type: "bool" } + Method { + name: "data" + type: "QVariant" + Parameter { name: "index"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + } + Method { + name: "data" + type: "QVariant" + Parameter { name: "index"; type: "QModelIndex" } + } + Method { + name: "setData" + type: "bool" + Parameter { name: "index"; type: "QModelIndex" } + Parameter { name: "value"; type: "QVariant" } + Parameter { name: "role"; type: "int" } + } + Method { + name: "setData" + type: "bool" + Parameter { name: "index"; type: "QModelIndex" } + Parameter { name: "value"; type: "QVariant" } + } + Method { + name: "headerData" + type: "QVariant" + Parameter { name: "section"; type: "int" } + Parameter { name: "orientation"; type: "Qt::Orientation" } + Parameter { name: "role"; type: "int" } + } + Method { + name: "headerData" + type: "QVariant" + Parameter { name: "section"; type: "int" } + Parameter { name: "orientation"; type: "Qt::Orientation" } + } + Method { + name: "fetchMore" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "canFetchMore" + type: "bool" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "flags" + type: "Qt::ItemFlags" + Parameter { name: "index"; type: "QModelIndex" } + } + Method { + name: "match" + type: "QModelIndexList" + Parameter { name: "start"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + Parameter { name: "value"; type: "QVariant" } + Parameter { name: "hits"; type: "int" } + Parameter { name: "flags"; type: "Qt::MatchFlags" } + } + Method { + name: "match" + type: "QModelIndexList" + Parameter { name: "start"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + Parameter { name: "value"; type: "QVariant" } + Parameter { name: "hits"; type: "int" } + } + Method { + name: "match" + type: "QModelIndexList" + Parameter { name: "start"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + Parameter { name: "value"; type: "QVariant" } + } + } + Component { + name: "QQuickItem" + defaultProperty: "data" + prototype: "QObject" + Enum { + name: "TransformOrigin" + values: { + "TopLeft": 0, + "Top": 1, + "TopRight": 2, + "Left": 3, + "Center": 4, + "Right": 5, + "BottomLeft": 6, + "Bottom": 7, + "BottomRight": 8 + } + } + Property { name: "parent"; type: "QQuickItem"; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "x"; type: "double" } + Property { name: "y"; type: "double" } + Property { name: "z"; type: "double" } + Property { name: "width"; type: "double" } + Property { name: "height"; type: "double" } + Property { name: "opacity"; type: "double" } + Property { name: "enabled"; type: "bool" } + Property { name: "visible"; type: "bool" } + Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } + Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } + Property { name: "state"; type: "string" } + Property { name: "childrenRect"; type: "QRectF"; isReadonly: true } + Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true } + Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baselineOffset"; type: "double" } + Property { name: "clip"; type: "bool" } + Property { name: "focus"; type: "bool" } + Property { name: "activeFocus"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnTab"; revision: 1; type: "bool" } + Property { name: "rotation"; type: "double" } + Property { name: "scale"; type: "double" } + Property { name: "transformOrigin"; type: "TransformOrigin" } + Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true } + Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true } + Property { name: "smooth"; type: "bool" } + Property { name: "antialiasing"; type: "bool" } + Property { name: "implicitWidth"; type: "double" } + Property { name: "implicitHeight"; type: "double" } + Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true } + Signal { + name: "childrenRectChanged" + Parameter { type: "QRectF" } + } + Signal { + name: "baselineOffsetChanged" + Parameter { type: "double" } + } + Signal { + name: "stateChanged" + Parameter { type: "string" } + } + Signal { + name: "focusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusOnTabChanged" + revision: 1 + Parameter { type: "bool" } + } + Signal { + name: "parentChanged" + Parameter { type: "QQuickItem"; isPointer: true } + } + Signal { + name: "transformOriginChanged" + Parameter { type: "TransformOrigin" } + } + Signal { + name: "smoothChanged" + Parameter { type: "bool" } + } + Signal { + name: "antialiasingChanged" + Parameter { type: "bool" } + } + Signal { + name: "clipChanged" + Parameter { type: "bool" } + } + Signal { + name: "windowChanged" + revision: 1 + Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } + } + Method { name: "update" } + Method { + name: "grabToImage" + revision: 2 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + Parameter { name: "targetSize"; type: "QSize" } + } + Method { + name: "grabToImage" + revision: 2 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + } + Method { + name: "contains" + type: "bool" + Parameter { name: "point"; type: "QPointF" } + } + Method { + name: "mapFromItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapFromGlobal" + revision: 7 + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToGlobal" + revision: 7 + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { name: "forceActiveFocus" } + Method { + name: "forceActiveFocus" + Parameter { name: "reason"; type: "Qt::FocusReason" } + } + Method { + name: "nextItemInFocusChain" + revision: 1 + type: "QQuickItem*" + Parameter { name: "forward"; type: "bool" } + } + Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" } + Method { + name: "childAt" + type: "QQuickItem*" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } Component { name: "QtDataVisualization::AbstractDeclarative" defaultProperty: "data" @@ -744,12 +1176,24 @@ Module { Component { name: "QtDataVisualization::Q3DLight" prototype: "QtDataVisualization::Q3DObject" - exports: ["QtDataVisualization/Light3D 1.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtDataVisualization/Light3D 1.0", + "QtDataVisualization/Light3D 1.3" + ] + exportMetaObjectRevisions: [0, 1] + Property { name: "autoPosition"; revision: 1; type: "bool" } + Signal { + name: "autoPositionChanged" + revision: 1 + Parameter { name: "autoPosition"; type: "bool" } + } } Component { name: "QtDataVisualization::Q3DObject" prototype: "QObject" + exports: ["QtDataVisualization/Object3D 1.0"] + isCreatable: false + exportMetaObjectRevisions: [0] Property { name: "parentScene"; type: "Q3DScene"; isReadonly: true; isPointer: true } Property { name: "position"; type: "QVector3D" } Signal { diff --git a/tests/auto/cpptest/q3dscene-light/tst_light.cpp b/tests/auto/cpptest/q3dscene-light/tst_light.cpp index ccaec13e..d5eb4507 100644 --- a/tests/auto/cpptest/q3dscene-light/tst_light.cpp +++ b/tests/auto/cpptest/q3dscene-light/tst_light.cpp @@ -81,8 +81,7 @@ void tst_light::initialProperties() { QVERIFY(m_light); - // TODO: Has no adjustable properties yet. - // Keeping this as a placeholder for future implementations (QTRD-2406) + QCOMPARE(m_light->isAutoPosition(), false); // Common (from Q3DObject) QVERIFY(!m_light->parentScene()); @@ -93,9 +92,11 @@ void tst_light::initializeProperties() { QVERIFY(m_light); - m_light->setPosition(QVector3D(1.0, 1.0, 1.0)); + m_light->setAutoPosition(true); + QCOMPARE(m_light->isAutoPosition(), true); // Common (from Q3DObject) + m_light->setPosition(QVector3D(1.0, 1.0, 1.0)); QCOMPARE(m_light->position(), QVector3D(1.0, 1.0, 1.0)); } diff --git a/tests/auto/qmltest/scene3d/tst_light.qml b/tests/auto/qmltest/scene3d/tst_light.qml index 35d1e0ca..68602316 100644 --- a/tests/auto/qmltest/scene3d/tst_light.qml +++ b/tests/auto/qmltest/scene3d/tst_light.qml @@ -28,7 +28,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtDataVisualization 1.2 +import QtDataVisualization 1.3 import QtTest 1.0 Item { @@ -36,26 +36,26 @@ Item { height: 150 width: 150 - // TODO: Has no adjustable properties yet. - // Keeping this as a placeholder for future implementations (QTRD-2406) - /* Light3D { id: initial } Light3D { id: initialized + autoPosition: true } Light3D { id: change + autoPosition: true } TestCase { name: "Light3D Initial" function test_initial() { + compare(initial.autoPosition, false) } } @@ -63,6 +63,7 @@ Item { name: "Light3D Initialized" function test_initialized() { + compare(initialized.autoPosition, true) } } @@ -70,7 +71,9 @@ Item { name: "Light3D Change" function test_change() { + compare(change.autoPosition, true) + change.autoPosition = false + compare(change.autoPosition, false) } } - */ } |