aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <mbrasser@ford.com>2018-07-13 13:40:23 -0500
committerMichael Brasser <michael.brasser@live.com>2018-07-13 19:04:32 +0000
commite968635b850634af724c5f9dad85c8dd241fbdf5 (patch)
treeda9968dbb8e651801e5df82f43afdb62bee6233b
parentbaa2a81ec217c22a7996787c94aa47cafc249202 (diff)
Add benchmark for bindings referencing QML singleton
Change-Id: If91b39f75e2215a4af125a226fa4b82086f3bd46 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--benchmarks/auto/bindings/compositesingleton.qml15
-rw-r--r--shared/Globals.qml10
-rw-r--r--shared/qmldir1
3 files changed, 26 insertions, 0 deletions
diff --git a/benchmarks/auto/bindings/compositesingleton.qml b/benchmarks/auto/bindings/compositesingleton.qml
new file mode 100644
index 0000000..aad80cc
--- /dev/null
+++ b/benchmarks/auto/bindings/compositesingleton.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import "../../../shared"
+
+// Tests the creation of Items bound to a QML-defined singleton
+CreationBenchmark {
+ id: root;
+ count: 50;
+ staticCount: 2500;
+ delegate: Item {
+ x: Globals.realProp
+ y: Globals.intProp
+ smooth: Globals.boolProp
+ }
+}
diff --git a/shared/Globals.qml b/shared/Globals.qml
new file mode 100644
index 0000000..6531a1e
--- /dev/null
+++ b/shared/Globals.qml
@@ -0,0 +1,10 @@
+pragma Singleton
+import QtQuick 2.0
+
+QtObject {
+ readonly property string stringProp: "stringValue"
+ readonly property int intProp: 10
+ readonly property real realProp: 4.5
+ readonly property color colorProp: "green"
+ readonly property bool boolProp: true
+}
diff --git a/shared/qmldir b/shared/qmldir
new file mode 100644
index 0000000..45b3b68
--- /dev/null
+++ b/shared/qmldir
@@ -0,0 +1 @@
+singleton Globals Globals.qml