summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@theqtcompany.com>2015-09-01 11:19:18 +0300
committerTomi Korpipää <tomi.korpipaa@theqtcompany.com>2015-09-01 08:21:12 +0000
commit5ca38e5d378621d5cbbe82191227633af2962a39 (patch)
tree13b691d790a11565ea6aa2a32f0e72286c31fadc /examples
parentf582ca6b0d221b7a080d7ea7551bdd840b906bd2 (diff)
Removed unnecessary Enterprise version of example
Change-Id: If8152a586fc0e0c704f6494a80a33aa5d73f455a Task-number: QTBUG-46917 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/canvas3d/canvas3d/jsonmodels/doc/src/jsonmodels.qdoc6
-rw-r--r--examples/canvas3d/canvas3d/jsonmodels/main.cpp6
-rw-r--r--examples/canvas3d/canvas3d/jsonmodels/qml.qrc1
-rw-r--r--examples/canvas3d/canvas3d/jsonmodels/qml/jsonmodels/jsonmodels.qml142
-rw-r--r--examples/canvas3d/canvas3d/jsonmodels/qml/jsonmodels/jsonmodelsbasic.qml313
5 files changed, 51 insertions, 417 deletions
diff --git a/examples/canvas3d/canvas3d/jsonmodels/doc/src/jsonmodels.qdoc b/examples/canvas3d/canvas3d/jsonmodels/doc/src/jsonmodels.qdoc
index 86fddcf..7b8b841 100644
--- a/examples/canvas3d/canvas3d/jsonmodels/doc/src/jsonmodels.qdoc
+++ b/examples/canvas3d/canvas3d/jsonmodels/doc/src/jsonmodels.qdoc
@@ -45,12 +45,6 @@
one JSON model and more than one texture. It also implements simple
mouse input handling to allow rotating the scene and zooming into it.
- The example optionally incorporates some Qt Quick Enterprise Controls,
- which you can switch on by commenting out the \c{#define NO_ENTERPRISE}
- line in \l{canvas3d/jsonmodels/main.cpp}{main.cpp}. The controls are used to toggle
- some optional animations and draw options, as well as displaying camera
- rotations and distance.
-
\image jsonmodels-example.png
\section1 JSON Model Loader
diff --git a/examples/canvas3d/canvas3d/jsonmodels/main.cpp b/examples/canvas3d/canvas3d/jsonmodels/main.cpp
index ee3caa9..c7c7961 100644
--- a/examples/canvas3d/canvas3d/jsonmodels/main.cpp
+++ b/examples/canvas3d/canvas3d/jsonmodels/main.cpp
@@ -34,8 +34,6 @@
**
****************************************************************************/
-#define NO_ENTERPRISE
-
#include <QGuiApplication>
#include <QQmlApplicationEngine>
@@ -44,11 +42,7 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
-#ifdef NO_ENTERPRISE
- engine.load(QUrl(QStringLiteral("qrc:/jsonmodelsbasic.qml")));
-#else
engine.load(QUrl(QStringLiteral("qrc:/jsonmodels.qml")));
-#endif
return app.exec();
}
diff --git a/examples/canvas3d/canvas3d/jsonmodels/qml.qrc b/examples/canvas3d/canvas3d/jsonmodels/qml.qrc
index ec83f78..e8eeea7 100644
--- a/examples/canvas3d/canvas3d/jsonmodels/qml.qrc
+++ b/examples/canvas3d/canvas3d/jsonmodels/qml.qrc
@@ -8,7 +8,6 @@
<file alias="gold.json">qml/jsonmodels/gold.json</file>
<file alias="jsonmodels.js">qml/jsonmodels/jsonmodels.js</file>
<file alias="jsonmodels.qml">qml/jsonmodels/jsonmodels.qml</file>
- <file alias="jsonmodelsbasic.qml">qml/jsonmodels/jsonmodelsbasic.qml</file>
<file alias="pallet.jpg">qml/jsonmodels/pallet.jpg</file>
<file alias="pallet.json">qml/jsonmodels/pallet.json</file>
<file alias="rock.jpg">qml/jsonmodels/rock.jpg</file>
diff --git a/examples/canvas3d/canvas3d/jsonmodels/qml/jsonmodels/jsonmodels.qml b/examples/canvas3d/canvas3d/jsonmodels/qml/jsonmodels/jsonmodels.qml
index 2cdeeb9..528bef6 100644
--- a/examples/canvas3d/canvas3d/jsonmodels/qml/jsonmodels/jsonmodels.qml
+++ b/examples/canvas3d/canvas3d/jsonmodels/qml/jsonmodels/jsonmodels.qml
@@ -37,8 +37,7 @@
import QtQuick 2.2
import QtQuick.Window 2.1
import QtCanvas3D 1.0
-import QtQuick.Enterprise.Controls 1.1
-import QtQuick.Enterprise.Controls.Styles 1.1
+import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import "jsonmodels.js" as GLCode
@@ -47,12 +46,47 @@ Window {
visible: true
width: 1200
height: 900
+ color: "#e6e6e6"
//! [3]
property int previousY: 0
property int previousX: 0
//! [3]
+ Rectangle {
+ id: valuePanel
+ width: 150
+ height: 100
+ anchors.left: parent.left
+ anchors.top: parent.top
+ opacity: 0.3
+ border.color: "black"
+ border.width: 2
+ radius: 5
+ z: 1
+ }
+ ColumnLayout {
+ width: valuePanel.width
+ height: valuePanel.height
+ x: 10
+ z: 2
+ Label {
+ font.pixelSize: 20
+ text: "x angle: " + angle
+ readonly property int angle: canvas3d.xRot
+ }
+ Label {
+ font.pixelSize: 20
+ text: "y angle: " + angle
+ readonly property int angle: canvas3d.yRot
+ }
+ Label {
+ font.pixelSize: 20
+ text: "distance: " + distance
+ readonly property int distance: canvas3d.distance * 10
+ }
+ }
+
ColumnLayout {
anchors.fill: parent
RowLayout {
@@ -60,7 +94,6 @@ Window {
Layout.fillWidth: true
Canvas3D {
id: canvas3d
-
Layout.fillHeight: true
Layout.fillWidth: true
//! [1]
@@ -133,106 +166,34 @@ Window {
//! [4]
}
}
-
- ColumnLayout {
- CircularGauge {
- Layout.fillHeight: true
- minimumValue: -180
- maximumValue: 180
- value: canvas3d.xRot
- style: CircularGaugeStyle {
- labelStepSize: 30
- tickmarkStepSize: 15
- }
- Rectangle {
- anchors.fill: parent
- color: "#00000000"
- z: parent.z - 1
- Text {
- font.pixelSize: 20
- text: "x angle: " + angle
- color: "darkgray"
- horizontalAlignment: Text.AlignHCenter
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.top: parent.verticalCenter
- anchors.topMargin: parent.height / 8
- readonly property int angle: canvas3d.xRot
- }
- }
- }
- CircularGauge {
- Layout.fillHeight: true
- minimumValue: -90
- maximumValue: 90
- value: canvas3d.yRot
- style: CircularGaugeStyle {
- labelStepSize: 30
- tickmarkStepSize: 15
- }
- Rectangle {
- anchors.fill: parent
- color: "#00000000"
- z: parent.z - 1
- Text {
- font.pixelSize: 20
- text: "y angle: " + angle
- color: "darkgray"
- horizontalAlignment: Text.AlignHCenter
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.top: parent.verticalCenter
- anchors.topMargin: parent.height / 8
- readonly property int angle: canvas3d.yRot
- }
- }
- }
- CircularGauge {
- Layout.fillHeight: true
- minimumValue: 0
- maximumValue: 100
- value: canvas3d.distance * 10
- style: CircularGaugeStyle {
- labelStepSize: 20
- tickmarkStepSize: 10
- }
- Rectangle {
- anchors.fill: parent
- color: "#00000000"
- z: parent.z - 1
- Text {
- font.pixelSize: 20
- text: "distance: " + distance
- color: "darkgray"
- horizontalAlignment: Text.AlignHCenter
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.top: parent.verticalCenter
- anchors.topMargin: parent.height / 8
- readonly property int distance: canvas3d.distance * 10
- }
- }
- }
- }
}
RowLayout {
Layout.fillWidth: true
- ToggleButton {
+ Button {
id: lightButton
+ Layout.fillWidth: true
text: "Animate Light"
+ checkable: true
onCheckedChanged: canvas3d.animatingLight = checked
}
- ToggleButton {
+ Button {
id: cameraButton
+ Layout.fillWidth: true
text: "Animate Camera"
+ checkable: true
onCheckedChanged: canvas3d.animatingCamera = checked
}
- ToggleButton {
+ Button {
id: drawButton
+ Layout.fillWidth: true
text: "Wireframe"
+ checkable: true
onCheckedChanged: canvas3d.drawWireframe = checked
}
- DelayButton {
+ Button {
+ Layout.fillWidth: true
text: "Reset"
- delay: 1000
- onCheckedChanged: {
+ onClicked: {
canvas3d.xRot = 0.0
canvas3d.yRot = 45.0
canvas3d.distance = 2.0
@@ -243,13 +204,12 @@ Window {
lightButton.checked = false
cameraButton.checked = false
drawButton.checked = false
- checked = false
}
}
- DelayButton {
+ Button {
+ Layout.fillWidth: true
text: "Quit"
- delay: 1000
- onCheckedChanged: Qt.quit()
+ onClicked: Qt.quit()
}
}
}
diff --git a/examples/canvas3d/canvas3d/jsonmodels/qml/jsonmodels/jsonmodelsbasic.qml b/examples/canvas3d/canvas3d/jsonmodels/qml/jsonmodels/jsonmodelsbasic.qml
deleted file mode 100644
index b182c53..0000000
--- a/examples/canvas3d/canvas3d/jsonmodels/qml/jsonmodels/jsonmodelsbasic.qml
+++ /dev/null
@@ -1,313 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.2
-import QtQuick.Window 2.1
-import QtCanvas3D 1.0
-import QtQuick.Controls 1.1
-import QtQuick.Layouts 1.1
-
-import "jsonmodels.js" as GLCode
-
-Window {
- visible: true
- width: 1200
- height: 900
- color: "#e6e6e6"
-
- property int previousY: 0
- property int previousX: 0
-
- Rectangle {
- id: valuePanel
- width: 150
- height: 100
- anchors.left: parent.left
- anchors.top: parent.top
- opacity: 0.3
- border.color: "black"
- border.width: 2
- radius: 5
- z: 1
- }
- ColumnLayout {
- width: valuePanel.width
- height: valuePanel.height
- x: 10
- z: 2
- Label {
- font.pixelSize: 20
- text: "x angle: " + angle
- readonly property int angle: canvas3d.xRot
- }
- Label {
- font.pixelSize: 20
- text: "y angle: " + angle
- readonly property int angle: canvas3d.yRot
- }
- Label {
- font.pixelSize: 20
- text: "distance: " + distance
- readonly property int distance: canvas3d.distance * 10
- }
- }
-
- ColumnLayout {
- anchors.fill: parent
- RowLayout {
- Layout.fillHeight: true
- Layout.fillWidth: true
- Canvas3D {
- id: canvas3d
- Layout.fillHeight: true
- Layout.fillWidth: true
- property double xRot: 0.0
- property double yRot: 45.0
- property double distance: 2.0
- property double itemSize: 1.0
- property double lightX: 0.0
- property double lightY: 45.0
- property double lightDistance: 2.0
- property bool animatingLight: false
- property bool animatingCamera: false
- property bool drawWireframe: false
-
- onInitializeGL: {
- GLCode.initializeGL(canvas3d);
- }
-
- onPaintGL: {
- GLCode.paintGL(canvas3d);
- }
-
- onResizeGL: {
- GLCode.resizeGL(canvas3d);
- }
-
- MouseArea {
- anchors.fill: parent
- onMouseXChanged: {
- if (previousY !== 0)
- canvas3d.yRot += mouseY - previousY
- previousY = mouseY
- if (canvas3d.yRot > 90)
- canvas3d.yRot = 90
- if (canvas3d.yRot < -90)
- canvas3d.yRot = -90
- }
- onMouseYChanged: {
- if (previousX !== 0)
- canvas3d.xRot += mouseX - previousX
- previousX = mouseX
- if (canvas3d.xRot > 180)
- canvas3d.xRot -= 360
- if (canvas3d.xRot < -180)
- canvas3d.xRot += 360
- }
- onReleased: {
- previousX = 0
- previousY = 0
- }
- onWheel: {
- canvas3d.distance -= wheel.angleDelta.y / 1000.0
- if (canvas3d.distance < 0.5)
- canvas3d.distance = 0.5
- if (canvas3d.distance > 10)
- canvas3d.distance = 10
- }
- }
- }
- }
- RowLayout {
- Layout.fillWidth: true
- Button {
- id: lightButton
- Layout.fillWidth: true
- text: "Animate Light"
- checkable: true
- onCheckedChanged: canvas3d.animatingLight = checked
- }
- Button {
- id: cameraButton
- Layout.fillWidth: true
- text: "Animate Camera"
- checkable: true
- onCheckedChanged: canvas3d.animatingCamera = checked
- }
- Button {
- id: drawButton
- Layout.fillWidth: true
- text: "Wireframe"
- checkable: true
- onCheckedChanged: canvas3d.drawWireframe = checked
- }
- Button {
- Layout.fillWidth: true
- text: "Reset"
- onClicked: {
- canvas3d.xRot = 0.0
- canvas3d.yRot = 45.0
- canvas3d.distance = 2.0
- canvas3d.itemSize = 1.0
- canvas3d.lightX = 0.0
- canvas3d.lightY = 45.0
- canvas3d.lightDistance = 2.0
- lightButton.checked = false
- cameraButton.checked = false
- drawButton.checked = false
- }
- }
- Button {
- Layout.fillWidth: true
- text: "Quit"
- onClicked: Qt.quit()
- }
- }
- }
-
- SequentialAnimation {
- loops: Animation.Infinite
- running: canvas3d.animatingLight
- NumberAnimation {
- target: canvas3d
- property: "lightX"
- from: 0.0
- to: 360.0
- duration: 5000
- }
- }
-
- SequentialAnimation {
- loops: Animation.Infinite
- running: canvas3d.animatingLight
- NumberAnimation {
- target: canvas3d
- property: "lightY"
- from: 0.0
- to: 90.0
- duration: 10000
- }
- NumberAnimation {
- target: canvas3d
- property: "lightY"
- from: 90.0
- to: 0.0
- duration: 10000
- }
- }
-
- SequentialAnimation {
- loops: Animation.Infinite
- running: canvas3d.animatingLight
- NumberAnimation {
- target: canvas3d
- property: "lightDistance"
- from: 10.0
- to: 0.5
- duration: 30000
- }
- NumberAnimation {
- target: canvas3d
- property: "lightDistance"
- from: 0.5
- to: 10.0
- duration: 30000
- }
- }
-
- SequentialAnimation {
- loops: Animation.Infinite
- running: canvas3d.animatingCamera
- NumberAnimation {
- target: canvas3d
- property: "xRot"
- from: -180.0
- to: 180.0
- duration: 5000
- easing.type: Easing.InOutSine
- }
- NumberAnimation {
- target: canvas3d
- property: "xRot"
- from: 180.0
- to: -180.0
- duration: 5000
- easing.type: Easing.InOutSine
- }
- }
-
- SequentialAnimation {
- loops: Animation.Infinite
- running: canvas3d.animatingCamera
- NumberAnimation {
- target: canvas3d
- property: "yRot"
- from: 0.0
- to: 90.0
- duration: 10000
- easing.type: Easing.InOutSine
- }
- NumberAnimation {
- target: canvas3d
- property: "yRot"
- from: 90.0
- to: 0.0
- duration: 10000
- easing.type: Easing.InOutSine
- }
- }
-
- SequentialAnimation {
- loops: Animation.Infinite
- running: canvas3d.animatingCamera
- NumberAnimation {
- target: canvas3d
- property: "distance"
- from: 10.0
- to: 0.5
- duration: 30000
- easing.type: Easing.InOutSine
- }
- NumberAnimation {
- target: canvas3d
- property: "distance"
- from: 0.5
- to: 10.0
- duration: 30000
- easing.type: Easing.InOutSine
- }
- }
-}