summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authordpope <daniel.pope@nokia.com>2012-03-23 11:33:28 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-28 00:00:38 +0200
commit14d7e5d4aa6f5e183236f4ac2bf7bd622fb6b6ea (patch)
treebe91f4f29e0294571c10e3c19eda81da99eb51f0 /demos
parentb79e163fe021935d9690df551092e10dae5d70f5 (diff)
Porting Qt4 flickr3d demo to Qt5.
Still requires full network textue support from Qt4 to operate correction. Change-Id: I731d495d93792fb898500beea019e7329bf7c7e3 Reviewed-by: Danny Pope <daniel.pope@nokia.com>
Diffstat (limited to 'demos')
-rw-r--r--demos/quick3d/flickr3d/flickr3d.pro6
-rw-r--r--demos/quick3d/flickr3d/qml/Flickr3d.qml60
-rw-r--r--demos/quick3d/flickr3d/qml/RssModel.qml67
3 files changed, 124 insertions, 9 deletions
diff --git a/demos/quick3d/flickr3d/flickr3d.pro b/demos/quick3d/flickr3d/flickr3d.pro
index 5c929167f..e4ee18140 100644
--- a/demos/quick3d/flickr3d/flickr3d.pro
+++ b/demos/quick3d/flickr3d/flickr3d.pro
@@ -8,7 +8,8 @@ ICON_FILE = ../icon.png
QML_FILES = \
qml/Flickr3d.qml \
- qml/desktop.qml
+ qml/desktop.qml \
+ qml/RssModel.qml
QML_INFRA_FILES = \
$$QML_FILES \
@@ -18,7 +19,8 @@ QML_INFRA_FILES = \
qml/default_sky_up.png \
qml/default_sky_east.png \
qml/default_sky_south.png \
- qml/default_sky_west.png
+ qml/default_sky_west.png \
+
CATEGORY = demos
include(../../../pkg.pri)
diff --git a/demos/quick3d/flickr3d/qml/Flickr3d.qml b/demos/quick3d/flickr3d/qml/Flickr3d.qml
index f1822f7a9..4921fe029 100644
--- a/demos/quick3d/flickr3d/qml/Flickr3d.qml
+++ b/demos/quick3d/flickr3d/qml/Flickr3d.qml
@@ -44,8 +44,12 @@ import Qt3D 1.0
import Qt3D.Shapes 1.0
Viewport {
- width: parent.width
- height: parent.height
+ width: 1024
+ height: 768
+
+ MouseArea {
+ anchors.fill: parent
+ }
camera: Camera {
id: cam
@@ -60,15 +64,57 @@ Viewport {
loops: Animation.Infinite
}
+ RssModel { id: rssModel }
+
+ Item3D {
+ transform: [
+ Rotation3D { axis: Qt.vector3d(1, 0, 0); angle: 90 },
+ Translation3D { translate: Qt.vector3d(0, 1, 0) }
+ ]
+
+ Cylinder {
+ levelOfDetail: 1
+ length: 2.0
+ radius: 2.8
+ effect: Effect {
+ color: "#ccccdd"
+ }
+ }
+ }
+
Skybox {
source: "./"
}
- Cube {
- effect: Effect {
- color: "#aaca00"
- texture: "qtlogo.png"
- decal: true
+ Component {
+ id: octoDisplayDelegate
+ Item3D {
+ transform: [
+ Translation3D { translate: Qt.vector3d(0, 0, 2.6) },
+ // index is a special variable that comes from model instancing
+ Rotation3D { axis: Qt.vector3d(0, 1, 0); angle: (360 / 16) * (index * 2 + 1) }
+ ]
+ Item3D {
+ enabled: index > -1 && index < 9
+ transform: [
+ Rotation3D { axis: Qt.vector3d(1, 0, 0); angle: 90 }
+ ]
+ Quad {
+ effect: Effect {
+ //The current texture downloading does not operate as network URLs are unsupported
+ //in qt 5.
+ //texture: model.imagePath
+ texture: "qtlogo.png"
+ blending: true
+ }
+ }
+ }
}
}
+
+ Repeater {
+ delegate: octoDisplayDelegate
+ model: rssModel
+ }
}
+
diff --git a/demos/quick3d/flickr3d/qml/RssModel.qml b/demos/quick3d/flickr3d/qml/RssModel.qml
new file mode 100644
index 000000000..b5b9d78b9
--- /dev/null
+++ b/demos/quick3d/flickr3d/qml/RssModel.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the Qt3D examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 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 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+XmlListModel {
+ property string tags : ""
+
+ function commasep(x)
+ {
+ return x.replace(' ',',');
+ }
+
+ source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+commasep(tags)+"&" : "")+"format=rss2"
+ query: "/rss/channel/item"
+ namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";"
+
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "imagePath"; query: "media:thumbnail/@url/string()" }
+ XmlRole { name: "url"; query: "media:content/@url/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
+ XmlRole { name: "tags"; query: "media:category/string()" }
+ XmlRole { name: "photoWidth"; query: "media:content/@width/string()" }
+ XmlRole { name: "photoHeight"; query: "media:content/@height/string()" }
+ XmlRole { name: "photoType"; query: "media:content/@type/string()" }
+ XmlRole { name: "photoAuthor"; query: "author/string()" }
+ XmlRole { name: "photoDate"; query: "pubDate/string()" }
+}