From e968635b850634af724c5f9dad85c8dd241fbdf5 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 13 Jul 2018 13:40:23 -0500 Subject: Add benchmark for bindings referencing QML singleton Change-Id: If91b39f75e2215a4af125a226fa4b82086f3bd46 Reviewed-by: Simon Hausmann --- benchmarks/auto/bindings/compositesingleton.qml | 15 +++++++++++++++ shared/Globals.qml | 10 ++++++++++ shared/qmldir | 1 + 3 files changed, 26 insertions(+) create mode 100644 benchmarks/auto/bindings/compositesingleton.qml create mode 100644 shared/Globals.qml create mode 100644 shared/qmldir 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 -- cgit v1.2.3