aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-23 16:00:07 +0200
committerTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-23 16:00:07 +0200
commit19ed7973a311a8d42d3a558bb551230e902ce9b9 (patch)
tree9832c0cc796722f85579e25fd50cc38b65e6ef6c
parentf5701f0def37fcc0c2b38ae9552eb3a896a34687 (diff)
parenta5635345175e667601c8b6a344508c4d4ebb0f9d (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.9' into tqtc/lts-5.15-opensourcev5.15.9-lts-lgpl
-rw-r--r--.qmake.conf2
-rw-r--r--.tag2
-rw-r--r--examples/quick/positioners/positioners-attachedproperties.qml28
-rw-r--r--src/qml/common/common.pri6
-rw-r--r--src/qml/common/qqmljsfixedpoolarray_p.h2
-rw-r--r--src/qml/doc/src/javascript/finetuning.qdoc9
-rw-r--r--src/qml/inlinecomponentutils_p.h4
-rw-r--r--src/qml/jsruntime/qv4engine.cpp4
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp5
-rw-r--r--src/qml/memory/qv4mm.cpp2
-rw-r--r--src/qml/qml/qqmlloggingcategory.cpp17
-rw-r--r--src/qmlmodels/qqmladaptormodel.cpp18
-rw-r--r--src/qmlmodels/qqmladaptormodel_p.h6
-rw-r--r--src/qmlmodels/qqmldelegatemodel.cpp3
-rw-r--r--src/qmlmodels/qqmlinstantiator.cpp2
-rw-r--r--src/quick/accessible/qaccessiblequickitem.cpp7
-rw-r--r--src/quick/doc/images/containmentMask-circle.gifbin0 -> 9926 bytes
-rw-r--r--src/quick/doc/images/containmentMask-shape.gifbin0 -> 11261 bytes
-rw-r--r--src/quick/doc/snippets/qml/item/containmentMask-circle-js.qml71
-rw-r--r--src/quick/doc/snippets/qml/item/containmentMask-shape.qml80
-rw-r--r--src/quick/doc/src/concepts/input/focus.qdoc2
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp29
-rw-r--r--src/quick/items/context2d/qquickcontext2d_p.h2
-rw-r--r--src/quick/items/qquickaccessibleattached.cpp5
-rw-r--r--src/quick/items/qquickevents.cpp2
-rw-r--r--src/quick/items/qquickgridview.cpp2
-rw-r--r--src/quick/items/qquickitem.cpp44
-rw-r--r--src/quick/items/qquickitemview.cpp2
-rw-r--r--src/quick/items/qquickitemviewtransition.cpp10
-rw-r--r--src/quick/items/qquickitemviewtransition_p.h4
-rw-r--r--src/quick/items/qquickloader.cpp2
-rw-r--r--src/quick/items/qquicktext.cpp2
-rw-r--r--src/quick/items/qquickwindow.cpp9
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp21
-rw-r--r--src/quick/scenegraph/qsgrhidistancefieldglyphcache.cpp8
-rw-r--r--src/quick/scenegraph/shaders_ng/24bittextmask.frag.qsbbin1469 -> 1579 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/32bitcolortext.frag.qsbbin1344 -> 1436 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/8bittextmask.frag.qsbbin1351 -> 1433 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/8bittextmask_a.frag.qsbbin845 -> 926 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsbbin2174 -> 2266 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/outlinedtext.vert.qsbbin2623 -> 2743 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsbbin1437 -> 1528 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/styledtext.frag.qsbbin1740 -> 1834 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/styledtext.vert.qsbbin2175 -> 2294 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/styledtext_a.frag.qsbbin1158 -> 1236 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/textmask.frag.qsbbin1469 -> 1561 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/textmask.vert.qsbbin1933 -> 2047 bytes
-rw-r--r--src/quick/util/qquickanimatorjob.cpp11
-rw-r--r--src/quick/util/qquickanimatorjob_p.h11
-rw-r--r--src/quick/util/qquickstategroup.cpp9
-rw-r--r--src/quick/util/qquickstyledtext.cpp2
-rw-r--r--tests/auto/cmake/qtquickcompiler/main.cpp2
-rw-r--r--tests/auto/qml/animation/qpauseanimationjob/BLACKLIST3
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp39
-rw-r--r--tests/auto/qml/qqmlconsole/data/assert.qml13
-rw-r--r--tests/auto/qml/qqmlconsole/data/categorized_logging.qml9
-rw-r--r--tests/auto/qml/qqmlconsole/data/exception.qml4
-rw-r--r--tests/auto/qml/qqmlconsole/data/logging.qml21
-rw-r--r--tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp27
-rw-r--r--tests/auto/qml/qqmlinstantiator/data/activeModelChangeInteraction.qml39
-rw-r--r--tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp21
-rw-r--r--tests/auto/qml/qv4mm/tst_qv4mm.cpp6
-rw-r--r--tests/auto/quick/pointerhandlers/qquickdraghandler/data/dragMargin.qml3
-rw-r--r--tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp12
-rw-r--r--tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp1
-rw-r--r--tests/auto/quick/qquickdroparea/BLACKLIST4
-rw-r--r--tests/auto/quick/qquickframebufferobject/BLACKLIST1
-rw-r--r--tests/auto/quick/qquickgridview/data/qtbug92998.qml52
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp19
-rw-r--r--tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp22
-rw-r--r--tests/auto/quick/qquicklistview/BLACKLIST2
-rw-r--r--tests/auto/quick/qquicklistview/data/qtbug_92809.qml119
-rw-r--r--tests/auto/quick/qquicklistview/data/singletonModelLifetime.qml32
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp50
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/BLACKLIST4
-rw-r--r--tests/auto/quick/qquickstates/data/noStateOsciallation.qml22
-rw-r--r--tests/auto/quick/qquickstates/tst_qquickstates.cpp15
-rw-r--r--tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in11
-rw-r--r--tools/qmlimportscanner/main.cpp6
-rw-r--r--tools/qmlplugindump/main.cpp12
80 files changed, 858 insertions, 158 deletions
diff --git a/.qmake.conf b/.qmake.conf
index aa2fe801ea..a9549f1eb1 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -4,4 +4,4 @@ CONFIG += warning_clean
DEFINES += QT_NO_LINKED_LIST
DEFINES += QT_NO_JAVA_STYLE_ITERATORS
-MODULE_VERSION = 5.15.8
+MODULE_VERSION = 5.15.9
diff --git a/.tag b/.tag
index 6828f88dcb..8b42f85cf5 100644
--- a/.tag
+++ b/.tag
@@ -1 +1 @@
-$Format:%H$
+$Format:%T$
diff --git a/examples/quick/positioners/positioners-attachedproperties.qml b/examples/quick/positioners/positioners-attachedproperties.qml
index af89543289..38c71068f2 100644
--- a/examples/quick/positioners/positioners-attachedproperties.qml
+++ b/examples/quick/positioners/positioners-attachedproperties.qml
@@ -90,14 +90,14 @@ Rectangle {
anchors.leftMargin: 20
anchors.verticalCenter: parent.verticalCenter
text: "Index: " + parent.Positioner.index
- + (parent.Positioner.isFirstItem ? " (First)" : "")
- + (parent.Positioner.isLastItem ? " (Last)" : "")
+ + (parent.Positioner.isFirstItem ? " (First)" : "")
+ + (parent.Positioner.isLastItem ? " (Last)" : "")
}
// When mouse is clicked, display the values of the positioner
MouseArea {
- anchors.fill: parent
- onClicked: column.showInfo(green.Positioner)
+ anchors.fill: parent
+ onClicked: column.showInfo(green.Positioner)
}
}
//! [0]
@@ -113,14 +113,14 @@ Rectangle {
anchors.leftMargin: 20
anchors.verticalCenter: parent.verticalCenter
text: "Index: " + parent.Positioner.index
- + (parent.Positioner.isFirstItem ? " (First)" : "")
- + (parent.Positioner.isLastItem ? " (Last)" : "")
+ + (parent.Positioner.isFirstItem ? " (First)" : "")
+ + (parent.Positioner.isLastItem ? " (Last)" : "")
}
// When mouse is clicked, display the values of the positioner
MouseArea {
- anchors.fill: parent
- onClicked: column.showInfo(blue.Positioner)
+ anchors.fill: parent
+ onClicked: column.showInfo(blue.Positioner)
}
}
@@ -135,14 +135,14 @@ Rectangle {
anchors.leftMargin: 20
anchors.verticalCenter: parent.verticalCenter
text: "Index: " + parent.Positioner.index
- + (parent.Positioner.isFirstItem ? " (First)" : "")
- + (parent.Positioner.isLastItem ? " (Last)" : "")
+ + (parent.Positioner.isFirstItem ? " (First)" : "")
+ + (parent.Positioner.isLastItem ? " (Last)" : "")
}
// When mouse is clicked, display the values of the positioner
MouseArea {
- anchors.fill: parent
- onClicked: column.showInfo(purple.Positioner)
+ anchors.fill: parent
+ onClicked: column.showInfo(purple.Positioner)
}
}
@@ -159,8 +159,8 @@ Rectangle {
anchors.leftMargin: 20
anchors.verticalCenter: parent.verticalCenter
text: "Index: " + parent.Positioner.index
- + (parent.Positioner.isFirstItem ? " (First)" : "")
- + (parent.Positioner.isLastItem ? " (Last)" : "")
+ + (parent.Positioner.isFirstItem ? " (First)" : "")
+ + (parent.Positioner.isLastItem ? " (Last)" : "")
}
}
diff --git a/src/qml/common/common.pri b/src/qml/common/common.pri
index b333c0f6d9..b824812d27 100644
--- a/src/qml/common/common.pri
+++ b/src/qml/common/common.pri
@@ -1,8 +1,8 @@
!build_pass {
# Create a header containing a hash that describes this library. For a
# released version of Qt, we'll use the .tag file that is updated by git
- # archive with the commit hash. For unreleased versions, we'll ask git
- # describe. Note that it won't update unless qmake is run again, even if
+ # archive with the tree hash. For unreleased versions, we'll ask git
+ # rev-parse. Note that it won't update unless qmake is run again, even if
# the commit change also changed something in this library.
tagFile = $$PWD/../../.tag
tag =
@@ -10,7 +10,7 @@
tag = $$cat($$tagFile, singleline)
QMAKE_INTERNAL_INCLUDED_FILES += $$tagFile
}
- !equals(tag, "$${LITERAL_DOLLAR}Format:%H$${LITERAL_DOLLAR}") {
+ !equals(tag, "$${LITERAL_DOLLAR}Format:%T$${LITERAL_DOLLAR}") {
QML_COMPILE_HASH = $$tag
} else:exists($$PWD/../../.git) {
commit = $$system(git rev-parse HEAD)
diff --git a/src/qml/common/qqmljsfixedpoolarray_p.h b/src/qml/common/qqmljsfixedpoolarray_p.h
index b65b994d6c..15a8cd6878 100644
--- a/src/qml/common/qqmljsfixedpoolarray_p.h
+++ b/src/qml/common/qqmljsfixedpoolarray_p.h
@@ -86,7 +86,7 @@ public:
if (QTypeInfo<T>::isComplex) {
for (int i = 0; i < count; ++i)
new (data + i) T(vector.at(i));
- } else {
+ } else if (count) {
memcpy(data, static_cast<const void*>(vector.constData()), count * sizeof(T));
}
}
diff --git a/src/qml/doc/src/javascript/finetuning.qdoc b/src/qml/doc/src/javascript/finetuning.qdoc
index fcd710db8b..35310ee051 100644
--- a/src/qml/doc/src/javascript/finetuning.qdoc
+++ b/src/qml/doc/src/javascript/finetuning.qdoc
@@ -82,9 +82,12 @@ Running JavaScript code can be influenced by a few environment variables, partic
\li \c{QV4_MAX_CALL_DEPTH}
\li Stack overflows when running (as opposed to compiling) JavaScript are prevented by
controlling the call depth: the number of nested function invocations. By
- default, an exception is generated if the call depth exceeds 1234. If it contains a
- number, this environment variable overrides the maximum call depth. Beware that the
- recursion limit when compiling JavaScript is not affected.
+ default, an exception is generated if the call depth exceeds a maximum number tuned
+ to the platform's default stack size. If the \c{QV4_MAX_CALL_DEPTH} environment
+ variable contains a number, this number is used as maximum call depth. Beware that
+ the recursion limit when compiling JavaScript is not affected. The default maximum
+ call depth is 1234 on most platforms. On QNX it is 640 because on QNX the default
+ stack size is smaller than on most platforms.
\row
\li \c{QV4_MM_AGGRESSIVE_GC}
\li Setting this environment variable runs the garbage collector before each memory
diff --git a/src/qml/inlinecomponentutils_p.h b/src/qml/inlinecomponentutils_p.h
index 99b28349cd..7666457d98 100644
--- a/src/qml/inlinecomponentutils_p.h
+++ b/src/qml/inlinecomponentutils_p.h
@@ -62,7 +62,9 @@ struct Node {
Node& operator=(Node &&) = default;
bool operator==(Node const &other) const {return index == other.index;}
- Node(std::vector<QV4::CompiledData::InlineComponent>::size_type s) {
+ Node(std::vector<QV4::CompiledData::InlineComponent>::size_type s)
+ : index{0}
+ {
index = quint32(s);
temporaryMark = 0;
permanentMark = 0;
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 833df534d6..d26e991d3f 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -310,7 +310,11 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine)
maxCallDepth = qEnvironmentVariableIntValue("QV4_MAX_CALL_DEPTH", &ok);
if (!ok || maxCallDepth <= 0) {
#if defined(QT_NO_DEBUG) && !defined(__SANITIZE_ADDRESS__) && !__has_feature(address_sanitizer)
+#ifdef Q_OS_QNX
+ maxCallDepth = 640; // QNX's stack is only 512k by default
+#else
maxCallDepth = 1234;
+#endif
#else
// no (tail call) optimization is done, so there'll be a lot mare stack frames active
maxCallDepth = 200;
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index e57cdd8278..94613598af 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -1145,8 +1145,7 @@ void Heap::QObjectWrapper::markObjects(Heap::Base *that, QV4::MarkStack *markSta
void QObjectWrapper::destroyObject(bool lastCall)
{
Heap::QObjectWrapper *h = d();
- if (!h->internalClass)
- return; // destroyObject already got called
+ Q_ASSERT(h->internalClass);
if (h->object()) {
QQmlData *ddata = QQmlData::get(h->object(), false);
@@ -1176,7 +1175,7 @@ void QObjectWrapper::destroyObject(bool lastCall)
}
}
- h->~Data();
+ h->destroy();
}
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index 06caf04e5a..da149a67c4 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -981,7 +981,7 @@ void MemoryManager::sweep(bool lastSweep, ClassDestroyStatsCallback classCountPt
if (MultiplyWrappedQObjectMap *multiplyWrappedQObjects = engine->m_multiplyWrappedQObjects) {
for (MultiplyWrappedQObjectMap::Iterator it = multiplyWrappedQObjects->begin(); it != multiplyWrappedQObjects->end();) {
- if (!it.value().isNullOrUndefined())
+ if (it.value().isNullOrUndefined())
it = multiplyWrappedQObjects->erase(it);
else
++it;
diff --git a/src/qml/qml/qqmlloggingcategory.cpp b/src/qml/qml/qqmlloggingcategory.cpp
index b59a26e17e..98dfe62f0c 100644
--- a/src/qml/qml/qqmlloggingcategory.cpp
+++ b/src/qml/qml/qqmlloggingcategory.cpp
@@ -129,7 +129,7 @@ void QQmlLoggingCategory::componentComplete()
{
m_initialized = true;
if (m_name.isNull()) {
- qmlWarning(this) << QLatin1String("Declaring the name of the LoggingCategory is mandatory and cannot be changed later !");
+ qmlWarning(this) << QLatin1String("Declaring the name of a LoggingCategory is mandatory and cannot be changed later");
} else {
QScopedPointer<QLoggingCategory> category(new QLoggingCategory(m_name.constData(), QtMsgType(m_defaultLogLevel)));
m_category.swap(category);
@@ -138,23 +138,30 @@ void QQmlLoggingCategory::componentComplete()
void QQmlLoggingCategory::setDefaultLogLevel(DefaultLogLevel defaultLogLevel)
{
+ if (m_defaultLogLevel == defaultLogLevel)
+ return;
+
if (m_initialized) {
- qmlWarning(this) << QLatin1String("The defaultLogLevel of a LoggingCategory cannot be changed after the Item is created");
+ qmlWarning(this) << QLatin1String("The defaultLogLevel of a LoggingCategory cannot be changed after the component is completed");
return;
}
m_defaultLogLevel = defaultLogLevel;
}
-
void QQmlLoggingCategory::setName(const QString &name)
{
+ const QByteArray newName = name.toUtf8();
+
+ if (m_name == newName)
+ return;
+
if (m_initialized) {
- qmlWarning(this) << QLatin1String("The name of a LoggingCategory cannot be changed after the Item is created");
+ qmlWarning(this) << QLatin1String("The name of a LoggingCategory cannot be changed after the component is completed");
return;
}
- m_name = name.toUtf8();
+ m_name = newName;
}
#include "moc_qqmlloggingcategory_p.cpp"
diff --git a/src/qmlmodels/qqmladaptormodel.cpp b/src/qmlmodels/qqmladaptormodel.cpp
index 2126ad3dc5..991a5c9e08 100644
--- a/src/qmlmodels/qqmladaptormodel.cpp
+++ b/src/qmlmodels/qqmladaptormodel.cpp
@@ -962,30 +962,36 @@ QQmlAdaptorModel::~QQmlAdaptorModel()
accessors->cleanup(*this);
}
-void QQmlAdaptorModel::setModel(const QVariant &variant, QObject *parent, QQmlEngine *engine)
+void QQmlAdaptorModel::setModel(const QVariant &variant, QObject *, QQmlEngine *engine)
{
accessors->cleanup(*this);
list.setList(variant, engine);
+ modelStrongReference.clear();
if (QObject *object = qvariant_cast<QObject *>(list.list())) {
- setObject(object, parent);
+ if (QQmlData *ddata = QQmlData::get(object))
+ modelStrongReference = ddata->jsWrapper;
+ setObject(object);
if (qobject_cast<QAbstractItemModel *>(object))
accessors = new VDMAbstractItemModelDataType(this);
else
accessors = new VDMObjectDelegateDataType;
} else if (list.type() == QQmlListAccessor::ListProperty) {
- setObject(static_cast<const QQmlListReference *>(variant.constData())->object(), parent);
+ auto object = static_cast<const QQmlListReference *>(variant.constData())->object();
+ if (QQmlData *ddata = QQmlData::get(object))
+ modelStrongReference = ddata->jsWrapper;
+ setObject(object);
accessors = new VDMObjectDelegateDataType;
} else if (list.type() == QQmlListAccessor::ObjectList) {
- setObject(nullptr, parent);
+ setObject(nullptr);
accessors = new VDMObjectDelegateDataType;
} else if (list.type() != QQmlListAccessor::Invalid
&& list.type() != QQmlListAccessor::Instance) { // Null QObject
- setObject(nullptr, parent);
+ setObject(nullptr);
accessors = new VDMListDelegateDataType;
} else {
- setObject(nullptr, parent);
+ setObject(nullptr);
accessors = &qt_vdm_null_accessors;
}
}
diff --git a/src/qmlmodels/qqmladaptormodel_p.h b/src/qmlmodels/qqmladaptormodel_p.h
index ba54c864c6..4dbb6ed54e 100644
--- a/src/qmlmodels/qqmladaptormodel_p.h
+++ b/src/qmlmodels/qqmladaptormodel_p.h
@@ -70,7 +70,7 @@ class QQmlDelegateModel;
class QQmlDelegateModelItem;
class QQmlDelegateModelItemMetaType;
-class Q_QMLMODELS_PRIVATE_EXPORT QQmlAdaptorModel : public QQmlStrongJSQObjectReference<QObject>
+class Q_QMLMODELS_PRIVATE_EXPORT QQmlAdaptorModel : public QQmlGuard<QObject>
{
public:
class Accessors
@@ -114,6 +114,10 @@ public:
const Accessors *accessors;
QPersistentModelIndex rootIndex;
QQmlListAccessor list;
+ // we need to ensure that a JS created model does not get gced, but cannot
+ // arbitrarily set the parent (using QQmlStrongJSQObjectReference) of QObject based models,
+ // as that causes issues with singletons
+ QV4::PersistentValue modelStrongReference;
int modelItemRevision = 0;
diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp
index 2079a8ed04..523c0df779 100644
--- a/src/qmlmodels/qqmldelegatemodel.cpp
+++ b/src/qmlmodels/qqmldelegatemodel.cpp
@@ -258,7 +258,7 @@ QQmlDelegateModel::~QQmlDelegateModel()
{
Q_D(QQmlDelegateModel);
d->disconnectFromAbstractItemModel();
- d->m_adaptorModel.setObject(nullptr, this);
+ d->m_adaptorModel.setObject(nullptr);
for (QQmlDelegateModelItem *cacheItem : qAsConst(d->m_cache)) {
if (cacheItem->object) {
@@ -1728,6 +1728,7 @@ void QQmlDelegateModel::_q_itemsRemoved(int index, int count)
return;
d->m_count -= count;
+ Q_ASSERT(d->m_count >= 0);
const QList<QQmlDelegateModelItem *> cache = d->m_cache;
//Prevents items being deleted in remove loop
for (QQmlDelegateModelItem *item : cache)
diff --git a/src/qmlmodels/qqmlinstantiator.cpp b/src/qmlmodels/qqmlinstantiator.cpp
index 3a0d746eb6..1d5249d4c0 100644
--- a/src/qmlmodels/qqmlinstantiator.cpp
+++ b/src/qmlmodels/qqmlinstantiator.cpp
@@ -147,7 +147,7 @@ void QQmlInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &changeSet, bo
{
Q_Q(QQmlInstantiator);
- if (!componentComplete || effectiveReset)
+ if (!componentComplete || effectiveReset || !active)
return;
if (reset) {
diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp
index 85719fdc80..ae1954ae8d 100644
--- a/src/quick/accessible/qaccessiblequickitem.cpp
+++ b/src/quick/accessible/qaccessiblequickitem.cpp
@@ -177,6 +177,11 @@ QList<QQuickItem *> QAccessibleQuickItem::childItems() const
return accessibleUnignoredChildren(item());
}
+static bool isTextRole(QAccessible::Role role)
+{
+ return role == QAccessible::EditableText || role == QAccessible::StaticText;
+}
+
QAccessible::State QAccessibleQuickItem::state() const
{
QQuickAccessibleAttached *attached = QQuickAccessibleAttached::attachedProperties(item());
@@ -194,7 +199,7 @@ QAccessible::State QAccessibleQuickItem::state() const
state.offscreen = true;
if ((role() == QAccessible::CheckBox || role() == QAccessible::RadioButton) && object()->property("checked").toBool())
state.checked = true;
- if (item()->activeFocusOnTab() || role() == QAccessible::EditableText)
+ if (item()->activeFocusOnTab() || isTextRole(role()))
state.focusable = true;
if (item()->hasActiveFocus())
state.focused = true;
diff --git a/src/quick/doc/images/containmentMask-circle.gif b/src/quick/doc/images/containmentMask-circle.gif
new file mode 100644
index 0000000000..80abce625f
--- /dev/null
+++ b/src/quick/doc/images/containmentMask-circle.gif
Binary files differ
diff --git a/src/quick/doc/images/containmentMask-shape.gif b/src/quick/doc/images/containmentMask-shape.gif
new file mode 100644
index 0000000000..e7989352eb
--- /dev/null
+++ b/src/quick/doc/images/containmentMask-shape.gif
Binary files differ
diff --git a/src/quick/doc/snippets/qml/item/containmentMask-circle-js.qml b/src/quick/doc/snippets/qml/item/containmentMask-circle-js.qml
new file mode 100644
index 0000000000..2d97bcdafa
--- /dev/null
+++ b/src/quick/doc/snippets/qml/item/containmentMask-circle-js.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, 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 QtQml 2.12
+import QtQuick 2.12
+
+//![0]
+Rectangle {
+ id: circle
+ width: 100; height: width
+ radius: width / 2
+ color: tapHandler.pressed ? "tomato" : hoverHandler.hovered ? "darkgray" : "lightgray"
+
+ TapHandler { id: tapHandler }
+ HoverHandler { id: hoverHandler }
+
+ containmentMask: QtObject {
+ property alias radius: circle.radius
+ function contains(point: point) : bool {
+ return (Math.pow(point.x - radius, 2) + Math.pow(point.y - radius, 2)) < Math.pow(radius, 2)
+ }
+ }
+}
+//![0]
diff --git a/src/quick/doc/snippets/qml/item/containmentMask-shape.qml b/src/quick/doc/snippets/qml/item/containmentMask-shape.qml
new file mode 100644
index 0000000000..a3da217e73
--- /dev/null
+++ b/src/quick/doc/snippets/qml/item/containmentMask-shape.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, 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.12
+import QtQuick.Shapes 1.12
+
+//![0]
+Rectangle {
+ width: 90; height: 100
+ color: hoverHandler.hovered ? "wheat" : "lightgray"
+ containmentMask: shape
+
+ HoverHandler { id: hoverHandler }
+
+ Shape {
+ id: shape
+ containsMode: Shape.FillContains
+
+ ShapePath {
+ fillColor: "lightsteelblue"
+ startX: 10; startY: 20
+ PathArc {
+ x: 10; y: 80
+ radiusX: 40; radiusY: 40
+ useLargeArc: true
+ }
+ PathLine {
+ x: 10; y: 20
+ }
+ }
+ }
+}
+//![0]
diff --git a/src/quick/doc/src/concepts/input/focus.qdoc b/src/quick/doc/src/concepts/input/focus.qdoc
index 9862489f42..21f5f0e225 100644
--- a/src/quick/doc/src/concepts/input/focus.qdoc
+++ b/src/quick/doc/src/concepts/input/focus.qdoc
@@ -196,7 +196,7 @@ property. As the \l ListView is a focus scope, this doesn't affect the
rest of the application. However, if the \l ListView itself has
active focus this causes the delegate itself to receive active focus.
In this example, the root type of the delegate is also a focus scope,
-which in turn gives active focus to the \c {Text} type that actually performs
+which in turn gives active focus to the \l {TextInput} type that actually performs
the work of handling the \c {Return} key.
All of the QML view classes, such as \l PathView and \l GridView, behave
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 14fa07099f..28c62bd4f2 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -3892,16 +3892,16 @@ void QQuickContext2D::bezierCurveTo(qreal cp1x, qreal cp1y,
m_path.cubicTo(QPointF(cp1x, cp1y), QPointF(cp2x, cp2y), pt);
}
-void QQuickContext2D::addArcTo(const QPointF& p1, const QPointF& p2, float radius)
+void QQuickContext2D::addArcTo(const QPointF& p1, const QPointF& p2, qreal radius)
{
QPointF p0(m_path.currentPosition());
QPointF p1p0((p0.x() - p1.x()), (p0.y() - p1.y()));
QPointF p1p2((p2.x() - p1.x()), (p2.y() - p1.y()));
- float p1p0_length = std::sqrt(p1p0.x() * p1p0.x() + p1p0.y() * p1p0.y());
- float p1p2_length = std::sqrt(p1p2.x() * p1p2.x() + p1p2.y() * p1p2.y());
+ qreal p1p0_length = std::hypot(p1p0.x(), p1p0.y());
+ qreal p1p2_length = std::hypot(p1p2.x(), p1p2.y());
- double cos_phi = (p1p0.x() * p1p2.x() + p1p0.y() * p1p2.y()) / (p1p0_length * p1p2_length);
+ qreal cos_phi = QPointF::dotProduct(p1p0, p1p2) / (p1p0_length * p1p2_length);
// The points p0, p1, and p2 are on the same straight line (HTML5, 4.8.11.1.8)
// We could have used areCollinear() here, but since we're reusing
@@ -3911,16 +3911,16 @@ void QQuickContext2D::addArcTo(const QPointF& p1, const QPointF& p2, float radiu
return;
}
- float tangent = radius / std::tan(std::acos(cos_phi) / 2);
- float factor_p1p0 = tangent / p1p0_length;
+ qreal tangent = radius / std::tan(std::acos(cos_phi) / 2);
+ qreal factor_p1p0 = tangent / p1p0_length;
QPointF t_p1p0((p1.x() + factor_p1p0 * p1p0.x()), (p1.y() + factor_p1p0 * p1p0.y()));
QPointF orth_p1p0(p1p0.y(), -p1p0.x());
- float orth_p1p0_length = std::sqrt(orth_p1p0.x() * orth_p1p0.x() + orth_p1p0.y() * orth_p1p0.y());
- float factor_ra = radius / orth_p1p0_length;
+ qreal orth_p1p0_length = std::hypot(orth_p1p0.x(), orth_p1p0.y());
+ qreal factor_ra = radius / orth_p1p0_length;
// angle between orth_p1p0 and p1p2 to get the right vector orthographic to p1p0
- double cos_alpha = (orth_p1p0.x() * p1p2.x() + orth_p1p0.y() * p1p2.y()) / (orth_p1p0_length * p1p2_length);
+ qreal cos_alpha = QPointF::dotProduct(orth_p1p0, p1p2) / (orth_p1p0_length * p1p2_length);
if (cos_alpha < 0.f)
orth_p1p0 = QPointF(-orth_p1p0.x(), -orth_p1p0.y());
@@ -3928,20 +3928,15 @@ void QQuickContext2D::addArcTo(const QPointF& p1, const QPointF& p2, float radiu
// calculate angles for addArc
orth_p1p0 = QPointF(-orth_p1p0.x(), -orth_p1p0.y());
- float sa = std::acos(orth_p1p0.x() / orth_p1p0_length);
- if (orth_p1p0.y() < 0.f)
- sa = 2 * M_PI - sa;
+ qreal sa = std::atan2(orth_p1p0.y(), orth_p1p0.x());
// anticlockwise logic
bool anticlockwise = false;
- float factor_p1p2 = tangent / p1p2_length;
+ qreal factor_p1p2 = tangent / p1p2_length;
QPointF t_p1p2((p1.x() + factor_p1p2 * p1p2.x()), (p1.y() + factor_p1p2 * p1p2.y()));
QPointF orth_p1p2((t_p1p2.x() - p.x()), (t_p1p2.y() - p.y()));
- float orth_p1p2_length = std::sqrt(orth_p1p2.x() * orth_p1p2.x() + orth_p1p2.y() * orth_p1p2.y());
- float ea = std::acos(orth_p1p2.x() / orth_p1p2_length);
- if (orth_p1p2.y() < 0)
- ea = 2 * M_PI - ea;
+ qreal ea = std::atan2(orth_p1p2.y(), orth_p1p2.x());
if ((sa > ea) && ((sa - ea) < M_PI))
anticlockwise = true;
if ((sa < ea) && ((ea - sa) > M_PI))
diff --git a/src/quick/items/context2d/qquickcontext2d_p.h b/src/quick/items/context2d/qquickcontext2d_p.h
index b5626dec0c..a00689f694 100644
--- a/src/quick/items/context2d/qquickcontext2d_p.h
+++ b/src/quick/items/context2d/qquickcontext2d_p.h
@@ -241,7 +241,7 @@ public:
void arc(qreal x, qreal y, qreal radius,
qreal startAngle, qreal endAngle,
bool anticlockwise);
- void addArcTo(const QPointF& p1, const QPointF& p2, float radius);
+ void addArcTo(const QPointF& p1, const QPointF& p2, qreal radius);
bool isPointInPath(qreal x, qreal y) const;
diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp
index 67d17c98e5..70dcaa2acf 100644
--- a/src/quick/items/qquickaccessibleattached.cpp
+++ b/src/quick/items/qquickaccessibleattached.cpp
@@ -406,9 +406,10 @@ void QQuickAccessibleAttached::setRole(QAccessible::Role role)
m_state.focusable = true;
break;
case QAccessible::StaticText:
- if (!m_stateExplicitlySet.readOnly) {
+ if (!m_stateExplicitlySet.readOnly)
m_state.readOnly = true;
- }
+ if (!m_stateExplicitlySet.focusable)
+ m_state.focusable = true;
break;
default:
break;
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index 7e673b3fe4..1173b055a0 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -712,6 +712,8 @@ QQuickPointerDevice *QQuickPointerDevice::tabletDevice(const QTabletEvent *event
switch (event->pointerType()) {
case QTabletEvent::Pen:
ptype = Pen;
+ if (type == QQuickPointerDevice::UnknownDevice)
+ type = QQuickPointerDevice::Stylus;
break;
case QTabletEvent::Eraser:
ptype = Eraser;
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index 7ca5b0c34c..0a1f7681d6 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -1653,6 +1653,7 @@ void QQuickGridView::setCellWidth(qreal cellWidth)
d->updateViewport();
emit cellWidthChanged();
d->forceLayoutPolish();
+ QQuickFlickable::setContentX(d->contentXForPosition(d->position()));
}
}
@@ -1670,6 +1671,7 @@ void QQuickGridView::setCellHeight(qreal cellHeight)
d->updateViewport();
emit cellHeightChanged();
d->forceLayoutPolish();
+ QQuickFlickable::setContentY(d->contentYForPosition(d->position()));
}
}
/*!
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 75f1457816..33da9762d3 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -4543,10 +4543,10 @@ static bool unwrapMapFromToFromItemArgs(QQmlV4Function *args, const QQuickItem *
}
/*!
- \qmlmethod object QtQuick::Item::mapFromItem(Item item, real x, real y)
- \qmlmethod object QtQuick::Item::mapFromItem(Item item, point p)
- \qmlmethod object QtQuick::Item::mapFromItem(Item item, real x, real y, real width, real height)
- \qmlmethod object QtQuick::Item::mapFromItem(Item item, rect r)
+ \qmlmethod point QtQuick::Item::mapFromItem(Item item, real x, real y)
+ \qmlmethod point QtQuick::Item::mapFromItem(Item item, point p)
+ \qmlmethod rect QtQuick::Item::mapFromItem(Item item, real x, real y, real width, real height)
+ \qmlmethod rect QtQuick::Item::mapFromItem(Item item, rect r)
Maps the point (\a x, \a y) or rect (\a x, \a y, \a width, \a height), which is in \a
item's coordinate system, to this item's coordinate system, and returns a \l point or \l rect
@@ -4598,10 +4598,10 @@ QTransform QQuickItem::itemTransform(QQuickItem *other, bool *ok) const
}
/*!
- \qmlmethod object QtQuick::Item::mapToItem(Item item, real x, real y)
- \qmlmethod object QtQuick::Item::mapToItem(Item item, point p)
- \qmlmethod object QtQuick::Item::mapToItem(Item item, real x, real y, real width, real height)
- \qmlmethod object QtQuick::Item::mapToItem(Item item, rect r)
+ \qmlmethod point QtQuick::Item::mapToItem(Item item, real x, real y)
+ \qmlmethod point QtQuick::Item::mapToItem(Item item, point p)
+ \qmlmethod rect QtQuick::Item::mapToItem(Item item, real x, real y, real width, real height)
+ \qmlmethod rect QtQuick::Item::mapToItem(Item item, rect r)
Maps the point (\a x, \a y) or rect (\a x, \a y, \a width, \a height), which is in this
item's coordinate system, to \a item's coordinate system, and returns a \l point or \l rect
@@ -4683,7 +4683,7 @@ static bool unwrapMapFromToFromGlobalArgs(QQmlV4Function *args, const QQuickItem
/*!
\since 5.7
- \qmlmethod object QtQuick::Item::mapFromGlobal(real x, real y)
+ \qmlmethod point QtQuick::Item::mapFromGlobal(real x, real y)
Maps the point (\a x, \a y), which is in the global coordinate system, to the
item's coordinate system, and returns a \l point matching the mapped coordinate.
@@ -4710,7 +4710,7 @@ void QQuickItem::mapFromGlobal(QQmlV4Function *args) const
/*!
\since 5.7
- \qmlmethod object QtQuick::Item::mapToGlobal(real x, real y)
+ \qmlmethod point QtQuick::Item::mapToGlobal(real x, real y)
Maps the point (\a x, \a y), which is in this item's coordinate system, to the
global coordinate system, and returns a \l point matching the mapped coordinate.
@@ -7887,10 +7887,26 @@ bool QQuickItem::contains(const QPointF &point) const
\e{item}'s contains method would then return \c true only if
\e{anotherItem}'s contains() implementation returns \c true.
- A \l Shape can be used in this way, to make an item react to
- \l {QPointerEvent}{pointer events} only within a non-rectangular region,
- as illustrated in the \l {Qt Quick Examples - Shapes}{Shapes example}
- (see \c tapableTriangle.qml).
+ A \l Shape can be used as a mask, to make an item react to
+ \l {QPointerEvent}{pointer events} only within a non-rectangular region:
+
+ \table
+ \row
+ \li \image containmentMask-shape.gif
+ \li \snippet qml/item/containmentMask-shape.qml 0
+ \endtable
+
+ It is also possible to define the contains method in QML. For example,
+ to create a circular item that only responds to events within its
+ actual bounds:
+
+ \table
+ \row
+ \li \image containmentMask-circle.gif
+ \li \snippet qml/item/containmentMask-circle-js.qml 0
+ \endtable
+
+ \sa {Qt Quick Examples - Shapes}
*/
/*!
\property QQuickItem::containmentMask
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 010a0152e1..f8ad168a17 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -1785,7 +1785,7 @@ void QQuickItemViewPrivate::refill(qreal from, qreal to)
do {
bufferPause.stop();
- if (currentChanges.hasPendingChanges() || bufferedChanges.hasPendingChanges()) {
+ if (currentChanges.hasPendingChanges() || bufferedChanges.hasPendingChanges() || currentChanges.active) {
currentChanges.reset();
bufferedChanges.reset();
releaseVisibleItems(reusableFlag);
diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp
index b7649c9952..78b379d5a2 100644
--- a/src/quick/items/qquickitemviewtransition.cpp
+++ b/src/quick/items/qquickitemviewtransition.cpp
@@ -125,6 +125,8 @@ void QQuickItemViewTransitionJob::startTransition(QQuickItemViewTransitionableIt
actions << QQuickStateAction(item->item, QLatin1String("x"), QVariant(to.x()));
actions << QQuickStateAction(item->item, QLatin1String("y"), QVariant(to.y()));
+ actions[0].fromValue = item->itemX();
+ actions[1].fromValue = item->itemY();
m_transitioner->runningJobs << this;
QQuickTransitionManager::transition(actions, trans, item->item);
}
@@ -555,9 +557,15 @@ void QQuickItemViewTransitionableItem::stopTransition()
QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent)
- : QObject(parent), m_item(nullptr), m_index(-1)
+ : QObject(parent), m_index(-1)
{
}
+
+QQuickItem *QQuickViewTransitionAttached::item() const
+{
+ return m_item.data();
+}
+
/*!
\qmltype ViewTransition
\instantiates QQuickViewTransitionAttached
diff --git a/src/quick/items/qquickitemviewtransition_p.h b/src/quick/items/qquickitemviewtransition_p.h
index 5f4e74171e..bedef93d0b 100644
--- a/src/quick/items/qquickitemviewtransition_p.h
+++ b/src/quick/items/qquickitemviewtransition_p.h
@@ -202,7 +202,7 @@ public:
QQuickViewTransitionAttached(QObject *parent);
int index() const { return m_index; }
- QQuickItem *item() const { return m_item; }
+ QQuickItem *item() const;
QPointF destination() const { return m_destination; }
QList<int> targetIndexes() const { return m_targetIndexes; }
@@ -224,7 +224,7 @@ private:
QList<int> m_targetIndexes;
QList<QObject *> m_targetItems;
- QQuickItem *m_item;
+ QPointer<QQuickItem> m_item;
int m_index;
};
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index 7fbe66fdda..00ac3de9e7 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -946,7 +946,7 @@ void QQuickLoaderPrivate::_q_updateSize(bool loaderGeometryChanged)
}
/*!
- \qmlproperty object QtQuick::Loader::item
+ \qmlproperty QtObject QtQuick::Loader::item
This property holds the top-level object that is currently loaded.
Since \c {QtQuick 2.0}, Loader can load any object type.
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 6230186933..e823ca1095 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -2168,7 +2168,7 @@ void QQuickText::resetMaximumLineCount()
<img src="" align="top,middle,bottom" width="" height=""> - inline images
<ol type="">, <ul type=""> and <li> - ordered and unordered lists
<pre></pre> - preformatted
- &gt; &lt; &amp;
+ &gt; &lt; &amp; &quot; &nbsp; &apos;
\endcode
\c Text.StyledText parser is strict, requiring tags to be correctly nested.
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index ce32d5aa33..5e3f48584d 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -1708,6 +1708,8 @@ QQuickItem *QQuickWindow::contentItem() const
\brief The item which currently has active focus or \c null if there is
no item with active focus.
+
+ \sa QQuickItem::forceActiveFocus(), {Keyboard Focus in Qt Quick}
*/
QQuickItem *QQuickWindow::activeFocusItem() const
{
@@ -2441,6 +2443,9 @@ void QQuickWindowPrivate::handleMouseEvent(QMouseEvent *event)
Q_QUICK_INPUT_PROFILE(QQuickProfiler::Mouse, QQuickProfiler::InputMouseRelease, event->button(),
event->buttons());
deliverPointerEvent(pointerEventInstance(event));
+#if QT_CONFIG(cursor)
+ updateCursor(event->windowPos());
+#endif
break;
case QEvent::MouseButtonDblClick:
Q_QUICK_INPUT_PROFILE(QQuickProfiler::Mouse, QQuickProfiler::InputMouseDoubleClick,
@@ -2612,7 +2617,9 @@ QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QEvent *event) con
}
Q_ASSERT(dev);
- return pointerEventInstance(dev, event->type())->reset(event);
+ auto pev = pointerEventInstance(dev, event->type());
+ Q_ASSERT(pev);
+ return pev->reset(event);
}
void QQuickWindowPrivate::deliverPointerEvent(QQuickPointerEvent *event)
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index 77bac7c8a5..ea1a1a9b93 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -2215,6 +2215,15 @@ void Renderer::uploadBatch(Batch *b)
*/
int bufferSize = b->vertexCount * g->sizeOfVertex();
int ibufferSize = 0;
+ // At this point, we need to check if the vertices byte size is 4 byte aligned or not.
+ // If an unaligned value is used in a shared buffer with indices, it causes problems with
+ // glDrawElements. We need to do a 4 byte alignment so that it can work with both
+ // QSGGeometry::UnsignedShortType and QSGGeometry::UnsignedIntType
+ int paddingBytes = 0;
+ if (!m_context->separateIndexBuffer()) {
+ paddingBytes = aligned(bufferSize, 4) - bufferSize;
+ bufferSize += paddingBytes;
+ }
if (b->merged) {
ibufferSize = b->indexCount * mergedIndexElemSize();
if (m_useDepthBuffer)
@@ -2239,7 +2248,7 @@ void Renderer::uploadBatch(Batch *b)
char *zData = vertexData + b->vertexCount * g->sizeOfVertex();
char *indexData = separateIndexBuffer
? b->ibo.data
- : zData + (int(m_useDepthBuffer) * b->vertexCount * sizeof(float));
+ : zData + (int(m_useDepthBuffer) * b->vertexCount * sizeof(float)) + paddingBytes;
quint16 iOffset16 = 0;
quint32 iOffset32 = 0;
@@ -2287,7 +2296,7 @@ void Renderer::uploadBatch(Batch *b)
} else {
char *vboData = b->vbo.data;
char *iboData = separateIndexBuffer ? b->ibo.data
- : vboData + b->vertexCount * g->sizeOfVertex();
+ : vboData + b->vertexCount * g->sizeOfVertex() + paddingBytes;
Element *e = b->first;
while (e) {
QSGGeometry *g = e->node->geometry();
@@ -3176,8 +3185,14 @@ void Renderer::renderUnmergedBatch(const Batch *batch) // legacy (GL-only)
int vOffset = 0;
char *iOffset = indexBase;
+ // If a shared buffer is used, 4 byte alignment was done to avoid issues
+ // while using glDrawElements with both QSGGeometry::UnsignedShortType and
+ // QSGGeometry::UnsignedIntType. Here, we need to take this into account
+ // while calculating iOffset value to end up with the correct offset for drawing.
+ int vertexDataByteSize = batch->vertexCount * gn->geometry()->sizeOfVertex();
+ vertexDataByteSize = aligned(vertexDataByteSize, 4);
if (!separateIndexBuffer)
- iOffset += batch->vertexCount * gn->geometry()->sizeOfVertex();
+ iOffset += vertexDataByteSize;
QMatrix4x4 rootMatrix = batch->root ? qsg_matrixForRoot(batch->root) : QMatrix4x4();
diff --git a/src/quick/scenegraph/qsgrhidistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgrhidistancefieldglyphcache.cpp
index eb4db0f85e..2325a2665b 100644
--- a/src/quick/scenegraph/qsgrhidistancefieldglyphcache.cpp
+++ b/src/quick/scenegraph/qsgrhidistancefieldglyphcache.cpp
@@ -446,7 +446,7 @@ bool QSGRhiDistanceFieldGlyphCache::loadPregeneratedCache(const QRawFont &font)
const char *textureRecord = allocatorData;
for (int i = 0; i < textureCount; ++i, textureRecord += Qtdf::TextureRecordSize) {
- if (textureRecord + Qtdf::TextureRecordSize > qtdfTableEnd) {
+ if (qtdfTableEnd - textureRecord < Qtdf::TextureRecordSize) {
qWarning("qtdf table too small in font '%s'.",
qPrintable(font.familyName()));
return false;
@@ -462,7 +462,7 @@ bool QSGRhiDistanceFieldGlyphCache::loadPregeneratedCache(const QRawFont &font)
const char *glyphRecord = textureRecord;
for (quint32 i = 0; i < glyphCount; ++i, glyphRecord += Qtdf::GlyphRecordSize) {
- if (glyphRecord + Qtdf::GlyphRecordSize > qtdfTableEnd) {
+ if (qtdfTableEnd - glyphRecord < Qtdf:: GlyphRecordSize) {
qWarning("qtdf table too small in font '%s'.",
qPrintable(font.familyName()));
return false;
@@ -512,8 +512,8 @@ bool QSGRhiDistanceFieldGlyphCache::loadPregeneratedCache(const QRawFont &font)
int width = texInfo->allocatedArea.width();
int height = texInfo->allocatedArea.height();
- qint64 size = width * height;
- if (reinterpret_cast<const char *>(textureData + size) > qtdfTableEnd) {
+ qint64 size = qint64(width) * height;
+ if (qtdfTableEnd - reinterpret_cast<const char *>(textureData) < size) {
qWarning("qtdf table too small in font '%s'.",
qPrintable(font.familyName()));
return false;
diff --git a/src/quick/scenegraph/shaders_ng/24bittextmask.frag.qsb b/src/quick/scenegraph/shaders_ng/24bittextmask.frag.qsb
index c493996375..6eee3f01d6 100644
--- a/src/quick/scenegraph/shaders_ng/24bittextmask.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/24bittextmask.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/32bitcolortext.frag.qsb b/src/quick/scenegraph/shaders_ng/32bitcolortext.frag.qsb
index 3f8489bfe6..d81bb2f26d 100644
--- a/src/quick/scenegraph/shaders_ng/32bitcolortext.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/32bitcolortext.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/8bittextmask.frag.qsb b/src/quick/scenegraph/shaders_ng/8bittextmask.frag.qsb
index f721207325..6ebb3342ac 100644
--- a/src/quick/scenegraph/shaders_ng/8bittextmask.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/8bittextmask.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/8bittextmask_a.frag.qsb b/src/quick/scenegraph/shaders_ng/8bittextmask_a.frag.qsb
index 93ac0124be..e29f734c33 100644
--- a/src/quick/scenegraph/shaders_ng/8bittextmask_a.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/8bittextmask_a.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsb b/src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsb
index 1756ee9d4b..071abd2f88 100644
--- a/src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext.vert.qsb b/src/quick/scenegraph/shaders_ng/outlinedtext.vert.qsb
index b8d38bdff4..dd159d008d 100644
--- a/src/quick/scenegraph/shaders_ng/outlinedtext.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/outlinedtext.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsb
index f44b92dc28..393b1608e9 100644
--- a/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/styledtext.frag.qsb b/src/quick/scenegraph/shaders_ng/styledtext.frag.qsb
index b0461a686c..5b45142201 100644
--- a/src/quick/scenegraph/shaders_ng/styledtext.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/styledtext.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/styledtext.vert.qsb b/src/quick/scenegraph/shaders_ng/styledtext.vert.qsb
index 18e4685d21..e2a5859bfc 100644
--- a/src/quick/scenegraph/shaders_ng/styledtext.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/styledtext.vert.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/styledtext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/styledtext_a.frag.qsb
index 3d9b5a0bdd..c3aa6c068a 100644
--- a/src/quick/scenegraph/shaders_ng/styledtext_a.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/styledtext_a.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/textmask.frag.qsb b/src/quick/scenegraph/shaders_ng/textmask.frag.qsb
index cfae9575da..a4341d8915 100644
--- a/src/quick/scenegraph/shaders_ng/textmask.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/textmask.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/textmask.vert.qsb b/src/quick/scenegraph/shaders_ng/textmask.vert.qsb
index 2ea425e1c0..4ca3b874d0 100644
--- a/src/quick/scenegraph/shaders_ng/textmask.vert.qsb
+++ b/src/quick/scenegraph/shaders_ng/textmask.vert.qsb
Binary files differ
diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp
index 2ae8a5a2aa..f027e9fafe 100644
--- a/src/quick/util/qquickanimatorjob.cpp
+++ b/src/quick/util/qquickanimatorjob.cpp
@@ -285,6 +285,17 @@ qreal QQuickAnimatorJob::progress(int time) const
return m_easing.valueForProgress((m_duration == 0) ? qreal(1) : qreal(time) / qreal(m_duration));
}
+void QQuickAnimatorJob::boundValue()
+{
+ qreal rangeMin = m_from;
+ qreal rangeMax = m_to;
+ if (m_from > m_to) {
+ rangeMax = m_from;
+ rangeMin = m_to;
+ }
+ m_value = qBound(rangeMin, m_value, rangeMax);
+}
+
qreal QQuickAnimatorJob::value() const
{
qreal value = m_to;
diff --git a/src/quick/util/qquickanimatorjob_p.h b/src/quick/util/qquickanimatorjob_p.h
index 522540bcbc..a31cd08032 100644
--- a/src/quick/util/qquickanimatorjob_p.h
+++ b/src/quick/util/qquickanimatorjob_p.h
@@ -122,10 +122,16 @@ public:
virtual void setTarget(QQuickItem *target);
QQuickItem *target() const { return m_target; }
- void setFrom(qreal from) { m_from = from; }
+ void setFrom(qreal from) {
+ m_from = from;
+ boundValue();
+ }
qreal from() const { return m_from; }
- void setTo(qreal to) { m_to = to; }
+ void setTo(qreal to) {
+ m_to = to;
+ boundValue();
+ }
qreal to() const { return m_to; }
void setDuration(int duration) { m_duration = duration; }
@@ -171,6 +177,7 @@ protected:
void debugAnimation(QDebug d) const override;
qreal progress(int time) const;
+ void boundValue();
QPointer<QQuickItem> m_target;
QQuickAnimatorController *m_controller;
diff --git a/src/quick/util/qquickstategroup.cpp b/src/quick/util/qquickstategroup.cpp
index 2109aafc10..7cb3138618 100644
--- a/src/quick/util/qquickstategroup.cpp
+++ b/src/quick/util/qquickstategroup.cpp
@@ -376,7 +376,14 @@ bool QQuickStateGroupPrivate::updateAutoState()
QQuickState *state = states.at(ii);
if (state->isWhenKnown()) {
if (state->isNamed()) {
- if (state->when()) {
+ bool whenValue = state->when();
+ const QQmlProperty whenProp(state, QLatin1String("when"));
+ const auto potentialWhenBinding = QQmlPropertyPrivate::binding(whenProp);
+ // if there is a binding, the value in when might not be up-to-date at this point
+ // so we manually reevaluate the binding
+ if (auto abstractBinding = dynamic_cast<QQmlBinding *>(potentialWhenBinding))
+ whenValue = abstractBinding->evaluate().toBool();
+ if (whenValue) {
if (stateChangeDebug())
qWarning() << "Setting auto state due to expression";
if (currentState != state->name()) {
diff --git a/src/quick/util/qquickstyledtext.cpp b/src/quick/util/qquickstyledtext.cpp
index d531fc9205..a25af90414 100644
--- a/src/quick/util/qquickstyledtext.cpp
+++ b/src/quick/util/qquickstyledtext.cpp
@@ -564,6 +564,8 @@ void QQuickStyledTextPrivate::parseEntity(const QChar *&ch, const QString &textI
textOut += QChar(60);
else if (entity == QLatin1String("amp"))
textOut += QChar(38);
+ else if (entity == QLatin1String("apos"))
+ textOut += QChar(39);
else if (entity == QLatin1String("quot"))
textOut += QChar(34);
else if (entity == QLatin1String("nbsp"))
diff --git a/tests/auto/cmake/qtquickcompiler/main.cpp b/tests/auto/cmake/qtquickcompiler/main.cpp
index c357ef60e6..680f81755d 100644
--- a/tests/auto/cmake/qtquickcompiler/main.cpp
+++ b/tests/auto/cmake/qtquickcompiler/main.cpp
@@ -13,7 +13,7 @@ private slots:
void tst_QQC::packaging()
{
QVERIFY(QFile::exists(":/main.qml"));
- QCOMPARE(QFileInfo(":/main.qml").size(), 0);
+ QVERIFY(QFileInfo(":/main.qml").size() > 0);
QVERIFY(QFile::exists(":/main.cpp"));
QVERIFY(QFileInfo(":/main.cpp").size() > 0);
diff --git a/tests/auto/qml/animation/qpauseanimationjob/BLACKLIST b/tests/auto/qml/animation/qpauseanimationjob/BLACKLIST
new file mode 100644
index 0000000000..33799b6528
--- /dev/null
+++ b/tests/auto/qml/animation/qpauseanimationjob/BLACKLIST
@@ -0,0 +1,3 @@
+[multipleSequentialGroups]
+macos ci
+
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 3b7d74df63..b75bf820d5 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -102,6 +102,7 @@ private slots:
void valueConversion_RegularExpression();
void castWithMultipleInheritance();
void collectGarbage();
+ void collectGarbageNestedWrappersTwoEngines();
void gcWithNestedDataStructure();
void stacktrace();
void numberParsing_data();
@@ -1809,6 +1810,44 @@ void tst_QJSEngine::collectGarbage()
QVERIFY(ptr.isNull());
}
+class TestObjectContainer : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject *dummy MEMBER m_dummy CONSTANT)
+
+public:
+ TestObjectContainer() : m_dummy(new QObject(this)) {}
+
+private:
+ QObject *m_dummy;
+};
+
+void tst_QJSEngine::collectGarbageNestedWrappersTwoEngines()
+{
+ QJSEngine engine1;
+ QJSEngine engine2;
+
+ TestObjectContainer container;
+ QQmlEngine::setObjectOwnership(&container, QQmlEngine::CppOwnership);
+
+ engine1.globalObject().setProperty("foobar", engine1.newQObject(&container));
+ engine2.globalObject().setProperty("foobar", engine2.newQObject(&container));
+
+ engine1.evaluate("foobar.dummy.baz = 42");
+ engine2.evaluate("foobar.dummy.baz = 43");
+
+ QCOMPARE(engine1.evaluate("foobar.dummy.baz").toInt(), 42);
+ QCOMPARE(engine2.evaluate("foobar.dummy.baz").toInt(), 43);
+
+ engine1.collectGarbage();
+ engine2.collectGarbage();
+
+ // The GC should not collect dummy object wrappers neither in engine1 nor engine2, we
+ // verify that by checking whether the baz property still has its previous value.
+ QCOMPARE(engine1.evaluate("foobar.dummy.baz").toInt(), 42);
+ QCOMPARE(engine2.evaluate("foobar.dummy.baz").toInt(), 43);
+}
+
void tst_QJSEngine::gcWithNestedDataStructure()
{
// The GC must be able to traverse deeply nested objects, otherwise this
diff --git a/tests/auto/qml/qqmlconsole/data/assert.qml b/tests/auto/qml/qqmlconsole/data/assert.qml
index dd580e2a72..9687437c48 100644
--- a/tests/auto/qml/qqmlconsole/data/assert.qml
+++ b/tests/auto/qml/qqmlconsole/data/assert.qml
@@ -29,21 +29,22 @@
import QtQuick 2.0
QtObject {
- property int q:1
+ property int q: 1
+
function assertFail() {
- console.assert(0, "This will fail too")
+ console.assert(0, "This will fail too");
}
Component.onCompleted: {
- var x = 12;
+ const x = 12;
console.assert(x == 12, "This will pass");
try {
- console.assert(x < 12, "This will fail");
+ console.assert(x < 12, "This will fail");
} catch (e) {
console.log(e);
}
- console.assert("x < 12", "This will pass too")
+ console.assert("x < 12", "This will pass too");
assertFail();
- console.assert(1)
+ console.assert(1);
}
}
diff --git a/tests/auto/qml/qqmlconsole/data/categorized_logging.qml b/tests/auto/qml/qqmlconsole/data/categorized_logging.qml
index d593f0dfa1..6d471e7f80 100644
--- a/tests/auto/qml/qqmlconsole/data/categorized_logging.qml
+++ b/tests/auto/qml/qqmlconsole/data/categorized_logging.qml
@@ -40,7 +40,7 @@
import QtQuick 2.12
Item {
- id:root
+ id: root
LoggingCategory {
id: testCategory
@@ -69,8 +69,11 @@ Item {
console.warn(testCategoryStartingFromWarning, "console.warn");
console.error(testCategoryStartingFromWarning, "console.error");
- testCategory.name = "qt.test2";
- testCategory.defaultLogLevel = LoggingCategory.Debug;
+ testCategory.name = "qt.test"; // should be silent
+ testCategoryStartingFromWarning.name = "qt.test.other"; // should issue a warning
+
+ testCategory.defaultLogLevel = LoggingCategory.Debug; // should be silent
+ testCategoryStartingFromWarning.defaultLogLevel = LoggingCategory.Debug; // should issue a warning
console.error(emptyCategory, "console.error");
}
diff --git a/tests/auto/qml/qqmlconsole/data/exception.qml b/tests/auto/qml/qqmlconsole/data/exception.qml
index 63afd18828..b9b83525e8 100644
--- a/tests/auto/qml/qqmlconsole/data/exception.qml
+++ b/tests/auto/qml/qqmlconsole/data/exception.qml
@@ -30,12 +30,12 @@ import QtQuick 2.0
QtObject {
function exceptionFail() {
- console.exception("Exception 2")
+ console.exception("Exception 2");
}
Component.onCompleted: {
try {
- console.exception("Exception 1")
+ console.exception("Exception 1");
} catch (e) {
console.log(e);
}
diff --git a/tests/auto/qml/qqmlconsole/data/logging.qml b/tests/auto/qml/qqmlconsole/data/logging.qml
index f5eaeb442a..ac3884bc8e 100644
--- a/tests/auto/qml/qqmlconsole/data/logging.qml
+++ b/tests/auto/qml/qqmlconsole/data/logging.qml
@@ -30,7 +30,8 @@
import QtQuick 2.0
QtObject {
- id:root
+ id: root
+
required property var customObject
required property var stringListProperty
@@ -49,14 +50,14 @@ QtObject {
consoleCount();
consoleCount();
- var a = [1, 2];
- var b = {a: "hello", d: 1 };
- b.toString = function() { return JSON.stringify(b) }
- var c
- var d = 12;
- var e = function() { return 5;};
- var f = true;
- var g = {toString: function() { throw new Error('toString'); }};
+ const a = [1, 2];
+ const b = { a: "hello", d: 1 };
+ b.toString = function() { return JSON.stringify(b); }
+ let c;
+ const d = 12;
+ const e = function() { return 5; };
+ const f = true;
+ const g = { toString: function() { throw new Error('toString'); } };
console.log(a);
console.log(b);
@@ -79,6 +80,6 @@ QtObject {
return;
}
- throw ("console.log(exception) should have raised an exception");
+ throw "console.log(exception) should have raised an exception";
}
}
diff --git a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp
index 48613d04f1..3a25dfb10d 100644
--- a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp
+++ b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp
@@ -134,18 +134,27 @@ void tst_qqmlconsole::categorized_logging()
QVERIFY(messageHandler.messages().contains("qt.test.warning: console.error"));
QString emptyCategory = "default: " + QString::fromLatin1("%1:%2:%3: ").arg(testUrl.toString()).arg(56).arg(5) +
- "QML LoggingCategory: Declaring the name of the LoggingCategory is mandatory and cannot be changed later !";
+ "QML LoggingCategory: Declaring the name of a LoggingCategory is mandatory and cannot be changed later";
QVERIFY(messageHandler.messages().contains(emptyCategory));
- QString changedCategory = "default: " + QString::fromLatin1("%1:%2:%3: ").arg(testUrl.toString()).arg(45).arg(5) +
- "QML LoggingCategory: The name of a LoggingCategory cannot be changed after the Item is created";
+
+ QString notChangedCategory = "default: " + QString::fromLatin1("%1:%2:%3: ").arg(testUrl.toString()).arg(45).arg(5) +
+ "QML LoggingCategory: The name of a LoggingCategory cannot be changed after the component is completed";
+ QVERIFY(!messageHandler.messages().contains(notChangedCategory));
+ QString changedCategory = "default: " + QString::fromLatin1("%1:%2:%3: ").arg(testUrl.toString()).arg(50).arg(5) +
+ "QML LoggingCategory: The name of a LoggingCategory cannot be changed after the component is completed";
QVERIFY(messageHandler.messages().contains(changedCategory));
- QString changedDefaultLogLevel = "default: " + QString::fromLatin1("%1:%2:%3: ").arg(testUrl.toString()).arg(45).arg(5) +
- "QML LoggingCategory: The defaultLogLevel of a LoggingCategory cannot be changed after the Item is created";
+
+ QString notChangedDefaultLogLevel = "default: " + QString::fromLatin1("%1:%2:%3: ").arg(testUrl.toString()).arg(45).arg(5) +
+ "QML LoggingCategory: The defaultLogLevel of a LoggingCategory cannot be changed after the component is completed";
+ QVERIFY(!messageHandler.messages().contains(notChangedDefaultLogLevel));
+ QString changedDefaultLogLevel = "default: " + QString::fromLatin1("%1:%2:%3: ").arg(testUrl.toString()).arg(50).arg(5) +
+ "QML LoggingCategory: The defaultLogLevel of a LoggingCategory cannot be changed after the component is completed";
QVERIFY(messageHandler.messages().contains(changedDefaultLogLevel));
- QString useEmptyCategory = "default: " + QString::fromLatin1("%1:%2: ").arg(testUrl.toString()).arg(75) +
+
+ QString useEmptyCategory = "default: " + QString::fromLatin1("%1:%2: ").arg(testUrl.toString()).arg(78) +
"Error: A QmlLoggingCatgory was provided without a valid name";
QVERIFY(messageHandler.messages().contains(useEmptyCategory));
@@ -188,11 +197,11 @@ void tst_qqmlconsole::testAssert()
// assert()
QString assert1 = "This will fail\n" +
- QString::fromLatin1("onCompleted (%1:%2)").arg(testUrl.toString()).arg(41);
+ QString::fromLatin1("onCompleted (%1:%2)").arg(testUrl.toString()).arg(42);
QString assert2 = "This will fail too\n" +
- QString::fromLatin1("assertFail (%1:%2)\n").arg(testUrl.toString()).arg(34) +
- QString::fromLatin1("onCompleted (%1:%2)").arg(testUrl.toString()).arg(46);
+ QString::fromLatin1("assertFail (%1:%2)\n").arg(testUrl.toString()).arg(35) +
+ QString::fromLatin1("onCompleted (%1:%2)").arg(testUrl.toString()).arg(47);
QTest::ignoreMessage(QtCriticalMsg, qPrintable(assert1));
QTest::ignoreMessage(QtCriticalMsg, qPrintable(assert2));
diff --git a/tests/auto/qml/qqmlinstantiator/data/activeModelChangeInteraction.qml b/tests/auto/qml/qqmlinstantiator/data/activeModelChangeInteraction.qml
new file mode 100644
index 0000000000..2797566ad2
--- /dev/null
+++ b/tests/auto/qml/qqmlinstantiator/data/activeModelChangeInteraction.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.15
+import QtQml.Models 2.15
+
+Item {
+ id: root
+ property int instanceCount: 0
+ property alias active: instantiator.active
+
+ ListModel {
+ id: listmodel
+
+ dynamicRoles: true
+ }
+
+ Component.onCompleted: {
+ listmodel.insert(listmodel.count, {name: "one"})
+ listmodel.insert(listmodel.count, {name: "two"})
+ listmodel.insert(listmodel.count, {name: "three"})
+ }
+
+ Instantiator {
+ id: instantiator
+
+ active: false
+
+ model: listmodel
+
+ delegate: Text {
+ width: 100
+ height: 20
+
+ text: name
+
+ Component.onCompleted: ++root.instanceCount
+ }
+
+ }
+}
+
diff --git a/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp
index 84e08c471a..d5587432de 100644
--- a/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp
+++ b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp
@@ -47,6 +47,7 @@ private slots:
void createMultiple();
void stringModel();
void activeProperty();
+ void activeModelChangeInteraction();
void intModelChange();
void createAndRemove();
@@ -153,6 +154,26 @@ void tst_qqmlinstantiator::activeProperty()
QCOMPARE(object->property("idx").toInt(), 0);
}
+void tst_qqmlinstantiator::activeModelChangeInteraction()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("activeModelChangeInteraction.qml"));
+ QScopedPointer<QObject> root(component.create());
+ QVERIFY(root);
+
+ // If the instantiator is inactive, a model change does not lead to items being loaded
+ bool ok = false;
+ int count = root->property("instanceCount").toInt(&ok);
+ QVERIFY(ok);
+ QCOMPARE(count, 0);
+
+ // When turning the instantiator active, it will however reflect the model
+ root->setProperty("active", true);
+ count = root->property("instanceCount").toInt(&ok);
+ QVERIFY(ok);
+ QCOMPARE(count, 3);
+}
+
void tst_qqmlinstantiator::intModelChange()
{
QQmlEngine engine;
diff --git a/tests/auto/qml/qv4mm/tst_qv4mm.cpp b/tests/auto/qml/qv4mm/tst_qv4mm.cpp
index 5d635aa63b..824fd89e5b 100644
--- a/tests/auto/qml/qv4mm/tst_qv4mm.cpp
+++ b/tests/auto/qml/qv4mm/tst_qv4mm.cpp
@@ -76,10 +76,10 @@ void tst_qv4mm::multiWrappedQObjects()
QCOMPARE(engine1.memoryManager->m_pendingFreedObjectWrapperValue.size(), 1);
QCOMPARE(engine2.memoryManager->m_pendingFreedObjectWrapperValue.size(), 0);
- // Moves the additional WeakValue from m_multiplyWrappedQObjects to
- // m_pendingFreedObjectWrapperValue. It's still alive after all.
+ // The additional WeakValue from m_multiplyWrappedQObjects hasn't been moved
+ // to m_pendingFreedObjectWrapperValue yet. It's still alive after all.
engine1.memoryManager->runGC();
- QCOMPARE(engine1.memoryManager->m_pendingFreedObjectWrapperValue.size(), 2);
+ QCOMPARE(engine1.memoryManager->m_pendingFreedObjectWrapperValue.size(), 1);
// engine2 doesn't own the object as engine1 was the first to wrap it above.
// Therefore, no effect here.
diff --git a/tests/auto/quick/pointerhandlers/qquickdraghandler/data/dragMargin.qml b/tests/auto/quick/pointerhandlers/qquickdraghandler/data/dragMargin.qml
index e5ca681bd5..60ea740105 100644
--- a/tests/auto/quick/pointerhandlers/qquickdraghandler/data/dragMargin.qml
+++ b/tests/auto/quick/pointerhandlers/qquickdraghandler/data/dragMargin.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.12
+import QtQuick 2.15
Rectangle {
color: "#333"
@@ -13,6 +13,7 @@ Rectangle {
DragHandler {
id: dragHandler
margin: 20
+ cursorShape: Qt.ClosedHandCursor
}
Rectangle {
diff --git a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp
index f71febbaf9..40b138bc70 100644
--- a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp
@@ -411,6 +411,9 @@ void tst_DragHandler::dragFromMargin() // QTBUG-74966
QVERIFY(!dragHandler->active());
QCOMPARE(dragHandler->centroid().scenePosition(), scenePressPos);
QCOMPARE(dragHandler->centroid().scenePressPosition(), scenePressPos);
+#if QT_CONFIG(cursor)
+ QCOMPARE(window->cursor().shape(), Qt::ArrowCursor);
+#endif
p1 += QPoint(dragThreshold * 2, 0);
QTest::mouseMove(window, p1);
QTRY_VERIFY(dragHandler->active());
@@ -419,9 +422,18 @@ void tst_DragHandler::dragFromMargin() // QTBUG-74966
QCOMPARE(dragHandler->translation().x(), 0.0); // hmm that's odd
QCOMPARE(dragHandler->translation().y(), 0.0);
QCOMPARE(draggableItem->position(), originalPos + QPointF(dragThreshold * 2, 0));
+#if QT_CONFIG(cursor)
+ // The cursor doesn't change until the next event after the handler becomes active.
+ p1 += QPoint(1, 0);
+ QTest::mouseMove(window, p1);
+ QTRY_COMPARE(window->cursor().shape(), Qt::ClosedHandCursor);
+#endif
QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1);
QTRY_VERIFY(!dragHandler->active());
QCOMPARE(dragHandler->centroid().pressedButtons(), Qt::NoButton);
+#if QT_CONFIG(cursor)
+ QTRY_COMPARE(window->cursor().shape(), Qt::ArrowCursor);
+#endif
}
void tst_DragHandler::snapMode_data()
diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
index 0e6c3b3ad9..30d57b9c9a 100644
--- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
+++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
@@ -383,6 +383,7 @@ void tst_QQuickAccessible::basicPropertiesTest()
QCOMPARE(item->indexOfChild(text2), 1);
QCOMPARE(text2->state().editable, 0u);
QCOMPARE(text2->state().readOnly, 1);
+ QCOMPARE(text2->state().focusable, 1);
QCOMPARE(iface->indexOfChild(text2), -1);
QCOMPARE(text2->indexOfChild(item), -1);
diff --git a/tests/auto/quick/qquickdroparea/BLACKLIST b/tests/auto/quick/qquickdroparea/BLACKLIST
new file mode 100644
index 0000000000..0967969b04
--- /dev/null
+++ b/tests/auto/quick/qquickdroparea/BLACKLIST
@@ -0,0 +1,4 @@
+# Blacklist for testing
+# QTBUG-99765
+[containsDrag_internal]
+ubuntu-20.04
diff --git a/tests/auto/quick/qquickframebufferobject/BLACKLIST b/tests/auto/quick/qquickframebufferobject/BLACKLIST
index 93dd7e9d1c..cf30c293dd 100644
--- a/tests/auto/quick/qquickframebufferobject/BLACKLIST
+++ b/tests/auto/quick/qquickframebufferobject/BLACKLIST
@@ -1,3 +1,4 @@
+[testInvalidate)
# QTBUG-65614
b2qt
[testThatStuffWorks]
diff --git a/tests/auto/quick/qquickgridview/data/qtbug92998.qml b/tests/auto/quick/qquickgridview/data/qtbug92998.qml
new file mode 100644
index 0000000000..204e6d0b87
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/qtbug92998.qml
@@ -0,0 +1,52 @@
+import QtQuick 2.0
+
+Item {
+ width: 450
+ height: 650
+ GridView {
+ objectName: "gridview"
+ id: gridView
+ width: 450
+ height: 650
+ layoutDirection: Qt.RightToLeft
+ property int cells: calcCells(width)
+ cellWidth: width / cells
+ cellHeight: cellWidth
+
+ delegate: Component {
+ Item {
+ width: gridView.cellWidth
+ height: gridView.cellHeight
+ Rectangle {
+ anchors {
+ fill: parent
+ margins: 10
+ }
+ color: "green"
+ }
+ }
+ }
+ model: [
+ { number: "1" },
+ { number: "2" },
+ { number: "3" },
+ { number: "4" },
+ { number: "5" },
+ { number: "6" },
+ { number: "7" },
+ { number: "8" },
+ { number: "9" },
+ { number: "10" },
+ { number: "11" },
+ { number: "12" },
+ { number: "13" },
+ { number: "14" },
+ { number: "15" },
+ { number: "16" }];
+ function calcCells(w) {
+ var rw = 120;
+ var c = Math.max(1, Math.round(w / rw));
+ return c;
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 46e3457d6e..94ec4f44d5 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -215,6 +215,7 @@ private slots:
void QTBUG_48870_fastModelUpdates();
void keyNavigationEnabled();
+ void resizeDynamicCellWidthRtL();
void releaseItems();
private:
@@ -6795,6 +6796,24 @@ void tst_QQuickGridView::QTBUG_48870_fastModelUpdates()
}
}
+void tst_QQuickGridView::resizeDynamicCellWidthRtL()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("qtbug92998.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "gridview");
+ QTRY_VERIFY(gridview != nullptr);
+ QVERIFY(QQuickTest::qWaitForItemPolished(gridview));
+ gridview->setWidth(460);
+ QVERIFY(QQuickTest::qWaitForItemPolished(gridview));
+ QTRY_COMPARE(gridview->contentX(), 0.f);
+ gridview->setWidth(360);
+ QVERIFY(QQuickTest::qWaitForItemPolished(gridview));
+ QTRY_COMPARE(gridview->contentX(), 0.f);
+}
+
void tst_QQuickGridView::releaseItems()
{
QScopedPointer<QQuickView> view(createView());
diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
index 9dc9ad53ea..cb9e8d1ce2 100644
--- a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
+++ b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
@@ -72,7 +72,7 @@ private slots:
private:
QString newImageFileName() const;
- void fillRequestTestsData(const QString &id);
+ void fillRequestTestsData(const char *id);
void runTest(bool async, QQuickImageProvider *provider);
};
@@ -161,7 +161,7 @@ QString tst_qquickimageprovider::newImageFileName() const
return QString("image://test/image-%1.png").arg(count++);
}
-void tst_qquickimageprovider::fillRequestTestsData(const QString &id)
+void tst_qquickimageprovider::fillRequestTestsData(const char *id)
{
QTest::addColumn<QString>("source");
QTest::addColumn<QString>("imageId");
@@ -170,39 +170,39 @@ void tst_qquickimageprovider::fillRequestTestsData(const QString &id)
QTest::addColumn<QString>("error");
QString fileName = newImageFileName();
- QTest::newRow(QTest::toString(id + " simple test"))
+ QTest::addRow("%s simple test", id)
<< "image://test/" + fileName << fileName << "" << QSize(100,100) << "";
fileName = newImageFileName();
- QTest::newRow(QTest::toString(id + " simple test with capitalization"))//As it's a URL, should make no difference
+ QTest::addRow("%s simple test with capitalization", id)//As it's a URL, should make no difference
<< "image://Test/" + fileName << fileName << "" << QSize(100,100) << "";
fileName = newImageFileName();
- QTest::newRow(QTest::toString(id + " url with no id"))
+ QTest::addRow("%s url with no id", id)
<< "image://test/" + fileName << "" + fileName << "" << QSize(100,100) << "";
fileName = newImageFileName();
- QTest::newRow(QTest::toString(id + " url with path"))
+ QTest::addRow("%s url with path", id)
<< "image://test/test/path" + fileName << "test/path" + fileName << "" << QSize(100,100) << "";
fileName = newImageFileName();
- QTest::newRow(QTest::toString(id + " url with fragment"))
+ QTest::addRow("%s url with fragment", id)
<< "image://test/faq.html?#question13" + fileName << "faq.html?#question13" + fileName << "" << QSize(100,100) << "";
fileName = newImageFileName();
- QTest::newRow(QTest::toString(id + " url with query"))
+ QTest::addRow("%s url with query", id)
<< "image://test/cgi-bin/drawgraph.cgi?type=pie&color=green" + fileName << "cgi-bin/drawgraph.cgi?type=pie&color=green" + fileName
<< "" << QSize(100,100) << "";
fileName = newImageFileName();
- QTest::newRow(QTest::toString(id + " scaled image"))
+ QTest::addRow("%s scaled image", id)
<< "image://test/" + fileName << fileName << "sourceSize: \"80x30\"" << QSize(80,30) << "";
- QTest::newRow(QTest::toString(id + " missing"))
+ QTest::addRow("%s missing", id)
<< "image://test/no-such-file.png" << "no-such-file.png" << "" << QSize(100,100)
<< "<Unknown File>:2:1: QML Image: Failed to get image from provider: image://test/no-such-file.png";
- QTest::newRow(QTest::toString(id + " unknown provider"))
+ QTest::addRow("%s unknown provider", id)
<< "image://bogus/exists.png" << "" << "" << QSize()
<< "<Unknown File>:2:1: QML Image: Invalid image provider: image://bogus/exists.png";
}
diff --git a/tests/auto/quick/qquicklistview/BLACKLIST b/tests/auto/quick/qquicklistview/BLACKLIST
index 6ef69550a4..cba2e8d752 100644
--- a/tests/auto/quick/qquicklistview/BLACKLIST
+++ b/tests/auto/quick/qquicklistview/BLACKLIST
@@ -9,6 +9,8 @@ macos
#QTBUG-75960
#QTBUG-76652
[currentIndex]
+# QTBUG-101498
+ubuntu-20
macos
opensuse-leap
ubuntu-18.04
diff --git a/tests/auto/quick/qquicklistview/data/qtbug_92809.qml b/tests/auto/quick/qquicklistview/data/qtbug_92809.qml
new file mode 100644
index 0000000000..c0b7ac546b
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/qtbug_92809.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, 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.15
+import QtQml.Models 2.12
+
+Rectangle {
+ id: root
+ width: 800
+ height: 480
+
+ property list<QtObject> myModel: [
+ QtObject { property string name: "Item 0"; property bool selected: true },
+ QtObject { property string name: "Item 1"; property bool selected: true },
+ QtObject { property string name: "Item 2"; property bool selected: true },
+ QtObject { property string name: "Item 3"; property bool selected: true },
+ QtObject { property string name: "Item 4"; property bool selected: true },
+ QtObject { property string name: "Item 5"; property bool selected: true },
+ QtObject { property string name: "Item 6"; property bool selected: true },
+ QtObject { property string name: "Item 7"; property bool selected: true },
+ QtObject { property string name: "Item 8"; property bool selected: true },
+ QtObject { property string name: "Item 9"; property bool selected: true },
+ QtObject { property string name: "Press Enter here"; property bool selected: true }
+ ]
+
+ DelegateModel {
+ objectName: "model"
+ id: visualModel
+ model: myModel
+ filterOnGroup: "selected"
+
+ groups: [
+ DelegateModelGroup {
+ name: "selected"
+ includeByDefault: true
+ }
+ ]
+
+ delegate: Rectangle {
+ width: 180
+ height: 180
+ visible: DelegateModel.inSelected
+ color: ListView.isCurrentItem ? "orange" : "yellow"
+ Component.onCompleted: {
+ DelegateModel.inPersistedItems = true
+ DelegateModel.inSelected = Qt.binding(function() { return model.selected })
+ }
+ }
+ }
+
+ ListView {
+ objectName: "list"
+ anchors.fill: parent
+ spacing: 180/15
+ orientation: ListView.Horizontal
+ model: visualModel
+ focus: true
+ currentIndex: 0
+ preferredHighlightBegin: (width-180)/2
+ preferredHighlightEnd: (width+180)/2
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ highlightMoveDuration: 300
+ highlightMoveVelocity: -1
+ cacheBuffer: 0
+
+ onCurrentIndexChanged: {
+ if (currentIndex === 10) {
+ myModel[6].selected = !myModel[6].selected
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/singletonModelLifetime.qml b/tests/auto/quick/qquicklistview/data/singletonModelLifetime.qml
new file mode 100644
index 0000000000..f230786723
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/singletonModelLifetime.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.15
+import QtQuick.Window 2.15
+import test 1.0
+
+Window {
+ id: root
+ visible: true
+ width: 800
+ height: 680
+ property bool alive: false
+
+ Component {
+ id: view
+ ListView {
+ model: SingletonModel
+ }
+ }
+ function compare(a,b) {
+ root.alive = (a === b)
+ }
+
+ function test_singletonModelCrash() {
+ SingletonModel.objectName = "model"
+ var o = view.createObject(root)
+ o.destroy()
+ Qt.callLater(function() {
+ compare(SingletonModel.objectName, "model")
+ })
+ }
+
+ Component.onCompleted: root.test_singletonModelCrash()
+}
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index d3deb513d0..57d7dddf20 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -33,6 +33,8 @@
#include <QtGui/QStyleHints>
#include <QtQuick/qquickview.h>
#include <QtQuickTest/QtQuickTest>
+#include <QStringListModel>
+#include <QQmlApplicationEngine>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcontext.h>
#include <QtQml/qqmlexpression.h>
@@ -302,6 +304,10 @@ private slots:
void dragDelegateWithMouseArea();
void dragDelegateWithMouseArea_data();
+
+ void singletonModelLifetime();
+ void QTBUG_92809();
+
private:
template <class T> void items(const QUrl &source);
template <class T> void changed(const QUrl &source);
@@ -10200,6 +10206,50 @@ void tst_QQuickListView::dragDelegateWithMouseArea_data()
}
}
+class SingletonModel : public QStringListModel
+{
+ Q_OBJECT
+public:
+ SingletonModel(QObject* parent = nullptr) : QStringListModel(parent) { }
+};
+
+void tst_QQuickListView::singletonModelLifetime()
+{
+ // this does not really test any functionality of listview, but we do not have a good way
+ // to unit test QQmlAdaptorModel in isolation.
+ qmlRegisterSingletonType<SingletonModel>("test", 1, 0, "SingletonModel",
+ [](QQmlEngine* , QJSEngine*) -> QObject* { return new SingletonModel; });
+
+ QQmlApplicationEngine engine(testFile("singletonModelLifetime.qml"));
+ // needs event loop iteration for callLater to execute
+ QTRY_VERIFY(engine.rootObjects().first()->property("alive").toBool());
+}
+
+void tst_QQuickListView::QTBUG_92809()
+{
+ QScopedPointer<QQuickView> window(createView());
+ QTRY_VERIFY(window);
+ window->setSource(testFileUrl("qtbug_92809.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != nullptr);
+ QVERIFY(QQuickTest::qWaitForItemPolished(listview));
+ listview->setCurrentIndex(1);
+ QVERIFY(QQuickTest::qWaitForItemPolished(listview));
+ listview->setCurrentIndex(2);
+ QVERIFY(QQuickTest::qWaitForItemPolished(listview));
+ listview->setCurrentIndex(3);
+ QVERIFY(QQuickTest::qWaitForItemPolished(listview));
+ QTest::qWait(500);
+ listview->setCurrentIndex(10);
+ QVERIFY(QQuickTest::qWaitForItemPolished(listview));
+ QTest::qWait(500);
+ int currentIndex = listview->currentIndex();
+ QTRY_COMPARE(currentIndex, 9);
+}
+
QTEST_MAIN(tst_QQuickListView)
#include "tst_qquicklistview.moc"
diff --git a/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST b/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST
index 6af00ab76f..cfbd47d3dc 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST
+++ b/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST
@@ -1,10 +1,14 @@
[nonOverlapping]
+# QTBUG-101499
+ubuntu-20
ubuntu-16.04
ubuntu-18.04
opensuse-42.3
opensuse-leap
sles
[nested]
+# QTBUG-101499
+ubuntu-20
ubuntu-16.04
ubuntu-18.04
opensuse-42.3
diff --git a/tests/auto/quick/qquickstates/data/noStateOsciallation.qml b/tests/auto/quick/qquickstates/data/noStateOsciallation.qml
new file mode 100644
index 0000000000..f0d7aeeb6d
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/noStateOsciallation.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.15
+
+Item {
+ id: root
+ property int number: 2
+ property int stateChangeCounter: 0
+
+ Item {
+ id: item
+ onStateChanged: ++stateChangeCounter
+ states: [
+ State {
+ name: "n1"
+ when: root.number === 1
+ },
+ State {
+ name: "n2"
+ when: root.number === 2
+ }
+ ]
+ }
+}
diff --git a/tests/auto/quick/qquickstates/tst_qquickstates.cpp b/tests/auto/quick/qquickstates/tst_qquickstates.cpp
index 849522454f..aa55b42935 100644
--- a/tests/auto/quick/qquickstates/tst_qquickstates.cpp
+++ b/tests/auto/quick/qquickstates/tst_qquickstates.cpp
@@ -188,6 +188,7 @@ private slots:
void revertListMemoryLeak();
void duplicateStateName();
void trivialWhen();
+ void noStateOsciallation();
void parentChangeCorrectReversal();
void revertNullObjectBinding();
};
@@ -1733,6 +1734,20 @@ void tst_qquickstates::trivialWhen()
QVERIFY(c.create());
}
+void tst_qquickstates::noStateOsciallation()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("noStateOsciallation.qml"));
+ QScopedPointer<QObject> root {component.create()};
+ QVERIFY(root);
+ // set to 1 on initial transition from "" to "n2"
+ QCOMPARE(root->property("stateChangeCounter").toInt(), 1);
+ root->setProperty("number", 1);
+ // setting number to 1 changes directly from "n2" to "n1"
+ // without any intermediate transition to ""
+ QCOMPARE(root->property("stateChangeCounter").toInt(), 2);
+}
+
void tst_qquickstates::parentChangeCorrectReversal()
{
QQmlEngine engine;
diff --git a/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in b/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in
index 26d42c02a9..8a91fb8b87 100644
--- a/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in
+++ b/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in
@@ -40,6 +40,7 @@ but not all the files it references.
set(rcc_files ${_RCC_UNPARSED_ARGUMENTS})
set(rcc_options ${_RCC_OPTIONS})
set(filtered_rcc_files)
+ set(output_resources)
set(compiler_output)
set(rcc_files_with_compilation_units)
set(loader_flags)
@@ -52,13 +53,15 @@ but not all the files it references.
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${input_resource}")
execute_process(COMMAND ${compiler_path} --filter-resource-file ${input_resource} -o ${new_resource_file} OUTPUT_VARIABLE remaining_files)
- list(APPEND filtered_rcc_files ${new_resource_file})
- list(APPEND loader_flags \"--resource-file-mapping=${_resource}=${new_resource_file}\")
set(rcc_file_with_compilation_units)
execute_process(COMMAND ${rcc_path} -list \"${input_resource}\" OUTPUT_VARIABLE rcc_contents)
if (NOT rcc_contents STREQUAL \"\")
+
+ list(APPEND filtered_rcc_files ${new_resource_file})
+ list(APPEND loader_flags \"--resource-file-mapping=${_resource}=${new_resource_file}\")
+
string(REGEX REPLACE \"[\r\n]+\" \";\" rcc_contents ${rcc_contents})
foreach(it ${rcc_contents})
get_filename_component(extension ${it} EXT)
@@ -85,6 +88,8 @@ but not all the files it references.
list(APPEND compiler_output ${loader_source})
endif()
- qt5_add_resources(output_resources ${filtered_rcc_files} OPTIONS ${rcc_options})
+ if(filtered_rcc_files)
+ qt5_add_resources(output_resources ${filtered_rcc_files} OPTIONS ${rcc_options})
+ endif()
set(${outfiles} ${output_resources} ${compiler_output} PARENT_SCOPE)
endfunction()
diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp
index 5e3f41e8c6..8209236916 100644
--- a/tools/qmlimportscanner/main.cpp
+++ b/tools/qmlimportscanner/main.cpp
@@ -74,18 +74,18 @@ inline QString directoryLiteral() { return QStringLiteral("directory"); }
void printUsage(const QString &appNameIn)
{
- const std::wstring appName = appNameIn.toStdWString();
+ const std::string appName = appNameIn.toStdString();
#ifndef QT_BOOTSTRAPPED
const QString qmlPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
#else
const QString qmlPath = QStringLiteral("/home/user/dev/qt-install/qml");
#endif
- std::wcerr
+ std::cerr
<< "Usage: " << appName << " -rootPath path/to/app/qml/directory -importPath path/to/qt/qml/directory\n"
" " << appName << " -qmlFiles file1 file2 -importPath path/to/qt/qml/directory\n"
" " << appName << " -qrcFiles file1.qrc file2.qrc -importPath path/to/qt/qml/directory\n\n"
"Example: " << appName << " -rootPath . -importPath "
- << QDir::toNativeSeparators(qmlPath).toStdWString()
+ << QDir::toNativeSeparators(qmlPath).toStdString()
<< '\n';
}
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index b87b55283a..21d04df853 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -991,19 +991,9 @@ bool compactDependencies(QStringList *dependencies)
return false;
}
-inline std::wostream &operator<<(std::wostream &str, const QString &s)
-{
-#ifdef Q_OS_WIN
- str << reinterpret_cast<const wchar_t *>(s.utf16());
-#else
- str << s.toStdWString();
-#endif
- return str;
-}
-
void printDebugMessage(QtMsgType, const QMessageLogContext &, const QString &msg)
{
- std::wcerr << msg << std::endl;
+ std::cerr << msg.toStdString() << std::endl;
// In case of QtFatalMsg the calling code will abort() when appropriate.
}