aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/imports/controls/Tumbler.qml12
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-custom.qml2
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc31
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-index.qdoc13
-rw-r--r--src/imports/controls/material/LICENSE_ANGULARJS.txt19
-rw-r--r--src/imports/controls/material/Tumbler.qml12
-rw-r--r--src/imports/controls/material/qt_attribution.json13
-rw-r--r--src/imports/controls/universal/Tumbler.qml11
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp2
-rw-r--r--src/quickcontrols2/qquickstyle.cpp4
-rw-r--r--src/quickcontrols2/qquicktumblerview.cpp9
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp23
-rw-r--r--src/quicktemplates2/qquickcontrol_p_p.h2
-rw-r--r--src/quicktemplates2/qquicktumbler.cpp206
-rw-r--r--src/quicktemplates2/qquicktumbler_p.h2
-rw-r--r--src/quicktemplates2/qquicktumbler_p_p.h24
-rw-r--r--tests/auto/controls/data/TumblerListView.qml12
-rw-r--r--tests/auto/controls/data/TumblerPathView.qml11
-rw-r--r--tests/auto/controls/data/tst_tumbler.qml21
-rw-r--r--tests/auto/customization/tst_customization.cpp2
-rw-r--r--tests/auto/sanity/BLACKLIST10
-rw-r--r--tests/auto/sanity/tst_sanity.cpp77
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_abstractbutton.qml16
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_busyindicator.qml14
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_button.qml15
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_checkbox.qml15
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_checkdelegate.qml16
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_combobox.qml15
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_container.qml15
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_control.qml15
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_delaybutton.qml15
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_dial.qml14
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_dialog.qml28
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_dialogbuttonbox.qml14
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_drawer.qml21
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_frame.qml17
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_groupbox.qml18
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_itemdelegate.qml15
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_label.qml14
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_menu.qml22
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_menuitem.qml17
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_menuseparator.qml13
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_page.qml18
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_pageindicator.qml15
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_pane.qml17
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_popup.qml26
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_progressbar.qml14
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_radiobutton.qml16
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_radiodelegate.qml17
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_rangeslider.qml15
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_roundbutton.qml15
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_scrollbar.qml17
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_scrollindicator.qml16
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_scrollview.qml23
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_slider.qml14
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_spinbox.qml14
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_stackview.qml18
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_swipedelegate.qml15
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_swipeview.qml24
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_switch.qml15
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_switchdelegate.qml16
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_tabbar.qml23
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_tabbutton.qml16
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_textarea.qml14
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_textfield.qml14
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_toolbutton.qml15
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_toolseparator.qml13
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_tooltip.qml20
-rw-r--r--tests/benchmarks/qmlbench/creation/delegates_tumbler.qml15
69 files changed, 1130 insertions, 172 deletions
diff --git a/src/imports/controls/Tumbler.qml b/src/imports/controls/Tumbler.qml
index 3659e770..15ad876d 100644
--- a/src/imports/controls/Tumbler.qml
+++ b/src/imports/controls/Tumbler.qml
@@ -45,25 +45,23 @@ T.Tumbler {
implicitHeight: 200
delegate: Text {
- id: label
text: modelData
color: control.visualFocus ? Default.focusColor : Default.textDarkColor
font: control.font
- opacity: (1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2)) * (control.enabled ? 1 : 0.6)
+ opacity: (1.0 - Math.abs(Tumbler.displacement) / (control.visibleItemCount / 2)) * (control.enabled ? 1 : 0.6)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
contentItem: TumblerView {
- id: tumblerView
model: control.model
delegate: control.delegate
path: Path {
- startX: tumblerView.width / 2
- startY: -tumblerView.delegateHeight / 2
+ startX: contentItem.width / 2
+ startY: -contentItem.delegateHeight / 2
PathLine {
- x: tumblerView.width / 2
- y: (control.visibleItemCount + 1) * tumblerView.delegateHeight - tumblerView.delegateHeight / 2
+ x: contentItem.width / 2
+ y: (control.visibleItemCount + 1) * contentItem.delegateHeight - contentItem.delegateHeight / 2
}
}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-custom.qml
index b3645587..cc37d541 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-custom.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-custom.qml
@@ -56,7 +56,7 @@ Tumbler {
font: control.font
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
- opacity: 1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2)
+ opacity: 1.0 - Math.abs(Tumbler.displacement) / (control.visibleItemCount / 2)
}
Rectangle {
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc
index 36bce98d..ca70ed2f 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc
@@ -53,16 +53,43 @@
Primary=BlueGrey
\endcode
- \l {Material style} specific values that can be specified in a \c Material
+ \section1 Controls Section
+
+ The following values can be specified in a \c Controls section of the
+ configuration file:
+
+ \table
+ \header
+ \li Variable
+ \li Description
+ \row
+ \li \c Style
+ \li Specifies the style to run the application with.
+ The value can be the name of one of the \l {Available Styles}{built-in styles}
+ or a \l {Creating a Custom Style}{custom style}.
+ \row
+ \li \c FallbackStyle
+ \li Specifies the style to use for controls that are not implemented.
+ The style must be one of the \l {Available Styles}{built-in styles}.
+ By default, the \l {Default Style}{Default} style is used.
+ \endtable
+
+ \section1 Material Section
+
+ The following \l {Material style} specific values can be specified in a \c Material
section of the configuration file:
\include qquickmaterialstyle.qdocinc conf
- \l {Universal style} specific values that can be specified in a \c Universal
+ \section1 Universal Section
+
+ The following \l {Universal style} specific values can be specified in a \c Universal
section of the configuration file:
\include qquickuniversalstyle.qdocinc conf
+ \section1 Using the Configuration File in a Project
+
In order to make it possible for Qt Quick Controls 2 to find the configuration file,
it must be built into application's resources using the \l {The Qt Resource System}.
Here's an example \c .qrc file:
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
index 51d672f3..26f7c19a 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
@@ -103,6 +103,19 @@
\li ...
\endtable
+ \section1 License and Attributions
+
+ Qt Quick Controls 2 is available under commercial licenses from \l{The Qt Company}.
+ In addition, it is available under the
+ \l{GNU Lesser General Public License, version 3}, or
+ the \l{GNU General Public License, version 2}.
+ See \l{Qt Licensing} for further details.
+
+ Furthermore Qt Quick Controls 2 potentially contains third party
+ modules under following permissive licenses:
+
+ \generatelist{groupsbymodule attributions-qtquickcontrols2}
+
\section1 Topics
\list
diff --git a/src/imports/controls/material/LICENSE_ANGULARJS.txt b/src/imports/controls/material/LICENSE_ANGULARJS.txt
new file mode 100644
index 00000000..c1f2a826
--- /dev/null
+++ b/src/imports/controls/material/LICENSE_ANGULARJS.txt
@@ -0,0 +1,19 @@
+Copyright (c) 2014-2016 Google, Inc. http://angularjs.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/src/imports/controls/material/Tumbler.qml b/src/imports/controls/material/Tumbler.qml
index 9b1309ab..97628fc4 100644
--- a/src/imports/controls/material/Tumbler.qml
+++ b/src/imports/controls/material/Tumbler.qml
@@ -46,25 +46,23 @@ T.Tumbler {
implicitHeight: 200
delegate: Text {
- id: label
text: modelData
color: control.Material.foreground
font: control.font
- opacity: (1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2)) * (control.enabled ? 1 : 0.6)
+ opacity: (1.0 - Math.abs(Tumbler.displacement) / (control.visibleItemCount / 2)) * (control.enabled ? 1 : 0.6)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
contentItem: TumblerView {
- id: tumblerView
model: control.model
delegate: control.delegate
path: Path {
- startX: tumblerView.width / 2
- startY: -tumblerView.delegateHeight / 2
+ startX: contentItem.width / 2
+ startY: -contentItem.delegateHeight / 2
PathLine {
- x: tumblerView.width / 2
- y: (control.visibleItemCount + 1) * tumblerView.delegateHeight - tumblerView.delegateHeight / 2
+ x: contentItem.width / 2
+ y: (control.visibleItemCount + 1) * contentItem.delegateHeight - contentItem.delegateHeight / 2
}
}
diff --git a/src/imports/controls/material/qt_attribution.json b/src/imports/controls/material/qt_attribution.json
new file mode 100644
index 00000000..01b45e9f
--- /dev/null
+++ b/src/imports/controls/material/qt_attribution.json
@@ -0,0 +1,13 @@
+{
+ "Id": "shadow_angular_material",
+ "Name": "Shadow values from Angular Material",
+ "QDocModule": "qtquickcontrols2",
+ "QtUsage": "Used in the Material Style of Qt Quick Controls 2.",
+ "Files": "ElevationEffect.qml",
+ "Description": "Shadow values for the elevation effect.",
+ "Homepage": "https://angularjs.org/",
+ "License": "MIT License",
+ "LicenseId": "MIT",
+ "LicenseFile": "LICENSE_ANGULARJS.txt",
+ "Copyright": "Copyright (c) 2014-2016 Google, Inc"
+}
diff --git a/src/imports/controls/universal/Tumbler.qml b/src/imports/controls/universal/Tumbler.qml
index 45bcb6c8..9972fb4c 100644
--- a/src/imports/controls/universal/Tumbler.qml
+++ b/src/imports/controls/universal/Tumbler.qml
@@ -50,21 +50,20 @@ T.Tumbler {
text: modelData
font: control.font
color: control.Universal.foreground
- opacity: (1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2)) * (control.enabled ? 1 : 0.6)
+ opacity: (1.0 - Math.abs(Tumbler.displacement) / (control.visibleItemCount / 2)) * (control.enabled ? 1 : 0.6)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
contentItem: TumblerView {
- id: tumblerView
model: control.model
delegate: control.delegate
path: Path {
- startX: tumblerView.width / 2
- startY: -tumblerView.delegateHeight / 2
+ startX: contentItem.width / 2
+ startY: -contentItem.delegateHeight / 2
PathLine {
- x: tumblerView.width / 2
- y: (control.visibleItemCount + 1) * tumblerView.delegateHeight - tumblerView.delegateHeight / 2
+ x: contentItem.width / 2
+ y: (control.visibleItemCount + 1) * contentItem.delegateHeight - contentItem.delegateHeight / 2
}
}
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
index 263d7fde..2abdeb6e 100644
--- a/src/imports/templates/qtquicktemplates2plugin.cpp
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -226,7 +226,7 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickPage, 1>(uri, 2, 1, "Page");
qmlRegisterType<QQuickPopup, 1>(uri, 2, 1, "Popup");
qmlRegisterType<QQuickRangeSlider, 1>(uri, 2, 1, "RangeSlider");
- qmlRegisterType<QQuickRoundButton, 1>(uri, 2, 1, "RoundButton");
+ qmlRegisterType<QQuickRoundButton>(uri, 2, 1, "RoundButton");
qmlRegisterType<QQuickSlider, 1>(uri, 2, 1, "Slider");
qmlRegisterType<QQuickSpinBox, 1>(uri, 2, 1, "SpinBox");
qmlRegisterType<QQuickStackView, 1>(uri, 2, 1, "StackView");
diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp
index 64289d46..c57dc7ac 100644
--- a/src/quickcontrols2/qquickstyle.cpp
+++ b/src/quickcontrols2/qquickstyle.cpp
@@ -343,6 +343,8 @@ QString QQuickStyle::path()
\note The style must be configured \b before loading QML that imports Qt Quick Controls 2.
It is not possible to change the style after the QML types have been registered.
+
+ \sa setFallbackStyle(), {Using Styles in Qt Quick Controls 2}
*/
void QQuickStyle::setStyle(const QString &style)
{
@@ -365,6 +367,8 @@ void QQuickStyle::setStyle(const QString &style)
The fallback style can be also specified by setting the \c QT_QUICK_CONTROLS_FALLBACK_STYLE
\l {Supported Environment Variables in Qt Quick Controls 2}{environment variable}.
+
+ \sa setStyle(), {Using Styles in Qt Quick Controls 2}
*/
void QQuickStyle::setFallbackStyle(const QString &style)
{
diff --git a/src/quickcontrols2/qquicktumblerview.cpp b/src/quickcontrols2/qquicktumblerview.cpp
index e8f0c364..4469810c 100644
--- a/src/quickcontrols2/qquicktumblerview.cpp
+++ b/src/quickcontrols2/qquicktumblerview.cpp
@@ -173,14 +173,19 @@ void QQuickTumblerView::createView()
m_listView->setParentItem(this);
m_listView->setSnapMode(QQuickListView::SnapToItem);
m_listView->setHighlightRangeMode(QQuickListView::StrictlyEnforceRange);
- m_listView->setHighlightMoveDuration(1000);
m_listView->setClip(true);
- m_listView->setDelegate(m_delegate);
// Give the view a size.
updateView();
// Set the model.
updateModel();
+
+ // Set these after the model is set so that the currentItem animation
+ // happens instantly on startup/after switching models. If we set them too early,
+ // the view animates any potential currentIndex change over one second,
+ // which we don't want when the contentItem has just been created.
+ m_listView->setDelegate(m_delegate);
+ m_listView->setHighlightMoveDuration(1000);
}
}
}
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index 6fbd4c07..809c9f94 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -52,7 +52,6 @@
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qpa/qplatformtheme.h>
-#include <QtQml/private/qqmlincubator_p.h>
#if QT_CONFIG(accessibility)
#include <QtQuick/private/qquickaccessibleattached_p.h>
@@ -979,28 +978,6 @@ void QQuickControlPrivate::executeBackground(bool complete)
quickCompleteDeferred(q, backgroundName(), background);
}
-/*
- Cancels incubation recursively to avoid "Object destroyed during incubation" (QTBUG-50992)
-*/
-static void cancelIncubation(QObject *object, QQmlContext *context)
-{
- const auto children = object->children();
- for (QObject *child : children)
- cancelIncubation(child, context);
- QQmlIncubatorPrivate::cancel(object, context);
-}
-
-void QQuickControlPrivate::destroyDelegate(QObject *delegate, QObject *parent)
-{
- if (!delegate)
- return;
-
- QQmlContext *context = parent ? qmlContext(parent) : nullptr;
- if (context)
- cancelIncubation(delegate, context);
- delete delegate;
-}
-
void QQuickControlPrivate::updateLocale(const QLocale &l, bool e)
{
Q_Q(QQuickControl);
diff --git a/src/quicktemplates2/qquickcontrol_p_p.h b/src/quicktemplates2/qquickcontrol_p_p.h
index 3ed8b637..d0ca576d 100644
--- a/src/quicktemplates2/qquickcontrol_p_p.h
+++ b/src/quicktemplates2/qquickcontrol_p_p.h
@@ -133,8 +133,6 @@ public:
virtual void cancelBackground();
virtual void executeBackground(bool complete = false);
- static void destroyDelegate(QObject *object, QObject *parent);
-
struct ExtraData {
ExtraData();
QFont font;
diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp
index 3429f1f4..c965095d 100644
--- a/src/quicktemplates2/qquicktumbler.cpp
+++ b/src/quicktemplates2/qquicktumbler.cpp
@@ -119,15 +119,27 @@ namespace {
*/
QQuickItem *QQuickTumblerPrivate::determineViewType(QQuickItem *contentItem)
{
+ Q_Q(QQuickTumbler);
+ if (!contentItem) {
+ resetViewData();
+ return nullptr;
+ }
+
if (contentItem->inherits("QQuickPathView")) {
view = contentItem;
viewContentItem = contentItem;
viewContentItemType = PathViewContentItem;
+
+ QObject::connect(view, SIGNAL(offsetChanged()), q, SLOT(_q_calculateAttachedDisplacements()));
+
return contentItem;
} else if (contentItem->inherits("QQuickListView")) {
view = contentItem;
viewContentItem = qobject_cast<QQuickFlickable*>(contentItem)->contentItem();
viewContentItemType = ListViewContentItem;
+
+ QObject::connect(view, SIGNAL(contentYChanged()), q, SLOT(_q_calculateAttachedDisplacements()));
+
return contentItem;
} else {
const auto childItems = contentItem->childItems();
@@ -139,6 +151,7 @@ QQuickItem *QQuickTumblerPrivate::determineViewType(QQuickItem *contentItem)
}
resetViewData();
+ viewContentItemType = UnsupportedContentItemType;
return nullptr;
}
@@ -146,7 +159,7 @@ void QQuickTumblerPrivate::resetViewData()
{
view = nullptr;
viewContentItem = nullptr;
- viewContentItemType = UnsupportedContentItemType;
+ viewContentItemType = NoContentItem;
}
QList<QQuickItem *> QQuickTumblerPrivate::viewContentItemChildItems() const
@@ -228,6 +241,19 @@ void QQuickTumblerPrivate::_q_onViewCountChanged()
}
}
+void QQuickTumblerPrivate::_q_calculateAttachedDisplacements()
+{
+ const auto items = viewContentItemChildItems();
+ for (QQuickItem *childItem : items) {
+ QQuickTumblerAttached *attached = qobject_cast<QQuickTumblerAttached *>(
+ qmlAttachedPropertiesObject<QQuickTumbler>(childItem, false));
+ if (attached) {
+ QQuickTumblerAttachedPrivate *attachedPrivate = QQuickTumblerAttachedPrivate::get(attached);
+ attachedPrivate->_q_calculateDisplacement();
+ }
+ }
+}
+
void QQuickTumblerPrivate::itemChildAdded(QQuickItem *, QQuickItem *)
{
_q_updateItemWidths();
@@ -484,8 +510,6 @@ void QQuickTumbler::componentComplete()
{
Q_D(QQuickTumbler);
QQuickControl::componentComplete();
- d->_q_updateItemHeights();
- d->_q_updateItemWidths();
if (!d->view) {
// Force the view to be created.
@@ -493,6 +517,17 @@ void QQuickTumbler::componentComplete()
// Determine the type of view for attached properties, etc.
d->setupViewData(d->contentItem);
}
+
+ // If there was no contentItem or it was of an unsupported type,
+ // we don't have anything else to do.
+ if (!d->view)
+ return;
+
+ // Update item heights after we've populated the model,
+ // otherwise ignoreSignals will cause these functions to return early.
+ d->_q_updateItemHeights();
+ d->_q_updateItemWidths();
+ d->_q_onViewCountChanged();
}
void QQuickTumbler::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
@@ -511,6 +546,9 @@ void QQuickTumbler::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
// Make sure we use the new content item and not the current one, as that won't
// be changed until after contentItemChange() has finished.
d->setupViewData(newItem);
+
+ d->_q_updateItemHeights();
+ d->_q_updateItemWidths();
}
}
}
@@ -532,7 +570,7 @@ void QQuickTumblerPrivate::disconnectFromView()
QObject::disconnect(view, SIGNAL(movingChanged()), q, SIGNAL(movingChanged()));
QQuickItemPrivate *oldViewContentItemPrivate = QQuickItemPrivate::get(viewContentItem);
- oldViewContentItemPrivate->removeItemChangeListener(this, QQuickItemPrivate::Children);
+ oldViewContentItemPrivate->removeItemChangeListener(this, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
resetViewData();
}
@@ -545,6 +583,9 @@ void QQuickTumblerPrivate::setupViewData(QQuickItem *newControlContentItem)
determineViewType(newControlContentItem);
+ if (viewContentItemType == QQuickTumblerPrivate::NoContentItem)
+ return;
+
if (viewContentItemType == QQuickTumblerPrivate::UnsupportedContentItemType) {
qWarning() << "Tumbler: contentItem must contain either a PathView or a ListView";
return;
@@ -557,10 +598,12 @@ void QQuickTumblerPrivate::setupViewData(QQuickItem *newControlContentItem)
QObject::connect(view, SIGNAL(movingChanged()), q, SIGNAL(movingChanged()));
QQuickItemPrivate *viewContentItemPrivate = QQuickItemPrivate::get(viewContentItem);
- viewContentItemPrivate->addItemChangeListener(this, QQuickItemPrivate::Children);
+ viewContentItemPrivate->addItemChangeListener(this, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
// Sync the view's currentIndex with ours.
syncCurrentIndex();
+
+ _q_calculateAttachedDisplacements();
}
void QQuickTumblerPrivate::syncCurrentIndex()
@@ -568,17 +611,27 @@ void QQuickTumblerPrivate::syncCurrentIndex()
const int actualViewIndex = view->property("currentIndex").toInt();
Q_Q(QQuickTumbler);
+ const bool isPendingCurrentIndex = pendingCurrentIndex != -1;
+ const int indexToSet = isPendingCurrentIndex ? pendingCurrentIndex : currentIndex;
+
// Nothing to do.
- if (actualViewIndex == currentIndex)
+ if (actualViewIndex == indexToSet) {
+ pendingCurrentIndex = -1;
return;
+ }
// PathView likes to use 0 as currentIndex for empty models, but we use -1 for that.
if (q->count() == 0 && actualViewIndex == 0)
return;
ignoreCurrentIndexChanges = true;
- view->setProperty("currentIndex", currentIndex);
+ view->setProperty("currentIndex", QVariant(indexToSet));
ignoreCurrentIndexChanges = false;
+
+ if (view->property("currentIndex").toInt() == indexToSet)
+ pendingCurrentIndex = -1;
+ else if (isPendingCurrentIndex)
+ q->polish();
}
void QQuickTumblerPrivate::setCount(int newCount)
@@ -629,11 +682,17 @@ void QQuickTumblerPrivate::setWrap(bool shouldWrap, bool isExplicit)
ignoreCurrentIndexChanges = false;
- // The view should have been created now, so we can start determining its type, etc.
- // If the delegates use attached properties, this will have already been called,
- // in which case it will return early. If the delegate doesn't use attached properties,
- // we need to call it here.
- setupViewData(contentItem);
+ // If isComponentComplete() is true, we require a contentItem. If it's not
+ // true, it might not have been created yet, so we wait until
+ // componentComplete() is called.
+ //
+ // When the contentItem (usually QQuickTumblerView) has been created, we
+ // can start determining its type, etc. If the delegates use attached
+ // properties, this will have already been called, in which case it will
+ // return early. If the delegate doesn't use attached properties, we need
+ // to call it here.
+ if (q->isComponentComplete() || contentItem)
+ setupViewData(contentItem);
q->setCurrentIndex(oldCurrentIndex);
}
@@ -668,6 +727,10 @@ void QQuickTumbler::updatePolish()
{
Q_D(QQuickTumbler);
if (d->pendingCurrentIndex != -1) {
+ // Update our count, as ignoreSignals might have been true
+ // when _q_onViewCountChanged() was last called.
+ d->setCount(d->view->property("count").toInt());
+
// If the count is still 0, it's not going to happen.
if (d->count == 0) {
d->pendingCurrentIndex = -1;
@@ -689,77 +752,32 @@ void QQuickTumbler::updatePolish()
}
}
-class QQuickTumblerAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
-{
- Q_DECLARE_PUBLIC(QQuickTumblerAttached)
-public:
- QQuickTumblerAttachedPrivate()
- : tumbler(nullptr),
- index(-1),
- displacement(0)
- {
- }
-
- void init(QQuickItem *delegateItem)
- {
- if (!delegateItem->parentItem()) {
- qWarning() << "Tumbler: attached properties must be accessed through a delegate item that has a parent";
- return;
- }
-
- QVariant indexContextProperty = qmlContext(delegateItem)->contextProperty(QStringLiteral("index"));
- if (!indexContextProperty.isValid()) {
- qWarning() << "Tumbler: attempting to access attached property on item without an \"index\" property";
- return;
- }
-
- index = indexContextProperty.toInt();
-
- QQuickItem *parentItem = delegateItem;
- while ((parentItem = parentItem->parentItem())) {
- if ((tumbler = qobject_cast<QQuickTumbler*>(parentItem)))
- break;
- }
- }
-
- void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
- void itemChildAdded(QQuickItem *, QQuickItem *) override;
- void itemChildRemoved(QQuickItem *, QQuickItem *) override;
-
- void _q_calculateDisplacement();
- void emitIfDisplacementChanged(qreal oldDisplacement, qreal newDisplacement);
-
- // The Tumbler that contains the delegate. Required to calculated the displacement.
- QPointer<QQuickTumbler> tumbler;
- // The index of the delegate. Used to calculate the displacement.
- int index;
- // The displacement for our delegate.
- qreal displacement;
-};
-
-void QQuickTumblerAttachedPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
+QQuickTumblerAttachedPrivate::QQuickTumblerAttachedPrivate()
+ : tumbler(nullptr),
+ index(-1),
+ displacement(0)
{
- _q_calculateDisplacement();
}
-void QQuickTumblerAttachedPrivate::itemChildAdded(QQuickItem *, QQuickItem *)
+void QQuickTumblerAttachedPrivate::init(QQuickItem *delegateItem)
{
- _q_calculateDisplacement();
-}
+ if (!delegateItem->parentItem()) {
+ qWarning() << "Tumbler: attached properties must be accessed through a delegate item that has a parent";
+ return;
+ }
-void QQuickTumblerAttachedPrivate::itemChildRemoved(QQuickItem *item, QQuickItem *child)
-{
- _q_calculateDisplacement();
+ QVariant indexContextProperty = qmlContext(delegateItem)->contextProperty(QStringLiteral("index"));
+ if (!indexContextProperty.isValid()) {
+ qWarning() << "Tumbler: attempting to access attached property on item without an \"index\" property";
+ return;
+ }
- if (parent == child) {
- // The child that was removed from the contentItem was the delegate
- // that our properties are attached to. If we don't remove the change
- // listener, the contentItem will attempt to notify a destroyed
- // listener, causing a crash.
+ index = indexContextProperty.toInt();
- // item is the "actual content item" of Tumbler's contentItem, i.e. a PathView or ListView.contentItem
- QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- p->removeItemChangeListener(this, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
+ QQuickItem *parentItem = delegateItem;
+ while ((parentItem = parentItem->parentItem())) {
+ if ((tumbler = qobject_cast<QQuickTumbler*>(parentItem)))
+ break;
}
}
@@ -768,9 +786,9 @@ void QQuickTumblerAttachedPrivate::_q_calculateDisplacement()
const int previousDisplacement = displacement;
displacement = 0;
- // Can happen if the attached properties are accessed on the wrong type of item or the tumbler was destroyed.
if (!tumbler) {
- emitIfDisplacementChanged(previousDisplacement, displacement);
+ // Can happen if the attached properties are accessed on the wrong type of item or the tumbler was destroyed.
+ // We don't want to emit the change signal though, as this could cause warnings about Tumbler.tumbler being null.
return;
}
@@ -820,6 +838,11 @@ void QQuickTumblerAttachedPrivate::emitIfDisplacementChanged(qreal oldDisplaceme
emit q->displacementChanged();
}
+QQuickTumblerAttachedPrivate *QQuickTumblerAttachedPrivate::get(QQuickTumblerAttached *attached)
+{
+ return attached->d_func();
+}
+
QQuickTumblerAttached::QQuickTumblerAttached(QObject *parent)
: QObject(*(new QQuickTumblerAttachedPrivate), parent)
{
@@ -839,32 +862,17 @@ QQuickTumblerAttached::QQuickTumblerAttached(QObject *parent)
QQuickTumblerPrivate *tumblerPrivate = QQuickTumblerPrivate::get(d->tumbler);
tumblerPrivate->setupViewData(tumblerPrivate->contentItem);
- if (!tumblerPrivate->viewContentItem)
- return;
-
- QQuickItemPrivate *p = QQuickItemPrivate::get(tumblerPrivate->viewContentItem);
- p->addItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
-
- const char *contentItemSignal = tumblerPrivate->viewContentItemType == QQuickTumblerPrivate::PathViewContentItem
- ? SIGNAL(offsetChanged()) : SIGNAL(contentYChanged());
- connect(tumblerPrivate->view, contentItemSignal, this, SLOT(_q_calculateDisplacement()));
-
- d->_q_calculateDisplacement();
+ if (delegateItem->parentItem() == tumblerPrivate->viewContentItem) {
+ // This item belongs to the "new" view, meaning that the tumbler's contentItem
+ // was probably assigned declaratively. If they're not equal, calling
+ // _q_calculateDisplacement() would use the old contentItem data, which is bad.
+ d->_q_calculateDisplacement();
+ }
}
}
QQuickTumblerAttached::~QQuickTumblerAttached()
{
- Q_D(QQuickTumblerAttached);
- if (!d->tumbler)
- return;
-
- QQuickTumblerPrivate *tumblerPrivate = QQuickTumblerPrivate::get(d->tumbler);
- if (!tumblerPrivate->viewContentItem)
- return;
-
- QQuickItemPrivate *viewContentItemPrivate = QQuickItemPrivate::get(tumblerPrivate->viewContentItem);
- viewContentItemPrivate->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
}
/*!
diff --git a/src/quicktemplates2/qquicktumbler_p.h b/src/quicktemplates2/qquicktumbler_p.h
index 480ebb23..50069cd7 100644
--- a/src/quicktemplates2/qquicktumbler_p.h
+++ b/src/quicktemplates2/qquicktumbler_p.h
@@ -70,7 +70,6 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumbler : public QQuickControl
Q_PROPERTY(bool wrap READ wrap WRITE setWrap RESET resetWrap NOTIFY wrapChanged FINAL REVISION 1)
// 2.2 (Qt 5.9)
Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged FINAL REVISION 2)
- Q_CLASSINFO("DeferredPropertyNames", "background")
public:
explicit QQuickTumbler(QQuickItem *parent = nullptr);
@@ -128,6 +127,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_updateItemHeights())
Q_PRIVATE_SLOT(d_func(), void _q_onViewCurrentIndexChanged())
Q_PRIVATE_SLOT(d_func(), void _q_onViewCountChanged())
+ Q_PRIVATE_SLOT(d_func(), void _q_calculateAttachedDisplacements())
};
class QQuickTumblerAttachedPrivate;
diff --git a/src/quicktemplates2/qquicktumbler_p_p.h b/src/quicktemplates2/qquicktumbler_p_p.h
index 0dcae762..fc38dfcc 100644
--- a/src/quicktemplates2/qquicktumbler_p_p.h
+++ b/src/quicktemplates2/qquicktumbler_p_p.h
@@ -64,6 +64,7 @@ public:
~QQuickTumblerPrivate();
enum ContentItemType {
+ NoContentItem,
UnsupportedContentItemType,
PathViewContentItem,
ListViewContentItem
@@ -94,6 +95,7 @@ public:
void _q_updateItemWidths();
void _q_onViewCurrentIndexChanged();
void _q_onViewCountChanged();
+ void _q_calculateAttachedDisplacements();
void disconnectFromView();
void setupViewData(QQuickItem *newControlContentItem);
@@ -109,6 +111,28 @@ public:
void itemChildRemoved(QQuickItem *, QQuickItem *) override;
};
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumblerAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
+{
+ Q_DECLARE_PUBLIC(QQuickTumblerAttached)
+
+public:
+ QQuickTumblerAttachedPrivate();
+
+ void init(QQuickItem *delegateItem);
+
+ void _q_calculateDisplacement();
+ void emitIfDisplacementChanged(qreal oldDisplacement, qreal newDisplacement);
+
+ static QQuickTumblerAttachedPrivate *get(QQuickTumblerAttached *attached);
+
+ // The Tumbler that contains the delegate. Required to calculated the displacement.
+ QPointer<QQuickTumbler> tumbler;
+ // The index of the delegate. Used to calculate the displacement.
+ int index;
+ // The displacement for our delegate.
+ qreal displacement;
+};
+
QT_END_NAMESPACE
#endif // QQUICKTUMBLER_P_P_H
diff --git a/tests/auto/controls/data/TumblerListView.qml b/tests/auto/controls/data/TumblerListView.qml
index 4e71f471..1248bec0 100644
--- a/tests/auto/controls/data/TumblerListView.qml
+++ b/tests/auto/controls/data/TumblerListView.qml
@@ -49,15 +49,21 @@
****************************************************************************/
import QtQuick 2.6
+import QtQuick.Controls 2.2
ListView {
anchors.fill: parent
- model: parent.model
- delegate: parent.delegate
-
snapMode: ListView.SnapToItem
highlightRangeMode: ListView.StrictlyEnforceRange
preferredHighlightBegin: height / 2 - (height / parent.visibleItemCount / 2)
preferredHighlightEnd: height / 2 + (height / parent.visibleItemCount / 2)
clip: true
+ model: parent.model
+ delegate: Text {
+ objectName: text
+ text: "Custom" + modelData
+ opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2)
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
}
diff --git a/tests/auto/controls/data/TumblerPathView.qml b/tests/auto/controls/data/TumblerPathView.qml
index 4f6f653f..7b7cd5f4 100644
--- a/tests/auto/controls/data/TumblerPathView.qml
+++ b/tests/auto/controls/data/TumblerPathView.qml
@@ -49,16 +49,23 @@
****************************************************************************/
import QtQuick 2.6
+import QtQuick.Controls 2.2
PathView {
id: pathView
- model: parent.model
- delegate: parent.delegate
clip: true
pathItemCount: parent.visibleItemCount + 1
preferredHighlightBegin: 0.5
preferredHighlightEnd: 0.5
dragMargin: width / 2
+ model: parent.model
+ delegate: Text {
+ objectName: text
+ text: "Custom" + modelData
+ opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2)
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
path: Path {
startX: pathView.width / 2
diff --git a/tests/auto/controls/data/tst_tumbler.qml b/tests/auto/controls/data/tst_tumbler.qml
index 825c2489..36808b8f 100644
--- a/tests/auto/controls/data/tst_tumbler.qml
+++ b/tests/auto/controls/data/tst_tumbler.qml
@@ -287,11 +287,10 @@ TestCase {
compare(tumblerView.currentIndex, data.currentIndex);
compare(tumblerView.currentItem.text, data.currentIndex.toString());
- var fuzz = 1;
if (data.wrap) {
- fuzzyCompare(tumblerView.offset, data.currentIndex > 0 ? tumblerView.count - data.currentIndex : 0, fuzz);
+ tryCompare(tumblerView, "offset", data.currentIndex > 0 ? tumblerView.count - data.currentIndex : 0);
} else {
- fuzzyCompare(tumblerView.contentY, tumblerDelegateHeight * data.currentIndex - tumblerView.preferredHighlightBegin, fuzz);
+ tryCompare(tumblerView, "contentY", tumblerDelegateHeight * data.currentIndex - tumblerView.preferredHighlightBegin);
}
}
@@ -680,6 +679,17 @@ TestCase {
compare(tumbler.currentIndex, 3);
}
+ function findFirstDelegateWithText(view, text) {
+ var delegate = null;
+ var contentItem = view.hasOwnProperty("contentItem") ? view.contentItem : view;
+ for (var i = 0; i < contentItem.children.length && !delegate; ++i) {
+ var child = contentItem.children[i];
+ if (child.hasOwnProperty("text") && child.text === text)
+ delegate = child;
+ }
+ return delegate;
+ }
+
function test_customContentItemAfterConstruction_data() {
return [
{ tag: "ListView", componentPath: "TumblerListView.qml" },
@@ -705,6 +715,11 @@ TestCase {
tumblerView = findView(tumbler);
compare(tumblerView.currentIndex, 2);
+ var delegate = findFirstDelegateWithText(tumblerView, "Custom2");
+ verify(delegate);
+ compare(delegate.height, defaultImplicitDelegateHeight);
+ tryCompare(delegate.Tumbler, "displacement", 0);
+
tumblerView.incrementCurrentIndex();
compare(tumblerView.currentIndex, 3);
compare(tumbler.currentIndex, 3);
diff --git a/tests/auto/customization/tst_customization.cpp b/tests/auto/customization/tst_customization.cpp
index 05d95ec8..3010565c 100644
--- a/tests/auto/customization/tst_customization.cpp
+++ b/tests/auto/customization/tst_customization.cpp
@@ -101,7 +101,7 @@ static const ControlInfo ControlInfos[] = {
{ "ToolButton", QStringList() << "background" << "contentItem" },
{ "ToolSeparator", QStringList() << "background" << "contentItem" },
{ "ToolTip", QStringList() << "background" << "contentItem" },
- // { "Tumbler", QStringList() << "background" << "contentItem" } ### TODO: fix and enable deferred execution
+ { "Tumbler", QStringList() << "background" << "contentItem" }
};
class tst_customization : public QQmlDataTest
diff --git a/tests/auto/sanity/BLACKLIST b/tests/auto/sanity/BLACKLIST
index 965790e7..42ad3448 100644
--- a/tests/auto/sanity/BLACKLIST
+++ b/tests/auto/sanity/BLACKLIST
@@ -1,14 +1,4 @@
-[signalHandlers:material/CursorDelegate.qml]
-*
-[attachedObjects:material/ComboBox.qml]
-*
[attachedObjects:material/Switch.qml]
*
[attachedObjects:material/SwitchDelegate.qml]
*
-[attachedObjects:universal/ComboBox.qml]
-*
-[functions:material/RectangularGlow.qml]
-*
-[anchors:material/RectangularGlow.qml]
-*
diff --git a/tests/auto/sanity/tst_sanity.cpp b/tests/auto/sanity/tst_sanity.cpp
index 2988c96c..c99c42cb 100644
--- a/tests/auto/sanity/tst_sanity.cpp
+++ b/tests/auto/sanity/tst_sanity.cpp
@@ -42,6 +42,7 @@
#include <QtQml/private/qqmljsparser_p.h>
#include <QtQml/private/qqmljsast_p.h>
#include <QtQml/private/qqmljsastvisitor_p.h>
+#include <QtQml/private/qqmlmetatype_p.h>
Q_GLOBAL_STATIC(QObjectList, qt_qobjects)
@@ -73,6 +74,8 @@ private slots:
void anchors_data();
void attachedObjects();
void attachedObjects_data();
+ void ids();
+ void ids_data();
private:
QQmlEngine engine;
@@ -138,12 +141,17 @@ private:
void tst_Sanity::initTestCase()
{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(QString("import QtQuick.Templates 2.%1; Control { }").arg(QT_VERSION_MINOR - 7).toUtf8(), QUrl());
+
+ const QStringList qmlTypeNames = QQmlMetaType::qmlTypeNames();
+
QDirIterator it(QQC2_IMPORT_PATH, QStringList() << "*.qml" << "*.js", QDir::Files, QDirIterator::Subdirectories);
- const QStringList excludeDirs = QStringList() << QStringLiteral("snippets") << QStringLiteral("designer");
while (it.hasNext()) {
it.next();
QFileInfo info = it.fileInfo();
- if (!excludeDirs.contains(info.dir().dirName()))
+ if (qmlTypeNames.contains(QStringLiteral("QtQuick.Templates/") + info.baseName()))
files.insert(info.dir().dirName() + "/" + info.fileName(), info.filePath());
}
}
@@ -256,6 +264,71 @@ void tst_Sanity::anchors_data()
QTest::newRow(qPrintable(it.key())) << it.key() << it.value();
}
+class IdValidator : public BaseValidator
+{
+public:
+ IdValidator() : m_depth(0) { }
+
+protected:
+ bool visit(QQmlJS::AST::UiObjectBinding *) override
+ {
+ ++m_depth;
+ return true;
+ }
+
+ void endVisit(QQmlJS::AST::UiObjectBinding *) override
+ {
+ --m_depth;
+ }
+
+ bool visit(QQmlJS::AST::UiScriptBinding *node) override
+ {
+ if (m_depth == 0)
+ return true;
+
+ QQmlJS::AST::UiQualifiedId *id = node->qualifiedId;
+ if (id && id->name == QStringLiteral("id"))
+ addError(QString("Internal IDs are not allowed (%1)").arg(extractName(node->statement)), node);
+ return true;
+ }
+
+private:
+ QString extractName(QQmlJS::AST::Statement *statement)
+ {
+ QQmlJS::AST::ExpressionStatement *expressionStatement = static_cast<QQmlJS::AST::ExpressionStatement *>(statement);
+ if (!expressionStatement)
+ return QString();
+
+ QQmlJS::AST::IdentifierExpression *expression = static_cast<QQmlJS::AST::IdentifierExpression *>(expressionStatement->expression);
+ if (!expression)
+ return QString();
+
+ return expression->name.toString();
+ }
+
+ int m_depth;
+};
+
+void tst_Sanity::ids()
+{
+ QFETCH(QString, control);
+ QFETCH(QString, filePath);
+
+ IdValidator validator;
+ if (!validator.validate(filePath))
+ QFAIL(qPrintable(validator.errors()));
+}
+
+void tst_Sanity::ids_data()
+{
+ QTest::addColumn<QString>("control");
+ QTest::addColumn<QString>("filePath");
+
+ QMap<QString, QString>::const_iterator it;
+ for (it = files.constBegin(); it != files.constEnd(); ++it)
+ QTest::newRow(qPrintable(it.key())) << it.key() << it.value();
+}
+
static void addTestRows(QQmlEngine *engine, const QString &sourcePath, const QString &targetPath, const QStringList &skiplist = QStringList())
{
// We cannot use QQmlComponent to load QML files directly from the source tree.
diff --git a/tests/benchmarks/qmlbench/creation/delegates_abstractbutton.qml b/tests/benchmarks/qmlbench/creation/delegates_abstractbutton.qml
new file mode 100644
index 00000000..e6decdf0
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_abstractbutton.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: AbstractButton {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ checkable: index % 2
+ checked: index % 2
+ down: index % 3
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_busyindicator.qml b/tests/benchmarks/qmlbench/creation/delegates_busyindicator.qml
new file mode 100644
index 00000000..a5a6a72d
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_busyindicator.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: BusyIndicator {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ running: index % 2
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_button.qml b/tests/benchmarks/qmlbench/creation/delegates_button.qml
new file mode 100644
index 00000000..05abe1a0
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_button.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: Button {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "Button"
+ down: index % 2
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_checkbox.qml b/tests/benchmarks/qmlbench/creation/delegates_checkbox.qml
new file mode 100644
index 00000000..6969ebf7
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_checkbox.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: CheckBox {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "CheckBox"
+ checked: index % 2
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_checkdelegate.qml b/tests/benchmarks/qmlbench/creation/delegates_checkdelegate.qml
new file mode 100644
index 00000000..eda99905
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_checkdelegate.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: CheckDelegate {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "CheckDelegate"
+ checked: index % 2
+ down: index % 3
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_combobox.qml b/tests/benchmarks/qmlbench/creation/delegates_combobox.qml
new file mode 100644
index 00000000..22552bf8
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_combobox.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 250
+ delegate: ComboBox {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ model: 5
+ currentIndex: index % count
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_container.qml b/tests/benchmarks/qmlbench/creation/delegates_container.qml
new file mode 100644
index 00000000..6df6d83e
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_container.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: Container {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: 100
+ height: 100
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_control.qml b/tests/benchmarks/qmlbench/creation/delegates_control.qml
new file mode 100644
index 00000000..bf08a7eb
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_control.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: Control {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: 100
+ height: 100
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_delaybutton.qml b/tests/benchmarks/qmlbench/creation/delegates_delaybutton.qml
new file mode 100644
index 00000000..d88996d9
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_delaybutton.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.2
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: DelayButton {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "DelayButton"
+ down: index % 2
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_dial.qml b/tests/benchmarks/qmlbench/creation/delegates_dial.qml
new file mode 100644
index 00000000..118bac61
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_dial.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 500
+ delegate: Dial {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ value: index / root.staticCount
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_dialog.qml b/tests/benchmarks/qmlbench/creation/delegates_dialog.qml
new file mode 100644
index 00000000..b653252c
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_dialog.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.1
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 200
+ delegate: Item {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: dialog.width
+ height: dialog.height
+ Dialog {
+ id: dialog
+ visible: true
+ title: "Dialog"
+ modal: (index % 100) === 0
+ width: parent.width
+ height: parent.height
+ standardButtons: Dialog.Ok | Dialog.Cancel
+ Item {
+ implicitWidth: 200
+ implicitHeight: 200
+ }
+ }
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_dialogbuttonbox.qml b/tests/benchmarks/qmlbench/creation/delegates_dialogbuttonbox.qml
new file mode 100644
index 00000000..e676d144
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_dialogbuttonbox.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.1
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: DialogButtonBox {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_drawer.qml b/tests/benchmarks/qmlbench/creation/delegates_drawer.qml
new file mode 100644
index 00000000..886a2c65
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_drawer.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 250
+ delegate: Item {
+ width: root.width
+ height: root.height
+ Drawer {
+ id: drawer
+ visible: true
+ position: 1.0
+ edge: index % 2 ? Qt.LeftEdge : Qt.RightEdge
+ width: root.width / 3
+ height: parent.height
+ }
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_frame.qml b/tests/benchmarks/qmlbench/creation/delegates_frame.qml
new file mode 100644
index 00000000..a511f508
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_frame.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: Frame {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ Item {
+ implicitWidth: 100
+ implicitHeight: 100
+ }
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_groupbox.qml b/tests/benchmarks/qmlbench/creation/delegates_groupbox.qml
new file mode 100644
index 00000000..146cd400
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_groupbox.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: GroupBox {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ title: "GroupBox"
+ Item {
+ implicitWidth: 100
+ implicitHeight: 100
+ }
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_itemdelegate.qml b/tests/benchmarks/qmlbench/creation/delegates_itemdelegate.qml
new file mode 100644
index 00000000..62f6558f
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_itemdelegate.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: ItemDelegate {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "ItemDelegate"
+ down: index % 2
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_label.qml b/tests/benchmarks/qmlbench/creation/delegates_label.qml
new file mode 100644
index 00000000..8a22226b
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_label.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: Label {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "Label"
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_menu.qml b/tests/benchmarks/qmlbench/creation/delegates_menu.qml
new file mode 100644
index 00000000..1ef29da1
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_menu.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 200
+ delegate: Item {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: menu.width
+ height: menu.height
+ Menu {
+ id: menu
+ visible: true
+ MenuItem { text: "MenuItem1" }
+ MenuItem { text: "MenuItem2" }
+ MenuItem { text: "MenuItem3" }
+ }
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_menuitem.qml b/tests/benchmarks/qmlbench/creation/delegates_menuitem.qml
new file mode 100644
index 00000000..6bf481e8
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_menuitem.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: MenuItem {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "MenuItem"
+ checkable: index % 2
+ checked: index % 2
+ down: index % 3
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_menuseparator.qml b/tests/benchmarks/qmlbench/creation/delegates_menuseparator.qml
new file mode 100644
index 00000000..8322a0c5
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_menuseparator.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.1
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: MenuSeparator {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_page.qml b/tests/benchmarks/qmlbench/creation/delegates_page.qml
new file mode 100644
index 00000000..827bf004
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_page.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: Page {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: 100
+ height: 100
+ header: Item { }
+ footer: Item { }
+ Item { }
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_pageindicator.qml b/tests/benchmarks/qmlbench/creation/delegates_pageindicator.qml
new file mode 100644
index 00000000..1bcb3a48
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_pageindicator.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: PageIndicator {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ count: 5
+ currentIndex: index % 5
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_pane.qml b/tests/benchmarks/qmlbench/creation/delegates_pane.qml
new file mode 100644
index 00000000..55a26557
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_pane.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: Pane {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ Item {
+ implicitWidth: 100
+ implicitHeight: 100
+ }
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_popup.qml b/tests/benchmarks/qmlbench/creation/delegates_popup.qml
new file mode 100644
index 00000000..acb4ce25
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_popup.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 500
+ delegate: Item {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: popup.width
+ height: popup.height
+ Popup {
+ id: popup
+ visible: true
+ modal: (index % 100) === 0
+ width: parent.width
+ height: parent.height
+ Item {
+ implicitWidth: 100
+ implicitHeight: 100
+ }
+ }
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_progressbar.qml b/tests/benchmarks/qmlbench/creation/delegates_progressbar.qml
new file mode 100644
index 00000000..8eb06d0f
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_progressbar.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: ProgressBar {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ value: index / root.staticCount
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_radiobutton.qml b/tests/benchmarks/qmlbench/creation/delegates_radiobutton.qml
new file mode 100644
index 00000000..47a3ed98
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_radiobutton.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: RadioButton {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "RadioButton"
+ autoExclusive: false
+ checked: index % 2
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_radiodelegate.qml b/tests/benchmarks/qmlbench/creation/delegates_radiodelegate.qml
new file mode 100644
index 00000000..01d21a12
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_radiodelegate.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: RadioDelegate {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "RadioDelegate"
+ autoExclusive: false
+ checked: index % 2
+ down: index % 3
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_rangeslider.qml b/tests/benchmarks/qmlbench/creation/delegates_rangeslider.qml
new file mode 100644
index 00000000..afa23d2e
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_rangeslider.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: RangeSlider {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ first.value: (index / root.staticCount) * 0.5
+ second.value: 0.5 + (index / root.staticCount) * 0.5
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_roundbutton.qml b/tests/benchmarks/qmlbench/creation/delegates_roundbutton.qml
new file mode 100644
index 00000000..79495a91
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_roundbutton.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.1
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: RoundButton {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "X"
+ down: index % 2
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_scrollbar.qml b/tests/benchmarks/qmlbench/creation/delegates_scrollbar.qml
new file mode 100644
index 00000000..1edb9062
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_scrollbar.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: ScrollBar {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ height: 100
+ size: index / root.staticCount
+ pressed: index % 2
+ active: true
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_scrollindicator.qml b/tests/benchmarks/qmlbench/creation/delegates_scrollindicator.qml
new file mode 100644
index 00000000..8e8b616f
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_scrollindicator.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: ScrollIndicator {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ height: 100
+ size: index / root.staticCount
+ active: true
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_scrollview.qml b/tests/benchmarks/qmlbench/creation/delegates_scrollview.qml
new file mode 100644
index 00000000..da8630bc
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_scrollview.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.2
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 250
+ delegate: ScrollView {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: 100
+ height: 100
+ Item {
+ implicitWidth: 200
+ implicitHeight: 200
+ }
+ ScrollBar.vertical.active: true
+ ScrollBar.vertical.pressed: index % 3 === 1
+ ScrollBar.horizontal.active: true
+ ScrollBar.horizontal.pressed: index % 3 === 2
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_slider.qml b/tests/benchmarks/qmlbench/creation/delegates_slider.qml
new file mode 100644
index 00000000..55e0c8ef
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_slider.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: Slider {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ value: index / root.staticCount
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_spinbox.qml b/tests/benchmarks/qmlbench/creation/delegates_spinbox.qml
new file mode 100644
index 00000000..d4a3900a
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_spinbox.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 250
+ delegate: SpinBox {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ value: index / root.staticCount * to
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_stackview.qml b/tests/benchmarks/qmlbench/creation/delegates_stackview.qml
new file mode 100644
index 00000000..620b3874
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_stackview.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: StackView {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: 100
+ height: 100
+ initialItem: Item {
+ focus: StackView.status === StackView.Active
+ }
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_swipedelegate.qml b/tests/benchmarks/qmlbench/creation/delegates_swipedelegate.qml
new file mode 100644
index 00000000..2f4624c5
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_swipedelegate.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: SwitchDelegate {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "SwipeDelegate"
+ down: index % 2
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_swipeview.qml b/tests/benchmarks/qmlbench/creation/delegates_swipeview.qml
new file mode 100644
index 00000000..d81203cf
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_swipeview.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: SwipeView {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: 100
+ height: 100
+ Item {
+ focus: SwipeView.isCurrentItem
+ }
+ Item {
+ focus: SwipeView.isCurrentItem
+ }
+ Item {
+ focus: SwipeView.isCurrentItem
+ }
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_switch.qml b/tests/benchmarks/qmlbench/creation/delegates_switch.qml
new file mode 100644
index 00000000..49104a1e
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_switch.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: Switch {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "Switch"
+ checked: index % 2
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_switchdelegate.qml b/tests/benchmarks/qmlbench/creation/delegates_switchdelegate.qml
new file mode 100644
index 00000000..1122d712
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_switchdelegate.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: SwitchDelegate {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "SwitchDelegate"
+ checked: index % 2
+ down: index % 3
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_tabbar.qml b/tests/benchmarks/qmlbench/creation/delegates_tabbar.qml
new file mode 100644
index 00000000..d3243d82
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_tabbar.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 250
+ delegate: TabBar {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ currentIndex: index / root.staticCount * count
+ TabButton {
+ text: "Tab1"
+ }
+ TabButton {
+ text: "Tab2"
+ }
+ TabButton {
+ text: "Tab3"
+ }
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_tabbutton.qml b/tests/benchmarks/qmlbench/creation/delegates_tabbutton.qml
new file mode 100644
index 00000000..713e4ea5
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_tabbutton.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: TabButton {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "TabButton"
+ checked: index % 2
+ down: index % 3
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_textarea.qml b/tests/benchmarks/qmlbench/creation/delegates_textarea.qml
new file mode 100644
index 00000000..68a79684
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_textarea.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 500
+ delegate: TextArea {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "Text\nArea"
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_textfield.qml b/tests/benchmarks/qmlbench/creation/delegates_textfield.qml
new file mode 100644
index 00000000..fe500d40
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_textfield.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: TextField {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "TextField"
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_toolbutton.qml b/tests/benchmarks/qmlbench/creation/delegates_toolbutton.qml
new file mode 100644
index 00000000..fd966c57
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_toolbutton.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 1000
+ delegate: ToolButton {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ text: "ToolButton"
+ down: index % 2
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_toolseparator.qml b/tests/benchmarks/qmlbench/creation/delegates_toolseparator.qml
new file mode 100644
index 00000000..6031d4bc
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_toolseparator.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.1
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 2000
+ delegate: ToolSeparator {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_tooltip.qml b/tests/benchmarks/qmlbench/creation/delegates_tooltip.qml
new file mode 100644
index 00000000..7efa4b24
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_tooltip.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 500
+ delegate: Item {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ width: tooltip.width
+ height: tooltip.height
+ ToolTip {
+ id: tooltip
+ visible: true
+ text: "ToolTip"
+ }
+ }
+}
diff --git a/tests/benchmarks/qmlbench/creation/delegates_tumbler.qml b/tests/benchmarks/qmlbench/creation/delegates_tumbler.qml
new file mode 100644
index 00000000..4322536d
--- /dev/null
+++ b/tests/benchmarks/qmlbench/creation/delegates_tumbler.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QmlBench 1.0
+import QtQuick.Controls 2.0
+
+CreationBenchmark {
+ id: root
+ count: 20
+ staticCount: 250
+ delegate: Tumbler {
+ x: QmlBench.getRandom() * root.width - width
+ y: QmlBench.getRandom() * root.height - height
+ model: 5
+ currentIndex: index % count
+ }
+}