summaryrefslogtreecommitdiff
path: root/share/qtcreator/qml
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2017-05-03 17:59:38 +0200
committerTim Jenssen <tim.jenssen@qt.io>2017-05-15 15:50:48 +0000
commit567a99c5aa8c2e3b658da338daa2b59d590ac438 (patch)
tree77d820065efc036d632e671ad3de9e084249f10d /share/qtcreator/qml
parent89f02cba2ca65f84d99b0b35f555da024f3e2234 (diff)
downloadqt-creator-567a99c5aa8c2e3b658da338daa2b59d590ac438.tar.gz
QmlDesigner: Replace SwipeView with StackLayout
In the designer we replace a SwipeView with a StackLayout. Form the perspektive of the designer they are the same and StackLayout is easier to handle. Change-Id: I308ec209024e22db9f56e363e27588a40283603c Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'share/qtcreator/qml')
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/SwipeView.qml34
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp9
-rw-r--r--share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc1
3 files changed, 43 insertions, 1 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/SwipeView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/SwipeView.qml
new file mode 100644
index 0000000000..5fc972d23d
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/SwipeView.qml
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Layouts 1.3
+
+StackLayout {
+ id: root
+ //property alias index: root.currentIndex
+ property bool interactive: true
+ default property alias contentData: root.data
+}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
index 8f0c8b19b4..857a016a5e 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
@@ -613,7 +613,14 @@ QObject *ObjectNodeInstance::createPrimitive(const QString &typeName, int majorN
|| typeName == "QtQuick.Controls/ToolTip")
polishTypeName = "QtQuick/Item";
- QObject *object = QmlPrivateGate::createPrimitive(polishTypeName, majorNumber, minorNumber, context);
+ const QHash<QString, QString> mockHash = {{"QtQuick.Controls/SwipeView","qrc:/qtquickplugin/mockfiles/SwipeView.qml"}};
+
+ QObject *object = nullptr;
+
+ if (mockHash.contains(typeName))
+ object = QmlPrivateGate::createComponent(mockHash.value(typeName), context);
+ else
+ object = QmlPrivateGate::createPrimitive(polishTypeName, majorNumber, minorNumber, context);
/* Let's try to create the primitive from source, since with incomplete meta info this might be a pure
* QML type. This is the case for example if a C++ type is mocked up with a QML file.
diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc b/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc
index e7606e21d8..4e02e48869 100644
--- a/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc
+++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc
@@ -4,6 +4,7 @@
<file>html/welcome.html</file>
<file>images/webkit.png</file>
<file>mockfiles/Window.qml</file>
+ <file>mockfiles/SwipeView.qml</file>
<file>mockfiles/GenericBackend.qml</file>
</qresource>
</RCC>