diff options
author | Mike Krus <mike.krus@kdab.com> | 2020-06-19 20:25:20 +0100 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2020-06-25 07:19:28 +0100 |
commit | d285e73c634df20f680b2661be6b20ba32e9335a (patch) | |
tree | fff62abe5cacd16a9f2c1abf56b5ea57e7c75c05 /examples/qt3d | |
parent | d788bcd6fd1b28994f467433b1486ac759952348 (diff) |
Update examples
Not all work
Change-Id: I7954f9fe41160c929ff48f8bdeae635b900fef33
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'examples/qt3d')
-rw-r--r-- | examples/qt3d/advancedcustommaterial/CMakeLists.txt | 2 | ||||
-rw-r--r-- | examples/qt3d/advancedcustommaterial/Water.qml | 8 | ||||
-rw-r--r-- | examples/qt3d/advancedcustommaterial/main.cpp | 1 | ||||
-rw-r--r-- | examples/qt3d/advancedcustommaterial/main.qml | 34 | ||||
-rw-r--r-- | examples/qt3d/controls/CMakeLists.txt | 1 | ||||
-rw-r--r-- | examples/qt3d/controls/main.cpp | 1 | ||||
-rw-r--r-- | examples/qt3d/controls/main.qml | 34 | ||||
-rw-r--r-- | examples/qt3d/controlsunderlay/main.cpp | 1 | ||||
-rw-r--r-- | examples/qt3d/controlsunderlay/main.qml | 34 | ||||
-rw-r--r-- | examples/qt3d/planets-qml/PlanetsMain.qml | 30 | ||||
-rw-r--r-- | examples/qt3d/planets-qml/SolarSystem.qml | 6 | ||||
-rw-r--r-- | examples/qt3d/planets-qml/StyledSlider.qml | 35 | ||||
-rw-r--r-- | examples/qt3d/planets-qml/main.cpp | 1 | ||||
-rw-r--r-- | examples/qt3d/scene3dview/main.cpp | 1 | ||||
-rw-r--r-- | examples/qt3d/simplecustommaterial/main.cpp | 1 | ||||
-rw-r--r-- | examples/qt3d/wave/Wave.qml | 10 |
16 files changed, 88 insertions, 112 deletions
diff --git a/examples/qt3d/advancedcustommaterial/CMakeLists.txt b/examples/qt3d/advancedcustommaterial/CMakeLists.txt index 40f6f2ad3..ffa4b03a8 100644 --- a/examples/qt3d/advancedcustommaterial/CMakeLists.txt +++ b/examples/qt3d/advancedcustommaterial/CMakeLists.txt @@ -41,6 +41,8 @@ qt6_add_resources(advancedcustommaterial "qml" FILES ${qml_resource_files} ) +target_sources(advancedcustommaterial PRIVATE ${qml_resource_files}) # just to show qml files in creator + set(models_resource_files "models/waterPlane.obj" ) diff --git a/examples/qt3d/advancedcustommaterial/Water.qml b/examples/qt3d/advancedcustommaterial/Water.qml index 1e7f119a5..8bf00e7a8 100644 --- a/examples/qt3d/advancedcustommaterial/Water.qml +++ b/examples/qt3d/advancedcustommaterial/Water.qml @@ -109,14 +109,14 @@ import QtQuick 2.0 as QQ2 property: "waveRandomAnim" to: 3.0 duration: 4000 - easing.type: Easing.Linear +// easing.type: Easing.Linear } QQ2.NumberAnimation { target: watermaterial property: "waveRandomAnim" to: 1.0 duration: 4000 - easing.type: Easing.Linear +// easing.type: Easing.Linear } } @@ -161,14 +161,14 @@ import QtQuick 2.0 as QQ2 property: "vertY" to: 200 duration: 200000 - easing.type: Easing.Linear +// easing.type: Easing.Linear } QQ2.NumberAnimation { target: watermaterial property: "vertY" to: 2 duration: 200000 - easing.type: Easing.Linear +// easing.type: Easing.Linear } } } diff --git a/examples/qt3d/advancedcustommaterial/main.cpp b/examples/qt3d/advancedcustommaterial/main.cpp index eef254063..6b7b41507 100644 --- a/examples/qt3d/advancedcustommaterial/main.cpp +++ b/examples/qt3d/advancedcustommaterial/main.cpp @@ -74,6 +74,7 @@ int main(int argc, char **argv) QGuiApplication app(argc, argv); setSurfaceFormat(); + QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi); QQuickView view; view.resize(1920, 1080); diff --git a/examples/qt3d/advancedcustommaterial/main.qml b/examples/qt3d/advancedcustommaterial/main.qml index 7087dd1f2..25de84a52 100644 --- a/examples/qt3d/advancedcustommaterial/main.qml +++ b/examples/qt3d/advancedcustommaterial/main.qml @@ -51,7 +51,7 @@ import QtQuick 2.0 import QtQuick.Scene3D 2.0 import Qt3D.Render 2.0 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.0 Item { @@ -105,7 +105,7 @@ Item { anchors.rightMargin: 10 anchors.leftMargin: 10 value: 1.0 - minimumValue: 0.3 + from: 0.3 } } Rectangle { @@ -130,8 +130,8 @@ Item { anchors.rightMargin: 10 anchors.leftMargin: 10 value: 1.1 - maximumValue: 4.0 - minimumValue: 0.0 + to: 4.0 + from: 0.0 } } Rectangle { @@ -156,8 +156,8 @@ Item { anchors.rightMargin: 10 anchors.leftMargin: 10 value: 1.0 - maximumValue: 3.0 - minimumValue: 0.0 + to: 3.0 + from: 0.0 } } Rectangle { @@ -182,8 +182,8 @@ Item { anchors.rightMargin: 10 anchors.leftMargin: 10 value: 0.015 - maximumValue: 0.1 - minimumValue: 0.0 + to: 0.1 + from: 0.0 } } Rectangle { @@ -208,8 +208,8 @@ Item { anchors.rightMargin: 10 anchors.leftMargin: 10 value: 2.2 - maximumValue: 4.0 - minimumValue: 0.0 + to: 4.0 + from: 0.0 } } Rectangle { @@ -229,14 +229,14 @@ Item { } Slider { id: slider2 - updateValueWhileDragging: false + live: false anchors.fill: parent anchors.topMargin: 30 anchors.rightMargin: 10 anchors.leftMargin: 10 value: 0.75 - maximumValue: 4.0 - minimumValue: 0.1 + to: 4.0 + from: 0.1 } } Rectangle { @@ -261,8 +261,8 @@ Item { anchors.rightMargin: 10 anchors.leftMargin: 10 value: 0.2 - maximumValue: 0.5 - minimumValue: 0.02 + to: 0.5 + from: 0.02 } } Rectangle { @@ -287,8 +287,8 @@ Item { anchors.rightMargin: 10 anchors.leftMargin: 10 value: 35.0 - maximumValue: 360.0 - minimumValue: 0.0 + to: 360.0 + from: 0.0 } } } diff --git a/examples/qt3d/controls/CMakeLists.txt b/examples/qt3d/controls/CMakeLists.txt index 0bdef4187..1ed8d038d 100644 --- a/examples/qt3d/controls/CMakeLists.txt +++ b/examples/qt3d/controls/CMakeLists.txt @@ -40,6 +40,7 @@ qt6_add_resources(controls "controls" FILES ${controls_resource_files} ) +target_sources(controls PRIVATE ${controls_resources_files}) # just to show qml files in creator install(TARGETS controls RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/examples/qt3d/controls/main.cpp b/examples/qt3d/controls/main.cpp index b5e448538..e1a009bd2 100644 --- a/examples/qt3d/controls/main.cpp +++ b/examples/qt3d/controls/main.cpp @@ -55,6 +55,7 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); + QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi); QQuickView view; view.resize(520, 500); diff --git a/examples/qt3d/controls/main.qml b/examples/qt3d/controls/main.qml index 5d1f9c02c..a734a1385 100644 --- a/examples/qt3d/controls/main.qml +++ b/examples/qt3d/controls/main.qml @@ -50,7 +50,7 @@ import QtQuick 2.0 import QtQuick.Scene3D 2.0 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.0 import QtQuick.Layouts 1.2 Item { @@ -86,8 +86,8 @@ Item { Slider { id: color_r Layout.fillWidth: true - minimumValue: 0 - maximumValue: 255 + from: 0 + to: 255 value: 128 } } @@ -96,8 +96,8 @@ Item { Slider { id: color_g Layout.fillWidth: true - minimumValue: 0 - maximumValue: 255 + from: 0 + to: 255 value: 195 } } @@ -106,8 +106,8 @@ Item { Slider { id: color_b Layout.fillWidth: true - minimumValue: 0 - maximumValue: 255 + from: 0 + to: 255 value: 66 } } @@ -115,8 +115,8 @@ Item { Slider { id: shining Layout.fillWidth: true - minimumValue: 30 - maximumValue: 90 + from: 30 + to: 90 value: 50 } } @@ -137,8 +137,8 @@ Item { Slider { id: rotation_x Layout.fillWidth: true - minimumValue: -45 - maximumValue: 45 + from: -45 + to: 45 value: rotationValue } } @@ -147,8 +147,8 @@ Item { Slider { id: rotation_y Layout.fillWidth: true - minimumValue: -45 - maximumValue: 45 + from: -45 + to: 45 value: rotationValue } } @@ -157,8 +157,8 @@ Item { Slider { id: rotation_z Layout.fillWidth: true - minimumValue: -45 - maximumValue: 45 + from: -45 + to: 45 value: rotationValue } } @@ -182,8 +182,8 @@ Item { Slider { id: viewCenter_z Layout.fillWidth: true - minimumValue: 4 - maximumValue: 12 + from: 4 + to: 12 value: 7.5 onValueChanged: watch.setPositionZ(value) } diff --git a/examples/qt3d/controlsunderlay/main.cpp b/examples/qt3d/controlsunderlay/main.cpp index cb3928a51..f88426296 100644 --- a/examples/qt3d/controlsunderlay/main.cpp +++ b/examples/qt3d/controlsunderlay/main.cpp @@ -59,6 +59,7 @@ int main(int argc, char **argv) QGuiApplication app(argc, argv); + QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi); QQuickView view; view.resize(520, 500); diff --git a/examples/qt3d/controlsunderlay/main.qml b/examples/qt3d/controlsunderlay/main.qml index 8e3e996b2..c05f3c188 100644 --- a/examples/qt3d/controlsunderlay/main.qml +++ b/examples/qt3d/controlsunderlay/main.qml @@ -50,7 +50,7 @@ import QtQuick 2.14 import QtQuick.Scene3D 2.14 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.0 import QtQuick.Layouts 1.2 Item { @@ -74,8 +74,8 @@ Item { Slider { id: color_r Layout.fillWidth: true - minimumValue: 0 - maximumValue: 255 + from: 0 + to: 255 value: 128 } } @@ -84,8 +84,8 @@ Item { Slider { id: color_g Layout.fillWidth: true - minimumValue: 0 - maximumValue: 255 + from: 0 + to: 255 value: 195 } } @@ -94,8 +94,8 @@ Item { Slider { id: color_b Layout.fillWidth: true - minimumValue: 0 - maximumValue: 255 + from: 0 + to: 255 value: 66 } } @@ -103,8 +103,8 @@ Item { Slider { id: shining Layout.fillWidth: true - minimumValue: 30 - maximumValue: 90 + from: 30 + to: 90 value: 50 } } @@ -125,8 +125,8 @@ Item { Slider { id: rotation_x Layout.fillWidth: true - minimumValue: -45 - maximumValue: 45 + from: -45 + to: 45 value: rotationValue } } @@ -135,8 +135,8 @@ Item { Slider { id: rotation_y Layout.fillWidth: true - minimumValue: -45 - maximumValue: 45 + from: -45 + to: 45 value: rotationValue } } @@ -145,8 +145,8 @@ Item { Slider { id: rotation_z Layout.fillWidth: true - minimumValue: -45 - maximumValue: 45 + from: -45 + to: 45 value: rotationValue } } @@ -170,8 +170,8 @@ Item { Slider { id: viewCenter_z Layout.fillWidth: true - minimumValue: 4 - maximumValue: 12 + from: 4 + to: 12 value: 7.5 onValueChanged: watch.setPositionZ(value) } diff --git a/examples/qt3d/planets-qml/PlanetsMain.qml b/examples/qt3d/planets-qml/PlanetsMain.qml index c9d826784..91cbfd4bd 100644 --- a/examples/qt3d/planets-qml/PlanetsMain.qml +++ b/examples/qt3d/planets-qml/PlanetsMain.qml @@ -82,18 +82,18 @@ Item { break case "setRotationSpeed": rotationSpeedSlider.forceActiveFocus() - rotationSpeedSlider.value = rotationSpeedSlider.minimumValue + - ((rotationSpeedSlider.maximumValue - rotationSpeedSlider.minimumValue) * value) + rotationSpeedSlider.value = rotationSpeedSlider.from + + ((rotationSpeedSlider.to - rotationSpeedSlider.from) * value) break case "setViewingDistance": viewingDistanceSlider.forceActiveFocus() - viewingDistanceSlider.value = viewingDistanceSlider.minimumValue + - ((viewingDistanceSlider.maximumValue - viewingDistanceSlider.minimumValue) * value) + viewingDistanceSlider.value = viewingDistanceSlider.from + + ((viewingDistanceSlider.to - viewingDistanceSlider.from) * value) break case "setPlanetSize": planetSizeSlider.forceActiveFocus() - planetSizeSlider.value = planetSizeSlider.minimumValue + - ((planetSizeSlider.maximumValue - planetSizeSlider.minimumValue) * value) + planetSizeSlider.value = planetSizeSlider.from + + ((planetSizeSlider.to - planetSizeSlider.from) * value) break } } @@ -349,8 +349,8 @@ Item { anchors.verticalCenter: parent.verticalCenter width: sliderLength value: 0.2 - minimumValue: 0 - maximumValue: 1 + from: 0 + to: 1 onValueChanged: solarsystem.changeSpeed(value) focus: Qt.platform.os === "tvos" ? true : false @@ -376,7 +376,7 @@ Item { } onPannedHorizontally: { - var step = (maximumValue - minimumValue) / 30 + var step = (to - from) / 30 if (p > 0) { value += step @@ -415,8 +415,8 @@ Item { orientation: Qt.Vertical height: sliderLength value: 1 - minimumValue: 1 - maximumValue: 2 + from: 1 + to: 2 //! [2] onValueChanged: solarsystem.changeCameraDistance(value) //! [2] @@ -442,7 +442,7 @@ Item { } onPannedVertically: { - var step = (maximumValue - minimumValue) / 30 + var step = (to - from) / 30 if (p > 0) { value += step @@ -498,8 +498,8 @@ Item { anchors.verticalCenter: parent.verticalCenter width: sliderLength value: 1200 - minimumValue: 1 - maximumValue: 2000 + from: 1 + to: 2000 onValueChanged: solarsystem.changeScale(value, false) property bool panningEnabled: false @@ -523,7 +523,7 @@ Item { } onPannedHorizontally: { - var step = (maximumValue - minimumValue) / 30 + var step = (to - from) / 30 if (p > 0) { value += step diff --git a/examples/qt3d/planets-qml/SolarSystem.qml b/examples/qt3d/planets-qml/SolarSystem.qml index 2b56237f5..e5d8c957e 100644 --- a/examples/qt3d/planets-qml/SolarSystem.qml +++ b/examples/qt3d/planets-qml/SolarSystem.qml @@ -227,7 +227,7 @@ Entity { target: sceneRoot properties: "xLookAtOffset, yLookAtOffset, zLookAtOffset" to: 0 - easing.type: Easing.InOutQuint +// easing.type: Easing.InOutQuint duration: 1250 } @@ -236,14 +236,14 @@ Entity { target: sceneRoot properties: "xCameraOffset, yCameraOffset, zCameraOffset" to: 0 - easing.type: Easing.InOutQuint +// easing.type: Easing.InOutQuint duration: 2500 } //! [0] QQ2.Behavior on cameraNear { QQ2.PropertyAnimation { - easing.type: Easing.InOutQuint +// easing.type: Easing.InOutQuint duration: 2500 } } diff --git a/examples/qt3d/planets-qml/StyledSlider.qml b/examples/qt3d/planets-qml/StyledSlider.qml index 6694d136e..69b0cc218 100644 --- a/examples/qt3d/planets-qml/StyledSlider.qml +++ b/examples/qt3d/planets-qml/StyledSlider.qml @@ -49,42 +49,9 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.3 +import QtQuick.Controls 2.0 Slider { id: styledSlider - - style: SliderStyle { - groove: Rectangle { - implicitWidth: 200 - implicitHeight: 5 - color: "#5d5b59" - Rectangle { - anchors.verticalCenter: parent.verticalCenter - width: styleData.handlePosition - height: 5 - gradient: Gradient { - GradientStop { position: 0.0; color: "#80c342" } - GradientStop { position: 1.0; color: "#328930" } - } - } - } - handle: Rectangle { - Rectangle { - anchors.centerIn: parent - color: "#aeadac" - border.color: "#1e1b18" - border.width: 1 - implicitWidth: 8 - implicitHeight: 20 - } - anchors.centerIn: parent - color: "transparent" - border.width: 0 - implicitWidth: 50 - implicitHeight: 50 - } - } } diff --git a/examples/qt3d/planets-qml/main.cpp b/examples/qt3d/planets-qml/main.cpp index b044a22b2..07bfad5a2 100644 --- a/examples/qt3d/planets-qml/main.cpp +++ b/examples/qt3d/planets-qml/main.cpp @@ -69,6 +69,7 @@ int main(int argc, char **argv) NetworkController networkController; + QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi); QQuickView view; view.setFormat(format); view.rootContext()->setContextProperty("networkController", &networkController); diff --git a/examples/qt3d/scene3dview/main.cpp b/examples/qt3d/scene3dview/main.cpp index 8886263f4..e04bbc050 100644 --- a/examples/qt3d/scene3dview/main.cpp +++ b/examples/qt3d/scene3dview/main.cpp @@ -55,6 +55,7 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); + QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi); QQuickView view; view.resize(500, 500); diff --git a/examples/qt3d/simplecustommaterial/main.cpp b/examples/qt3d/simplecustommaterial/main.cpp index da299e913..8f9a6e2ed 100644 --- a/examples/qt3d/simplecustommaterial/main.cpp +++ b/examples/qt3d/simplecustommaterial/main.cpp @@ -74,6 +74,7 @@ int main(int argc, char **argv) QGuiApplication app(argc, argv); setSurfaceFormat(); + QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi); QQuickView view; view.resize(1024, 1024); diff --git a/examples/qt3d/wave/Wave.qml b/examples/qt3d/wave/Wave.qml index 428ca8e56..8614fee5b 100644 --- a/examples/qt3d/wave/Wave.qml +++ b/examples/qt3d/wave/Wave.qml @@ -48,9 +48,9 @@ ** ****************************************************************************/ -import Qt3D.Core 2.0 -import Qt3D.Render 2.0 -import Qt3D.Extras 2.0 +import Qt3D.Core 2.16 +import Qt3D.Render 2.16 +import Qt3D.Extras 2.15 Entity { id: root @@ -71,7 +71,7 @@ Entity { Transform { id: transform translation: Qt.vector3d(root.x, root.y, root.z); - rotation: fromEulerAngles(root.theta, root.phi) + rotation: fromEulerAngles(root.theta, root.phi, 0) scale: root.scale } @@ -81,7 +81,7 @@ Entity { diffuse: Qt.rgba( root.intensity, root.intensity, root.intensity, 1.0 ) // Set how bright the wave is } - GeometryView { + GeometryRenderer { id: mesh view: PlaneMesh { width: 25.0 |