summaryrefslogtreecommitdiffstats
path: root/examples/remoteobjects/qmlmodelviewclient/main.qml
diff options
context:
space:
mode:
authorBrett Stottlemyer <bstottle@ford.com>2017-03-20 14:48:46 -0400
committerBrett Stottlemyer <bstottle@ford.com>2017-03-22 14:51:20 +0000
commit03e2a2073b5dad4c9a76c4c8281f9aec6190e9a4 (patch)
tree680dd8a190a7c0d621028d941f8a310fd3a652e7 /examples/remoteobjects/qmlmodelviewclient/main.qml
parent90261c984e9f45fb3c54604900d26099b9d56304 (diff)
Adjust examples to follow Qt conventions
Adjust examples' file and directory naming to be consistent with Qt-wide conventions. Task-number: QTBUG-59229 Change-Id: I5c4eb66e91a12590600446a35b2656361561e2a3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'examples/remoteobjects/qmlmodelviewclient/main.qml')
-rw-r--r--examples/remoteobjects/qmlmodelviewclient/main.qml95
1 files changed, 95 insertions, 0 deletions
diff --git a/examples/remoteobjects/qmlmodelviewclient/main.qml b/examples/remoteobjects/qmlmodelviewclient/main.qml
new file mode 100644
index 0000000..ca7c943
--- /dev/null
+++ b/examples/remoteobjects/qmlmodelviewclient/main.qml
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Ford Motor Company
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtRemoteObjects module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Window 2.2
+
+Window {
+ visible: true
+ width: 800
+ height: 600
+ Text {
+ id: dummy
+ }
+
+ ListView {
+ id: view
+ anchors.fill: parent
+ focus: true
+
+ currentIndex: 10
+
+ model: remoteModel
+
+ snapMode: ListView.SnapToItem
+ highlightFollowsCurrentItem: true
+ highlightMoveDuration: 0
+
+ delegate: Rectangle {
+ width: view.width
+ height: dummy.font.pixelSize * 2
+ color: _color
+ Text {
+ anchors.centerIn: parent
+ text: _text
+ }
+ }
+ Keys.onPressed: {
+ switch (event.key) {
+ case Qt.Key_Home:
+ view.currentIndex = 0;
+ break;
+ case Qt.Key_PageUp:
+ currentIndex -= Math.random() * 300;
+ if (currentIndex < 0)
+ currentIndex = 0;
+ break;
+ case Qt.Key_PageDown:
+ currentIndex += Math.random() * 300;
+ if (currentIndex >= count)
+ currentIndex = count - 1;
+ break;
+ case Qt.Key_End:
+ currentIndex = count - 1;
+ break;
+ }
+ }
+ }
+}