diff options
24 files changed, 750 insertions, 150 deletions
@@ -116,6 +116,7 @@ tools/activeqt/testcon/testcon.tlb translations/*.qm translations/*_untranslated.ts qrc_*.cpp +*.qmlc # Test generated files QObject.log @@ -124,6 +125,7 @@ tst_* tst_*.log tst_*.debug tst_*~ +tst_*.qmlc # xemacs temporary files *.flc @@ -207,6 +209,7 @@ doc-build build/* bin/* coverage/* +build-*/* # runonphone crash dumps d_exc_*.txt diff --git a/.qmake.conf b/.qmake.conf index b0087692..a088fffc 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,5 +1,5 @@ load(qt_build_config) -MODULE_VERSION = 5.8.1 +MODULE_VERSION = 5.9.0 CMAKE_MODULE_TESTS=- @@ -1,5 +1,5 @@ --------------------------- -Qt Data Visualization 5.7.0 +Qt Data Visualization 5.9.0 --------------------------- Qt Data Visualization module provides multiple graph types to visualize data in 3D space @@ -80,8 +80,6 @@ Known Issues - Anti-aliasing doesn't work with OpenGL ES2 (including Angle builds in Windows). - QCustom3DVolume items are not supported with OpenGL ES2 (including Angle builds in Windows). - Surfaces with non-straight rows and columns do not always render properly. -- Q3DLight class (and Light3D QML item) are currently not usable for anything. -- Changing most of Q3DScene properties affecting subviewports currently has no effect. - Widget based examples layout incorrectly in iOS. - Reparenting a graph to an item in another QQuickWindow is not supported. - Android builds of QML applications importing QtDataVisualization also require diff --git a/dist/changes-5.9.0 b/dist/changes-5.9.0 new file mode 100644 index 00000000..85dfb543 --- /dev/null +++ b/dist/changes-5.9.0 @@ -0,0 +1,8 @@ +Qt Data Visualization 5.9.0 + +Fixed issues +------------ + +- [QTRD-1803] Enable customer controlled light position +- [QTRD-1807] Customer can't set the primary and secondary viewports +- [QTRD-2116] Crash if OpenGL version is not high enough 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 ecef2598..dd3212ac 100644 --- a/src/datavisualization/engine/abstract3drenderer.cpp +++ b/src/datavisualization/engine/abstract3drenderer.cpp @@ -134,10 +134,14 @@ Abstract3DRenderer::Abstract3DRenderer(Abstract3DController *controller) QtMessageHandler handler = qInstallMessageHandler(discardDebugMsgs); m_funcs_2_1 = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_2_1>(); - m_funcs_2_1->initializeOpenGLFunctions(); + if (m_funcs_2_1) + m_funcs_2_1->initializeOpenGLFunctions(); // Restore original message handler qInstallMessageHandler(handler); + + if (!m_funcs_2_1) + qFatal("OpenGL version is too low, at least 2.1 is required"); } #endif QObject::connect(m_drawer, &Drawer::drawerChanged, this, &Abstract3DRenderer::updateTextures); @@ -496,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"); @@ -1990,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/datavisualization/engine/q3dscene.cpp b/src/datavisualization/engine/q3dscene.cpp index b1a96a2d..93056bfc 100644 --- a/src/datavisualization/engine/q3dscene.cpp +++ b/src/datavisualization/engine/q3dscene.cpp @@ -87,14 +87,19 @@ QT_BEGIN_NAMESPACE_DATAVISUALIZATION * \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. + * primary view of the data visualization is targeted to. If slicingActive is false, it will be + * equal to viewport. If slicingActive is true and it hasn't been explicitly set, it will be one + * fifth of viewport. + * \note Setting primarySubViewport larger than or outside of viewport resizes viewport accordingly. */ /*! * \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. + * viewport is used for drawing the 2D slice view in some visualizations. If it hasn't been + * explicitly set, it will be null, or viewport if slicingActive is true. + * \note Setting secondarySubViewport larger than or outside of viewport resizes viewport accordingly. */ /*! @@ -204,24 +209,49 @@ QRect Q3DScene::viewport() const * \property Q3DScene::primarySubViewport * * This property contains the current subviewport rectangle inside the viewport where the - * primary view of the data visualization is targeted to. + * primary view of the data visualization is targeted to. If isSlicingActive() is false, it will be + * equal to viewport(). If isSlicingActive() is true and it hasn't been explicitly set, it will be + * one fifth of viewport(). + * \note Setting primarySubViewport larger than or outside of viewport resizes viewport accordingly. */ QRect Q3DScene::primarySubViewport() const { - return d_ptr->m_primarySubViewport; + QRect primary = d_ptr->m_primarySubViewport; + if (primary.isNull()) { + if (d_ptr->m_isSlicingActive) + primary = d_ptr->m_defaultSmallViewport; + else + primary = d_ptr->m_defaultLargeViewport; + } + return primary; } void Q3DScene::setPrimarySubViewport(const QRect &primarySubViewport) { - QRect clipRect = QRect(0, 0, d_ptr->m_viewport.width(), d_ptr->m_viewport.height()); - QRect intersectedViewport = primarySubViewport.intersected(clipRect); - if (d_ptr->m_primarySubViewport != intersectedViewport) { - d_ptr->m_primarySubViewport = intersectedViewport; + if (d_ptr->m_primarySubViewport != primarySubViewport) { + if (!primarySubViewport.isValid() && !primarySubViewport.isNull()) { + qWarning("Viewport is invalid."); + return; + } + + // If viewport is smaller than primarySubViewport, enlarge it + if ((d_ptr->m_viewport.width() < (primarySubViewport.width() + + primarySubViewport.x())) + || (d_ptr->m_viewport.height() < (primarySubViewport.height() + + primarySubViewport.y()))) { + d_ptr->m_viewport.setWidth(qMax(d_ptr->m_viewport.width(), + primarySubViewport.width() + primarySubViewport.x())); + d_ptr->m_viewport.setHeight(qMax(d_ptr->m_viewport.height(), + primarySubViewport.height() + primarySubViewport.y())); + d_ptr->calculateSubViewports(); + } + + d_ptr->m_primarySubViewport = primarySubViewport; d_ptr->updateGLSubViewports(); d_ptr->m_changeTracker.primarySubViewportChanged = true; d_ptr->m_sceneDirty = true; - emit primarySubViewportChanged(intersectedViewport); + emit primarySubViewportChanged(primarySubViewport); emit d_ptr->needRender(); } } @@ -236,9 +266,9 @@ bool Q3DScene::isPointInPrimarySubView(const QPoint &point) { int x = point.x(); int y = point.y(); - bool isInSecondary = d_ptr->isInArea(d_ptr->m_secondarySubViewport, x, y); + bool isInSecondary = d_ptr->isInArea(secondarySubViewport(), x, y); if (!isInSecondary || (isInSecondary && !d_ptr->m_isSecondarySubviewOnTop)) - return d_ptr->isInArea(d_ptr->m_primarySubViewport, x, y); + return d_ptr->isInArea(primarySubViewport(), x, y); else return false; } @@ -253,9 +283,9 @@ bool Q3DScene::isPointInSecondarySubView(const QPoint &point) { int x = point.x(); int y = point.y(); - bool isInPrimary = d_ptr->isInArea(d_ptr->m_primarySubViewport, x, y); + bool isInPrimary = d_ptr->isInArea(primarySubViewport(), x, y); if (!isInPrimary || (isInPrimary && d_ptr->m_isSecondarySubviewOnTop)) - return d_ptr->isInArea(d_ptr->m_secondarySubViewport, x, y); + return d_ptr->isInArea(secondarySubViewport(), x, y); else return false; } @@ -264,24 +294,46 @@ bool Q3DScene::isPointInSecondarySubView(const QPoint &point) * \property Q3DScene::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. + * viewport is used for drawing the 2D slice view in some visualizations. If it hasn't been + * explicitly set, it will be equal to QRect(), or viewport() if isSlicingActive() is true. + * \note Setting secondarySubViewport larger than or outside of viewport resizes viewport accordingly. */ QRect Q3DScene::secondarySubViewport() const { - return d_ptr->m_secondarySubViewport; + QRect secondary = d_ptr->m_secondarySubViewport; + if (secondary.isNull() && d_ptr->m_isSlicingActive) + secondary = d_ptr->m_defaultLargeViewport; + return secondary; } void Q3DScene::setSecondarySubViewport(const QRect &secondarySubViewport) { - QRect clipRect = QRect(0, 0, d_ptr->m_viewport.width(), d_ptr->m_viewport.height()); - QRect intersectedViewport = secondarySubViewport.intersected(clipRect); - if (d_ptr->m_secondarySubViewport != intersectedViewport) { - d_ptr->m_secondarySubViewport = intersectedViewport; + if (d_ptr->m_secondarySubViewport != secondarySubViewport) { + if (!secondarySubViewport.isValid() && !secondarySubViewport.isNull()) { + qWarning("Viewport is invalid."); + return; + } + + // If viewport is smaller than secondarySubViewport, enlarge it + if ((d_ptr->m_viewport.width() < (secondarySubViewport.width() + + secondarySubViewport.x())) + || (d_ptr->m_viewport.height() < (secondarySubViewport.height() + + secondarySubViewport.y()))) { + d_ptr->m_viewport.setWidth(qMax(d_ptr->m_viewport.width(), + secondarySubViewport.width() + + secondarySubViewport.x())); + d_ptr->m_viewport.setHeight(qMax(d_ptr->m_viewport.height(), + secondarySubViewport.height() + + secondarySubViewport.y())); + d_ptr->calculateSubViewports(); + } + + d_ptr->m_secondarySubViewport = secondarySubViewport; d_ptr->updateGLSubViewports(); d_ptr->m_changeTracker.secondarySubViewportChanged = true; d_ptr->m_sceneDirty = true; - emit secondarySubViewportChanged(intersectedViewport); + emit secondarySubViewportChanged(secondarySubViewport); emit d_ptr->needRender(); } } @@ -527,6 +579,7 @@ Q3DScenePrivate::Q3DScenePrivate(Q3DScene *q) : m_isSlicingActive(false), m_selectionQueryPosition(Q3DScene::invalidSelectionPoint()), m_graphPositionQueryPosition(Q3DScene::invalidSelectionPoint()), + m_windowSize(QSize(0, 0)), m_sceneDirty(true) { } @@ -608,7 +661,7 @@ void Q3DScenePrivate::sync(Q3DScenePrivate &other) void Q3DScenePrivate::setViewport(const QRect &viewport) { - if (m_viewport != viewport) { + if (m_viewport != viewport && viewport.isValid()) { m_viewport = viewport; calculateSubViewports(); emit needRender(); @@ -617,8 +670,7 @@ void Q3DScenePrivate::setViewport(const QRect &viewport) void Q3DScenePrivate::setViewportSize(int width, int height) { - if (m_viewport.width() != width - || m_viewport.height() != height) { + if (m_viewport.width() != width || m_viewport.height() != height) { m_viewport.setWidth(width); m_viewport.setHeight(height); calculateSubViewports(); @@ -650,18 +702,14 @@ QSize Q3DScenePrivate::windowSize() const void Q3DScenePrivate::calculateSubViewports() { - // Calculates the default subviewport layout + // Calculates the default subviewport layout, used when slicing const float smallerViewPortRatio = 0.2f; - if (m_isSlicingActive) { - q_ptr->setPrimarySubViewport(QRect(0, - 0, - m_viewport.width() * smallerViewPortRatio, - m_viewport.height() * smallerViewPortRatio)); - q_ptr->setSecondarySubViewport(QRect(0, 0, m_viewport.width(), m_viewport.height())); - } else { - q_ptr->setPrimarySubViewport(QRect(0, 0, m_viewport.width(), m_viewport.height())); - q_ptr->setSecondarySubViewport(QRect(0, 0, 0, 0)); - } + m_defaultSmallViewport = QRect(0, 0, + m_viewport.width() * smallerViewPortRatio, + m_viewport.height() * smallerViewPortRatio); + m_defaultLargeViewport = QRect(0, 0, + m_viewport.width(), + m_viewport.height()); updateGLViewport(); } @@ -685,21 +733,36 @@ void Q3DScenePrivate::updateGLViewport() void Q3DScenePrivate::updateGLSubViewports() { - m_glPrimarySubViewport.setX((m_primarySubViewport.x() + m_viewport.x()) * m_devicePixelRatio); - m_glPrimarySubViewport.setY((m_windowSize.height() - (m_primarySubViewport.y() + m_viewport.y() - + m_primarySubViewport.height())) - * m_devicePixelRatio); - m_glPrimarySubViewport.setWidth(m_primarySubViewport.width() * m_devicePixelRatio); - m_glPrimarySubViewport.setHeight(m_primarySubViewport.height() * m_devicePixelRatio); - - m_glSecondarySubViewport.setX((m_secondarySubViewport.x() + m_viewport.x()) - * m_devicePixelRatio); - m_glSecondarySubViewport.setY((m_windowSize.height() - (m_secondarySubViewport.y() - + m_viewport.y() - + m_secondarySubViewport.height())) - * m_devicePixelRatio); - m_glSecondarySubViewport.setWidth(m_secondarySubViewport.width() * m_devicePixelRatio); - m_glSecondarySubViewport.setHeight(m_secondarySubViewport.height() * m_devicePixelRatio); + if (m_isSlicingActive) { + QRect primary = m_primarySubViewport; + QRect secondary = m_secondarySubViewport; + if (primary.isNull()) + primary = m_defaultSmallViewport; + if (secondary.isNull()) + secondary = m_defaultLargeViewport; + + m_glPrimarySubViewport.setX((primary.x() + m_viewport.x()) * m_devicePixelRatio); + m_glPrimarySubViewport.setY((m_windowSize.height() + - (primary.y() + primary.height() + m_viewport.y())) + * m_devicePixelRatio); + m_glPrimarySubViewport.setWidth(primary.width() * m_devicePixelRatio); + m_glPrimarySubViewport.setHeight(primary.height() * m_devicePixelRatio); + + m_glSecondarySubViewport.setX((secondary.x() + m_viewport.x()) * m_devicePixelRatio); + m_glSecondarySubViewport.setY((m_windowSize.height() + - (secondary.y() + secondary.height() + m_viewport.y())) + * m_devicePixelRatio); + m_glSecondarySubViewport.setWidth(secondary.width() * m_devicePixelRatio); + m_glSecondarySubViewport.setHeight(secondary.height() * m_devicePixelRatio); + } else { + m_glPrimarySubViewport.setX(m_viewport.x() * m_devicePixelRatio); + m_glPrimarySubViewport.setY((m_windowSize.height() - (m_viewport.y() + m_viewport.height())) + * m_devicePixelRatio); + m_glPrimarySubViewport.setWidth(m_viewport.width() * m_devicePixelRatio); + m_glPrimarySubViewport.setHeight(m_viewport.height() * m_devicePixelRatio); + + m_glSecondarySubViewport = QRect(); + } } QRect Q3DScenePrivate::glViewport() diff --git a/src/datavisualization/engine/q3dscene_p.h b/src/datavisualization/engine/q3dscene_p.h index 0ae5d91a..4056e89d 100644 --- a/src/datavisualization/engine/q3dscene_p.h +++ b/src/datavisualization/engine/q3dscene_p.h @@ -129,6 +129,8 @@ public: QRect m_glPrimarySubViewport; QRect m_glSecondarySubViewport; bool m_sceneDirty; + QRect m_defaultSmallViewport; + QRect m_defaultLargeViewport; }; QT_END_NAMESPACE_DATAVISUALIZATION diff --git a/src/datavisualization/utils/texturehelper.cpp b/src/datavisualization/utils/texturehelper.cpp index 7a5098c4..fb7b099a 100644 --- a/src/datavisualization/utils/texturehelper.cpp +++ b/src/datavisualization/utils/texturehelper.cpp @@ -49,10 +49,14 @@ TextureHelper::TextureHelper() m_openGlFunctions_2_1 = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_2_1>(); - m_openGlFunctions_2_1->initializeOpenGLFunctions(); + if (m_openGlFunctions_2_1) + m_openGlFunctions_2_1->initializeOpenGLFunctions(); // Restore original message handler qInstallMessageHandler(handler); + + if (!m_openGlFunctions_2_1) + qFatal("OpenGL version is too low, at least 2.1 is required"); } #endif } diff --git a/src/datavisualizationqml2/abstractdeclarative.cpp b/src/datavisualizationqml2/abstractdeclarative.cpp index 220a1a0c..7568fd30 100644 --- a/src/datavisualizationqml2/abstractdeclarative.cpp +++ b/src/datavisualizationqml2/abstractdeclarative.cpp @@ -77,6 +77,10 @@ AbstractDeclarative::~AbstractDeclarative() disconnect(this, 0, this, 0); checkWindowList(0); + // Make sure not deleting locked mutex + QMutexLocker locker(&m_mutex); + locker.unlock(); + m_nodeMutex.clear(); } @@ -518,6 +522,8 @@ void AbstractDeclarative::itemChange(ItemChange change, const ItemChangeData & v void AbstractDeclarative::updateWindowParameters() { + const QMutexLocker locker(&m_mutex); + // Update the device pixel ratio, window size and bounding box QQuickWindow *win = window(); if (win && !m_controller.isNull()) { diff --git a/src/datavisualizationqml2/abstractdeclarative_p.h b/src/datavisualizationqml2/abstractdeclarative_p.h index ebdf7609..1a9c4e81 100644 --- a/src/datavisualizationqml2/abstractdeclarative_p.h +++ b/src/datavisualizationqml2/abstractdeclarative_p.h @@ -235,6 +235,8 @@ public: void setMargin(qreal margin); qreal margin() const; + QMutex *mutex() { return &m_mutex; } + public Q_SLOTS: virtual void handleAxisXChanged(QAbstract3DAxis *axis) = 0; virtual void handleAxisYChanged(QAbstract3DAxis *axis) = 0; @@ -302,6 +304,7 @@ private: QThread *m_mainThread; QThread *m_contextThread; bool m_runningInDesigner; + QMutex m_mutex; }; Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractDeclarative::SelectionFlags) Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractDeclarative::OptimizationHints) 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/declarativebars.cpp b/src/datavisualizationqml2/declarativebars.cpp index 2e3964f9..ca1d3f60 100644 --- a/src/datavisualizationqml2/declarativebars.cpp +++ b/src/datavisualizationqml2/declarativebars.cpp @@ -51,6 +51,7 @@ DeclarativeBars::DeclarativeBars(QQuickItem *parent) DeclarativeBars::~DeclarativeBars() { QMutexLocker locker(m_nodeMutex.data()); + const QMutexLocker locker2(mutex()); delete m_barsController; } diff --git a/src/datavisualizationqml2/declarativescatter.cpp b/src/datavisualizationqml2/declarativescatter.cpp index 0b7efdb4..29e56a79 100644 --- a/src/datavisualizationqml2/declarativescatter.cpp +++ b/src/datavisualizationqml2/declarativescatter.cpp @@ -49,6 +49,7 @@ DeclarativeScatter::DeclarativeScatter(QQuickItem *parent) DeclarativeScatter::~DeclarativeScatter() { QMutexLocker locker(m_nodeMutex.data()); + const QMutexLocker locker2(mutex()); delete m_scatterController; } diff --git a/src/datavisualizationqml2/declarativesurface.cpp b/src/datavisualizationqml2/declarativesurface.cpp index 4bfa7873..2e210246 100644 --- a/src/datavisualizationqml2/declarativesurface.cpp +++ b/src/datavisualizationqml2/declarativesurface.cpp @@ -51,6 +51,7 @@ DeclarativeSurface::DeclarativeSurface(QQuickItem *parent) DeclarativeSurface::~DeclarativeSurface() { QMutexLocker locker(m_nodeMutex.data()); + const QMutexLocker locker2(mutex()); delete m_surfaceController; } 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/cpptest/q3dscene/tst_scene.cpp b/tests/auto/cpptest/q3dscene/tst_scene.cpp index 25658246..1336f400 100644 --- a/tests/auto/cpptest/q3dscene/tst_scene.cpp +++ b/tests/auto/cpptest/q3dscene/tst_scene.cpp @@ -111,21 +111,25 @@ void tst_scene::initializeProperties() m_scene->setPrimarySubViewport(QRect(0, 0, 50, 50)); m_scene->setSecondarySubViewport(QRect(50, 50, 100, 100)); m_scene->setSecondarySubviewOnTop(false); - m_scene->setSelectionQueryPosition(QPoint(0, 0)); m_scene->setSlicingActive(true); + m_scene->setSelectionQueryPosition(QPoint(0, 0)); QCOMPARE(m_scene->activeCamera(), camera1); QCOMPARE(m_scene->activeLight(), light1); QCOMPARE(m_scene->devicePixelRatio(), 2.0f); QCOMPARE(m_scene->graphPositionQuery(), QPoint(0, 0)); // TODO: When doing signal checks, add tests to check that queries return something (asynchronously) - // TODO: subviewports are not set (QTRD-1807) - //QCOMPARE(m_scene->primarySubViewport(), QRect(0, 0, 50, 50)); - //QCOMPARE(m_scene->secondarySubViewport(), QRect(50, 50, 100, 100)); + QCOMPARE(m_scene->primarySubViewport(), QRect(0, 0, 50, 50)); + QCOMPARE(m_scene->secondarySubViewport(), QRect(50, 50, 100, 100)); QCOMPARE(m_scene->isSecondarySubviewOnTop(), false); QCOMPARE(m_scene->selectionQueryPosition(), QPoint(0, 0)); // TODO: When doing signal checks, add tests to check that queries return something (asynchronously) QCOMPARE(m_scene->isSlicingActive(), true); - // TODO: viewport is not set by subviewports (QTRD-1807) - //QCOMPARE(m_scene->viewport(), QRect(0, 0, 100, 100)); + QCOMPARE(m_scene->viewport(), QRect(0, 0, 150, 150)); + + m_scene->setPrimarySubViewport(QRect()); + m_scene->setSecondarySubViewport(QRect()); + + QCOMPARE(m_scene->primarySubViewport(), QRect(0, 0, 30, 30)); + QCOMPARE(m_scene->secondarySubViewport(), QRect(0, 0, 150, 150)); } void tst_scene::invalidProperties() 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) } } - */ } diff --git a/tests/auto/qmltest/scene3d/tst_scene.qml b/tests/auto/qmltest/scene3d/tst_scene.qml index e653a781..08a55662 100644 --- a/tests/auto/qmltest/scene3d/tst_scene.qml +++ b/tests/auto/qmltest/scene3d/tst_scene.qml @@ -70,30 +70,21 @@ Item { compare(initial.scene.devicePixelRatio, 1.0) compare(initial.scene.graphPositionQuery, Qt.point(-1, -1)) compare(initial.scene.invalidSelectionPoint, Qt.point(-1, -1)) - // TODO: subviewports are not set (QTRD-1807) - //compare(initial.scene.primarySubViewport.x, 0) - //compare(initial.scene.primarySubViewport.y, 0) - //compare(initial.scene.primarySubViewport.width, 0) - //compare(initial.scene.primarySubViewport.height, 0) - // For some reason comparing like this fails in 5.8.0 (QRect vs. QRectF) - //compare(initial.scene.primarySubViewport, Qt.rect(0, 0, 0, 0)) - // TODO: subviewports are not set (QTRD-1807) - //compare(initial.scene.secondarySubViewport.x, 0) - //compare(initial.scene.secondarySubViewport.y, 0) - //compare(initial.scene.secondarySubViewport.width, 0) - //compare(initial.scene.secondarySubViewport.height, 0) - // For some reason comparing like this fails in 5.8.0 (QRect vs. QRectF) - //compare(initial.scene.secondarySubViewport, Qt.rect(0, 0, 0, 0)) + compare(initial.scene.primarySubViewport.x, 0) + compare(initial.scene.primarySubViewport.y, 0) + compare(initial.scene.primarySubViewport.width, 0) + compare(initial.scene.primarySubViewport.height, 0) + compare(initial.scene.secondarySubViewport.x, 0) + compare(initial.scene.secondarySubViewport.y, 0) + compare(initial.scene.secondarySubViewport.width, 0) + compare(initial.scene.secondarySubViewport.height, 0) compare(initial.scene.secondarySubviewOnTop, true) compare(initial.scene.selectionQueryPosition, Qt.point(-1, -1)) compare(initial.scene.slicingActive, false) - // TODO: viewport is not set by subviewports (QTRD-1807) - //compare(initial.scene.viewport.x, 0) - //compare(initial.scene.viewport.y, 0) - //compare(initial.scene.viewport.width, 0) - //compare(initial.scene.viewport.height, 0) - // For some reason comparing like this fails in 5.8.0 (QRect vs. QRectF) - //compare(initial.scene.viewport, Qt.rect(0, 0, 0, 0)) + compare(initial.scene.viewport.x, 0) + compare(initial.scene.viewport.y, 0) + compare(initial.scene.viewport.width, 0) + compare(initial.scene.viewport.height, 0) } } @@ -104,30 +95,21 @@ Item { compare(initialized.scene.activeCamera.zoomLevel, 200) compare(initialized.scene.devicePixelRatio, 2.0) compare(initialized.scene.graphPositionQuery, Qt.point(0, 0)) - // TODO: subviewports are not set (QTRD-1807) - //compare(initialized.scene.primarySubViewport.x, 0) - //compare(initialized.scene.primarySubViewport.y, 0) - //compare(initialized.scene.primarySubViewport.width, 50) - //compare(initialized.scene.primarySubViewport.height, 50) - // For some reason comparing like this fails in 5.8.0 (QRect vs. QRectF) - //compare(initialized.scene.primarySubViewport, Qt.rect(0, 0, 50, 50)) - // TODO: subviewports are not set (QTRD-1807) - //compare(initialized.scene.secondarySubViewport.x, 50) - //compare(initialized.scene.secondarySubViewport.y, 50) - //compare(initialized.scene.secondarySubViewport.width, 100) - //compare(initialized.scene.secondarySubViewport.height, 100) - // For some reason comparing like this fails in 5.8.0 (QRect vs. QRectF) - //compare(initialized.scene.secondarySubViewport, Qt.rect(50, 50, 100, 100)) + compare(initialized.scene.primarySubViewport.x, 0) + compare(initialized.scene.primarySubViewport.y, 0) + compare(initialized.scene.primarySubViewport.width, 50) + compare(initialized.scene.primarySubViewport.height, 50) + compare(initialized.scene.secondarySubViewport.x, 50) + compare(initialized.scene.secondarySubViewport.y, 50) + compare(initialized.scene.secondarySubViewport.width, 100) + compare(initialized.scene.secondarySubViewport.height, 100) compare(initialized.scene.secondarySubviewOnTop, false) compare(initialized.scene.selectionQueryPosition, Qt.point(0, 0)) compare(initialized.scene.slicingActive, true) - // TODO: viewport is not set by subviewports (QTRD-1807) - //compare(initialized.scene.viewport.x, 50) - //compare(initialized.scene.viewport.y, 50) - //compare(initialized.scene.viewport.width, 100) - //compare(initialized.scene.viewport.height, 100) - // For some reason comparing like this fails in 5.8.0 (QRect vs. QRectF) - //compare(initialized.scene.viewport, Qt.rect(0, 0, 100, 100)) + compare(initialized.scene.viewport.x, 0) + compare(initialized.scene.viewport.y, 0) + compare(initialized.scene.viewport.width, 150) + compare(initialized.scene.viewport.height, 150) } } @@ -152,30 +134,21 @@ Item { compare(change.scene.activeCamera.zoomLevel, 200) compare(change.scene.devicePixelRatio, 2.0) compare(change.scene.graphPositionQuery, Qt.point(0, 0)) - // TODO: subviewports are not set (QTRD-1807) - //compare(change.scene.primarySubViewport.x, 0) - //compare(change.scene.primarySubViewport.y, 0) - //compare(change.scene.primarySubViewport.width, 50) - //compare(change.scene.primarySubViewport.height, 50) - // For some reason comparing like this fails in 5.8.0 (QRect vs. QRectF) - //compare(change.scene.primarySubViewport, Qt.rect(0, 0, 50, 50)) - // TODO: subviewports are not set (QTRD-1807) - //compare(change.scene.secondarySubViewport.x, 50) - //compare(change.scene.secondarySubViewport.y, 50) - //compare(change.scene.secondarySubViewport.width, 100) - //compare(change.scene.secondarySubViewport.height, 100) - // For some reason comparing like this fails in 5.8.0 (QRect vs. QRectF) - //compare(change.scene.secondarySubViewport, Qt.rect(50, 50, 100, 100)) + compare(change.scene.primarySubViewport.x, 0) + compare(change.scene.primarySubViewport.y, 0) + compare(change.scene.primarySubViewport.width, 50) + compare(change.scene.primarySubViewport.height, 50) + compare(change.scene.secondarySubViewport.x, 50) + compare(change.scene.secondarySubViewport.y, 50) + compare(change.scene.secondarySubViewport.width, 100) + compare(change.scene.secondarySubViewport.height, 100) compare(change.scene.secondarySubviewOnTop, false) compare(change.scene.selectionQueryPosition, Qt.point(0, 0)) compare(change.scene.slicingActive, true) - // TODO: viewport is not set by subviewports (QTRD-1807) - //compare(change.scene.viewport.x, 0) - //compare(change.scene.viewport.y, 0) - //compare(change.scene.viewport.width, 100) - //compare(change.scene.viewport.height, 100) - // For some reason comparing like this fails in 5.8.0 (QRect vs. QRectF) - //compare(change.scene.viewport, Qt.rect(0, 0, 100, 100)) + compare(change.scene.viewport.x, 0) + compare(change.scene.viewport.y, 0) + compare(change.scene.viewport.width, 150) + compare(change.scene.viewport.height, 150) } } @@ -188,8 +161,6 @@ Item { compare(invalid.scene.primarySubViewport.y, 0) compare(invalid.scene.primarySubViewport.width, 0) compare(invalid.scene.primarySubViewport.height, 0) - // For some reason comparing like this fails in 5.8.0 (QRect vs. QRectF) - //compare(change.scene.primarySubViewport, Qt.rect(0, 0, 0, 0)) } } } |