diff options
99 files changed, 983 insertions, 41 deletions
diff --git a/.qmake.conf b/.qmake.conf index a9549f1eb1..0d692629d3 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.9 +MODULE_VERSION = 5.15.10 diff --git a/src/3rdparty/masm/assembler/ARM64Assembler.h b/src/3rdparty/masm/assembler/ARM64Assembler.h index ca6b33d39a..3e988a277c 100644 --- a/src/3rdparty/masm/assembler/ARM64Assembler.h +++ b/src/3rdparty/masm/assembler/ARM64Assembler.h @@ -676,11 +676,11 @@ public: struct RealTypes { int64_t m_from : 48; int64_t m_to : 48; + RegisterID m_compareRegister; JumpType m_type : 8; JumpLinkType m_linkType : 8; Condition m_condition : 4; unsigned m_bitNumber : 6; - RegisterID m_compareRegister : 6; bool m_is64Bit : 1; } realTypes; } data; diff --git a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp index d59fdcd675..d54b7e9492 100644 --- a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp +++ b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp @@ -111,7 +111,11 @@ void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable, (fd == -1 ? MAP_ANON : 0), fd, 0); if (result == MAP_FAILED) CRASH(); - madvise(result, bytes, MADV_DONTNEED); + + while (madvise(result, bytes, MADV_DONTNEED)) { + if (errno != EAGAIN) + CRASH(); + } if (fd != -1) close(fd); @@ -218,7 +222,12 @@ void OSAllocator::commit(void* address, size_t bytes, bool writable, bool execut protection |= PROT_EXEC; if (mprotect(address, bytes, protection)) CRASH(); - madvise(address, bytes, MADV_WILLNEED); + + while (madvise(address, bytes, MADV_WILLNEED)) { + if (errno != EAGAIN) + CRASH(); + } + #elif HAVE(MADV_FREE_REUSE) UNUSED_PARAM(writable); UNUSED_PARAM(executable); @@ -238,7 +247,10 @@ void OSAllocator::decommit(void* address, size_t bytes) // Use PROT_NONE and MAP_LAZY to decommit the pages. mmap(address, bytes, PROT_NONE, MAP_FIXED | MAP_LAZY | MAP_PRIVATE | MAP_ANON, -1, 0); #elif OS(LINUX) - madvise(address, bytes, MADV_DONTNEED); + while (madvise(address, bytes, MADV_DONTNEED)) { + if (errno != EAGAIN) + CRASH(); + } if (mprotect(address, bytes, PROT_NONE)) CRASH(); #elif HAVE(MADV_FREE_REUSE) diff --git a/src/imports/labsmodels/qqmltablemodelcolumn_p.h b/src/imports/labsmodels/qqmltablemodelcolumn_p.h index a18f21ab4f..5f6cf9a728 100644 --- a/src/imports/labsmodels/qqmltablemodelcolumn_p.h +++ b/src/imports/labsmodels/qqmltablemodelcolumn_p.h @@ -213,8 +213,6 @@ Q_SIGNALS: void setSizeHintChanged(); private: - int mIndex = -1; - // We store these in hashes because QQuickTableModel needs string-based lookup in certain situations. QHash<QString, QJSValue> mGetters; QHash<QString, QJSValue> mSetters; diff --git a/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp b/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp index 3e75e39f86..c89fb86aec 100644 --- a/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp +++ b/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp @@ -324,3 +324,5 @@ bool QPacketProtocolPrivate::readFromDevice(char *buffer, qint64 size) */ QT_END_NAMESPACE + +#include "moc_qpacketprotocol_p.cpp" diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp index 3851cdc71f..c28bf0aaff 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp @@ -56,3 +56,5 @@ QQmlDebugService *QQmlDebuggerServiceFactory::create(const QString &key) } QT_END_NAMESPACE + +#include "moc_qqmldebuggerservicefactory.cpp" diff --git a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp index 012730902b..1638f18d2b 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp @@ -407,4 +407,6 @@ GlobalInspector::~GlobalInspector() QT_END_NAMESPACE +#include "moc_globalinspector.cpp" + #include <globalinspector.moc> diff --git a/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp index 4f6cb9364d..2de805d40d 100644 --- a/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp +++ b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp @@ -106,3 +106,5 @@ void QDebugMessageServiceImpl::synchronizeTime(const QElapsedTimer &otherTimer) } QT_END_NAMESPACE + +#include "moc_qdebugmessageservice.cpp" diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.cpp b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.cpp index c0b74c74ff..f3990f7e57 100644 --- a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.cpp +++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.cpp @@ -52,3 +52,5 @@ QQmlDebugService *QQmlNativeDebugServiceFactory::create(const QString &key) } QT_END_NAMESPACE + +#include "moc_qqmlnativedebugservicefactory.cpp" diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.cpp index 1561777202..af255781bc 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.cpp @@ -66,3 +66,5 @@ void QQmlDebugTranslationServiceImpl::foundTranslationBinding(QQmlTranslationBin } QT_END_NAMESPACE + +#include "moc_qqmldebugtranslationservice.cpp" diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileloader.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileloader.cpp index 8d8a8f18d2..a84ef0dc7b 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileloader.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileloader.cpp @@ -197,3 +197,5 @@ void QQmlPreviewFileLoader::clearCache() } QT_END_NAMESPACE + +#include "moc_qqmlpreviewfileloader.cpp" diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp index 8bb3b95e48..0e2521055c 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp @@ -456,3 +456,5 @@ void QQmlPreviewHandler::tryCreateObject() } QT_END_NAMESPACE + +#include "moc_qqmlpreviewhandler.cpp" diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.cpp index 2e6aaa5858..8e23749a47 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.cpp @@ -197,3 +197,5 @@ void QQmlPreviewServiceImpl::forwardFps(const QQmlPreviewHandler::FpsInfo &frame } QT_END_NAMESPACE + +#include "moc_qqmlpreviewservice.cpp" diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservicefactory.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservicefactory.cpp index 6ff9805bbe..44d2cab526 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservicefactory.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservicefactory.cpp @@ -54,3 +54,5 @@ QQmlDebugService *QQmlPreviewServiceFactory::create(const QString &key) } QT_END_NAMESPACE + +#include "moc_qqmlpreviewservicefactory.cpp" diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp index 4702bc3c33..7a1b19ab8b 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp @@ -159,3 +159,5 @@ void QQmlProfilerAdapter::receiveData(const QVector<QQmlProfilerData> &new_data, } QT_END_NAMESPACE + +#include "moc_qqmlprofileradapter.cpp" diff --git a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp index 79a1c82411..0abd54dfb1 100644 --- a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp @@ -175,3 +175,5 @@ void QQuickProfilerAdapter::receiveData(const QVector<QQuickProfilerData> &new_d } QT_END_NAMESPACE + +#include "moc_qquickprofileradapter.cpp" diff --git a/src/plugins/qmltooling/qmldbg_server/qmldbg_server.pro b/src/plugins/qmltooling/qmldbg_server/qmldbg_server.pro index d7d24a4d39..4233388a11 100644 --- a/src/plugins/qmltooling/qmldbg_server/qmldbg_server.pro +++ b/src/plugins/qmltooling/qmldbg_server/qmldbg_server.pro @@ -2,7 +2,7 @@ TARGET = qmldbg_server QT = qml-private packetprotocol-private SOURCES += \ - $$PWD/qqmldebugserver.cpp + $$PWD/qqmldebugserverfactory.cpp HEADERS += \ $$PWD/qqmldebugserverfactory.h diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.cpp index 4d68a4508b..19393dbe05 100644 --- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp +++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.cpp @@ -764,4 +764,4 @@ QQmlDebugConnector *QQmlDebugServerFactory::create(const QString &key) QT_END_NAMESPACE -#include "qqmldebugserver.moc" +#include "qqmldebugserverfactory.moc" diff --git a/src/qml/compiler/qv4bytecodegenerator_p.h b/src/qml/compiler/qv4bytecodegenerator_p.h index 1895a34a68..5244c443c4 100644 --- a/src/qml/compiler/qv4bytecodegenerator_p.h +++ b/src/qml/compiler/qv4bytecodegenerator_p.h @@ -186,13 +186,13 @@ QT_WARNING_POP Q_REQUIRED_RESULT Jump jumpNotUndefined() { - Instruction::JumpNotUndefined data; + Instruction::JumpNotUndefined data{}; return addJumpInstruction(data); } Q_REQUIRED_RESULT Jump jumpNoException() { - Instruction::JumpNoException data; + Instruction::JumpNoException data{}; return addJumpInstruction(data); } diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 4588690307..5a0dc11fbf 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -2927,6 +2927,17 @@ bool Codegen::visit(YieldExpression *ast) return false; } + auto innerMostCurentFunctionContext = _context; + while (innerMostCurentFunctionContext && innerMostCurentFunctionContext->contextType != ContextType::Function) + innerMostCurentFunctionContext = innerMostCurentFunctionContext->parent; + + Q_ASSERT(innerMostCurentFunctionContext); // yield outside function would have been rejected by parser + + if (!innerMostCurentFunctionContext->isGenerator) { + throwSyntaxError(ast->firstSourceLocation(), QLatin1String("Yield is only valid in generator functions")); + return false; + } + RegisterScope scope(this); TailCallBlocker blockTailCalls(this); Reference expr = ast->expression ? expression(ast->expression) : Reference::fromConst(this, Encode::undefined()); diff --git a/src/qml/debugger/debugger.pri b/src/qml/debugger/debugger.pri index 1281886816..6f976e149e 100644 --- a/src/qml/debugger/debugger.pri +++ b/src/qml/debugger/debugger.pri @@ -15,6 +15,7 @@ qtConfig(qml-debug) { $$PWD/qqmldebugservice.cpp \ $$PWD/qqmlabstractprofileradapter.cpp \ $$PWD/qqmlprofiler.cpp \ + $$PWD/qqmldebugserver.cpp \ $$PWD/qqmldebugserviceinterfaces.cpp } diff --git a/src/qml/debugger/qqmldebugconnector_p.h b/src/qml/debugger/qqmldebugconnector_p.h index d1ad90adfd..4f7b013160 100644 --- a/src/qml/debugger/qqmldebugconnector_p.h +++ b/src/qml/debugger/qqmldebugconnector_p.h @@ -65,6 +65,7 @@ QT_BEGIN_NAMESPACE class Q_QML_PRIVATE_EXPORT QQmlDebugConnector { + virtual ~QQmlDebugConnector() = default; // don't break 'override' on ~QQmlDebugServer public: static QQmlDebugConnector *instance() { return nullptr; } diff --git a/src/qml/debugger/qqmldebugserver.cpp b/src/qml/debugger/qqmldebugserver.cpp new file mode 100644 index 0000000000..5119fc4209 --- /dev/null +++ b/src/qml/debugger/qqmldebugserver.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qqmldebugserver_p.h" + +QT_BEGIN_NAMESPACE + +QQmlDebugServer::~QQmlDebugServer() + = default; + +QT_END_NAMESPACE + +#include "moc_qqmldebugserver_p.cpp" diff --git a/src/qml/debugger/qqmldebugserver_p.h b/src/qml/debugger/qqmldebugserver_p.h index e848b00bda..c99155051c 100644 --- a/src/qml/debugger/qqmldebugserver_p.h +++ b/src/qml/debugger/qqmldebugserver_p.h @@ -62,6 +62,7 @@ class Q_QML_PRIVATE_EXPORT QQmlDebugServer : public QQmlDebugConnector { Q_OBJECT public: + ~QQmlDebugServer() override; virtual void setDevice(QIODevice *socket) = 0; }; diff --git a/src/qml/jsruntime/qv4arrayiterator.cpp b/src/qml/jsruntime/qv4arrayiterator.cpp index 199b1a728a..51387edf6e 100644 --- a/src/qml/jsruntime/qv4arrayiterator.cpp +++ b/src/qml/jsruntime/qv4arrayiterator.cpp @@ -86,18 +86,18 @@ ReturnedValue ArrayIteratorPrototype::method_next(const FunctionObject *b, const return IteratorPrototype::createIterResultObject(scope.engine, Value::fromInt32(index), false); } - ReturnedValue elementValue = a->get(index); + QV4::ScopedValue elementValue(scope, a->get(index)); CHECK_EXCEPTION(); if (itemKind == ValueIteratorKind) { - return IteratorPrototype::createIterResultObject(scope.engine, Value::fromReturnedValue(elementValue), false); + return IteratorPrototype::createIterResultObject(scope.engine, elementValue, false); } else { Q_ASSERT(itemKind == KeyValueIteratorKind); ScopedArrayObject resultArray(scope, scope.engine->newArrayObject()); resultArray->arrayReserve(2); resultArray->arrayPut(0, Value::fromInt32(index)); - resultArray->arrayPut(1, Value::fromReturnedValue(elementValue)); + resultArray->arrayPut(1, elementValue); resultArray->setArrayLengthUnchecked(2); return IteratorPrototype::createIterResultObject(scope.engine, resultArray, false); diff --git a/src/qml/jsruntime/qv4promiseobject.cpp b/src/qml/jsruntime/qv4promiseobject.cpp index ecaff72b22..ac1cc81771 100644 --- a/src/qml/jsruntime/qv4promiseobject.cpp +++ b/src/qml/jsruntime/qv4promiseobject.cpp @@ -116,6 +116,8 @@ struct ResolveThenableEvent : public QEvent } // namespace QV4 QT_END_NAMESPACE +#include "moc_qv4promiseobject_p.cpp" + ReactionHandler::ReactionHandler(QObject *parent) : QObject(parent) {} diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index c785f8ef51..df193a0591 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1775,3 +1775,4 @@ void QV4::QmlIncubatorObject::statusChanged(QQmlIncubator::Status s) QT_END_NAMESPACE #include "moc_qqmlcomponent.cpp" +#include "moc_qqmlcomponentattached_p.cpp" diff --git a/src/qml/qml/qqmlcomponentattached_p.h b/src/qml/qml/qqmlcomponentattached_p.h index 8ecd9da17d..d7c04a82f1 100644 --- a/src/qml/qml/qqmlcomponentattached_p.h +++ b/src/qml/qml/qqmlcomponentattached_p.h @@ -58,6 +58,7 @@ QT_BEGIN_NAMESPACE +// implemented in qqmlcomponent.cpp class Q_QML_PRIVATE_EXPORT QQmlComponentAttached : public QObject { Q_OBJECT diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index dcc2f8f7f5..826a1a5ab4 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -2671,4 +2671,6 @@ bool QQml_isFileCaseCorrect(const QString &fileName, int lengthIn /* = -1 */) QT_END_NAMESPACE +#include "moc_qqmlengine_p.cpp" + #include "moc_qqmlengine.cpp" diff --git a/src/qml/qml/qqmltypeloadernetworkreplyproxy.cpp b/src/qml/qml/qqmltypeloadernetworkreplyproxy.cpp index af97643163..bcc5306cf8 100644 --- a/src/qml/qml/qqmltypeloadernetworkreplyproxy.cpp +++ b/src/qml/qml/qqmltypeloadernetworkreplyproxy.cpp @@ -72,3 +72,5 @@ void QQmlTypeLoaderNetworkReplyProxy::manualFinished(QNetworkReply *reply) } QT_END_NAMESPACE + +#include "moc_qqmltypeloadernetworkreplyproxy_p.cpp" diff --git a/src/qml/util/qqmlpropertymap.cpp b/src/qml/util/qqmlpropertymap.cpp index 82f048d9d9..5c4cd7352a 100644 --- a/src/qml/util/qqmlpropertymap.cpp +++ b/src/qml/util/qqmlpropertymap.cpp @@ -370,3 +370,5 @@ QQmlPropertyMap::QQmlPropertyMap(const QMetaObject *staticMetaObject, QObject *p */ QT_END_NAMESPACE + +#include "moc_qqmlpropertymap.cpp" diff --git a/src/qmldebug/qmldebug.pro b/src/qmldebug/qmldebug.pro index ac3f3bf3bf..fd15c9054a 100644 --- a/src/qmldebug/qmldebug.pro +++ b/src/qmldebug/qmldebug.pro @@ -16,6 +16,7 @@ SOURCES += \ qqmlprofilerclient.cpp \ qqmlprofilerevent.cpp \ qqmlprofilereventlocation.cpp \ + qqmlprofilereventreceiver.cpp \ qqmlprofilereventtype.cpp \ qqmlprofilertypedevent.cpp \ qv4debugclient.cpp diff --git a/src/qmldebug/qqmldebugclient.cpp b/src/qmldebug/qqmldebugclient.cpp index 03123cc6e0..13785dd6db 100644 --- a/src/qmldebug/qqmldebugclient.cpp +++ b/src/qmldebug/qqmldebugclient.cpp @@ -123,3 +123,5 @@ void QQmlDebugClient::messageReceived(const QByteArray &message) } QT_END_NAMESPACE + +#include "moc_qqmldebugclient_p.cpp" diff --git a/src/qmldebug/qqmldebugmessageclient.cpp b/src/qmldebug/qqmldebugmessageclient.cpp index 0892404194..ce7a3cb2bb 100644 --- a/src/qmldebug/qqmldebugmessageclient.cpp +++ b/src/qmldebug/qqmldebugmessageclient.cpp @@ -88,3 +88,5 @@ void QQmlDebugMessageClient::messageReceived(const QByteArray &data) } QT_END_NAMESPACE + +#include "moc_qqmldebugmessageclient_p.cpp" diff --git a/src/qmldebug/qqmldebugtranslationclient.cpp b/src/qmldebug/qqmldebugtranslationclient.cpp index 1fd0748fa0..486fc3316e 100644 --- a/src/qmldebug/qqmldebugtranslationclient.cpp +++ b/src/qmldebug/qqmldebugtranslationclient.cpp @@ -74,3 +74,5 @@ void QQmlDebugTranslationClient::triggerLanguage(const QUrl &url, const QString } QT_END_NAMESPACE + +#include "moc_qqmldebugtranslationclient_p.cpp" diff --git a/src/qmldebug/qqmlenginedebugclient.cpp b/src/qmldebug/qqmlenginedebugclient.cpp index 0ca3f573d9..fd467337d8 100644 --- a/src/qmldebug/qqmlenginedebugclient.cpp +++ b/src/qmldebug/qqmlenginedebugclient.cpp @@ -566,3 +566,5 @@ qint32 QQmlEngineDebugClient::getId() } QT_END_NAMESPACE + +#include "moc_qqmlenginedebugclient_p.cpp" diff --git a/src/qmldebug/qqmlinspectorclient.cpp b/src/qmldebug/qqmlinspectorclient.cpp index 1de52bd0c1..a3f5c68f0d 100644 --- a/src/qmldebug/qqmlinspectorclient.cpp +++ b/src/qmldebug/qqmlinspectorclient.cpp @@ -148,3 +148,5 @@ void QQmlInspectorClient::messageReceived(const QByteArray &message) } QT_END_NAMESPACE + +#include "moc_qqmlinspectorclient_p.cpp" diff --git a/src/qmldebug/qqmlpreviewclient.cpp b/src/qmldebug/qqmlpreviewclient.cpp index 60937b9cfd..3a76476700 100644 --- a/src/qmldebug/qqmlpreviewclient.cpp +++ b/src/qmldebug/qqmlpreviewclient.cpp @@ -137,3 +137,5 @@ void QQmlPreviewClient::triggerLanguage(const QUrl &url, const QString &locale) } QT_END_NAMESPACE + +#include "moc_qqmlpreviewclient_p.cpp" diff --git a/src/qmldebug/qqmlprofilereventreceiver.cpp b/src/qmldebug/qqmlprofilereventreceiver.cpp new file mode 100644 index 0000000000..cb88f821f8 --- /dev/null +++ b/src/qmldebug/qqmlprofilereventreceiver.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qqmlprofilereventreceiver_p.h" + +QT_BEGIN_NAMESPACE + +QQmlProfilerEventReceiver::~QQmlProfilerEventReceiver() + = default; + +QT_END_NAMESPACE + +#include "moc_qqmlprofilereventreceiver_p.cpp" diff --git a/src/qmldebug/qqmlprofilereventreceiver_p.h b/src/qmldebug/qqmlprofilereventreceiver_p.h index defe64a42e..45d9abf71d 100644 --- a/src/qmldebug/qqmlprofilereventreceiver_p.h +++ b/src/qmldebug/qqmlprofilereventreceiver_p.h @@ -62,7 +62,8 @@ class QQmlProfilerEventReceiver : public QObject { Q_OBJECT public: - QQmlProfilerEventReceiver(QObject *parent = nullptr) : QObject(parent) {} + explicit QQmlProfilerEventReceiver(QObject *parent = nullptr) : QObject(parent) {} + ~QQmlProfilerEventReceiver() override; virtual int numLoadedEventTypes() const = 0; virtual void addEventType(const QQmlProfilerEventType &type) = 0; diff --git a/src/qmldebug/qv4debugclient.cpp b/src/qmldebug/qv4debugclient.cpp index 76c2f1ebea..127e4a405e 100644 --- a/src/qmldebug/qv4debugclient.cpp +++ b/src/qmldebug/qv4debugclient.cpp @@ -576,3 +576,5 @@ QByteArray QV4DebugClientPrivate::packMessage(const QByteArray &type, const QJso } QT_END_NAMESPACE + +#include "moc_qv4debugclient_p.cpp" diff --git a/src/qmlmodels/qqmlabstractdelegatecomponent.cpp b/src/qmlmodels/qqmlabstractdelegatecomponent.cpp index 1058d87485..869c6a4fa9 100644 --- a/src/qmlmodels/qqmlabstractdelegatecomponent.cpp +++ b/src/qmlmodels/qqmlabstractdelegatecomponent.cpp @@ -59,3 +59,5 @@ QVariant QQmlAbstractDelegateComponent::value(QQmlAdaptorModel *adaptorModel, in } QT_END_NAMESPACE + +#include "moc_qqmlabstractdelegatecomponent_p.cpp" diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp index 523c0df779..4fcff70de6 100644 --- a/src/qmlmodels/qqmldelegatemodel.cpp +++ b/src/qmlmodels/qqmldelegatemodel.cpp @@ -3923,4 +3923,6 @@ QV4::ReturnedValue QQmlDelegateModelEngineData::array(QV4::ExecutionEngine *v4, QT_END_NAMESPACE +#include "moc_qqmldelegatemodel_p_p.cpp" + #include "moc_qqmldelegatemodel_p.cpp" diff --git a/src/qmlmodels/qqmllistmodel.cpp b/src/qmlmodels/qqmllistmodel.cpp index e392c9e323..f97bcb4f8d 100644 --- a/src/qmlmodels/qqmllistmodel.cpp +++ b/src/qmlmodels/qqmllistmodel.cpp @@ -2942,4 +2942,6 @@ bool QQmlListModelParser::definesEmptyList(const QString &s) QT_END_NAMESPACE +#include "moc_qqmllistmodel_p_p.cpp" + #include "moc_qqmllistmodel_p.cpp" diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index 150db84533..fa794c1ad2 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -650,3 +650,5 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch } QT_END_NAMESPACE + +#include "moc_quicktest_p.cpp" diff --git a/src/quick/doc/snippets/pointerHandlers/hoverModifiers.qml b/src/quick/doc/snippets/pointerHandlers/hoverModifiers.qml new file mode 100644 index 0000000000..b8a378ddcf --- /dev/null +++ b/src/quick/doc/snippets/pointerHandlers/hoverModifiers.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2022 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$ +** +****************************************************************************/ +//![0] +import QtQuick + +Rectangle { + width: 150; height: 50; radius: 3 + color: control.hovered ? "goldenrod" : shift.hovered ? "wheat" : "beige" + + HoverHandler { + id: control + acceptedModifiers: Qt.ControlModifier + cursorShape: Qt.PointingHandCursor + } + + HoverHandler { + id: shift + acceptedModifiers: Qt.ShiftModifier + cursorShape: Qt.CrossCursor + } +} +//![0] diff --git a/src/quick/doc/snippets/pointerHandlers/hoverMouseOrStylus.qml b/src/quick/doc/snippets/pointerHandlers/hoverMouseOrStylus.qml new file mode 100644 index 0000000000..6bd6a40b1a --- /dev/null +++ b/src/quick/doc/snippets/pointerHandlers/hoverMouseOrStylus.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2022 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$ +** +****************************************************************************/ +//![0] +import QtQuick + +Rectangle { + width: 150; height: 50; radius: 3 + color: mouse.hovered ? "goldenrod" : stylus.hovered ? "tomato" : "wheat" + + HoverHandler { + id: stylus + acceptedDevices: PointerDevice.Stylus + cursorShape: Qt.CrossCursor + } + + HoverHandler { + id: mouse + acceptedDevices: PointerDevice.Mouse + cursorShape: Qt.PointingHandCursor + } +} +//![0] diff --git a/src/quick/doc/snippets/pointerHandlers/hoverStylusOrEraser.qml b/src/quick/doc/snippets/pointerHandlers/hoverStylusOrEraser.qml new file mode 100644 index 0000000000..5d82158baf --- /dev/null +++ b/src/quick/doc/snippets/pointerHandlers/hoverStylusOrEraser.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2022 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$ +** +****************************************************************************/ +//![0] +import QtQuick + +Rectangle { + id: rect + width: 150; height: 150 + + HoverHandler { + id: stylus + acceptedPointerTypes: PointerDevice.Pen + cursorShape: Qt.CrossCursor + } + + HoverHandler { + id: eraser + acceptedPointerTypes: PointerDevice.Eraser + cursorShape: Qt.BlankCursor + target: Image { + parent: rect + source: "images/cursor-eraser.png" + visible: eraser.hovered + x: eraser.point.position.x + y: eraser.point.position.y - 32 + } + } +} +//![0] diff --git a/src/quick/doc/snippets/pointerHandlers/images/cursor-eraser.png b/src/quick/doc/snippets/pointerHandlers/images/cursor-eraser.png Binary files differnew file mode 100644 index 0000000000..e5488a89f2 --- /dev/null +++ b/src/quick/doc/snippets/pointerHandlers/images/cursor-eraser.png diff --git a/src/quick/handlers/qquickdragaxis.cpp b/src/quick/handlers/qquickdragaxis.cpp index 88470c8a7d..806b5d705a 100644 --- a/src/quick/handlers/qquickdragaxis.cpp +++ b/src/quick/handlers/qquickdragaxis.cpp @@ -76,3 +76,5 @@ void QQuickDragAxis::setEnabled(bool enabled) } QT_END_NAMESPACE + +#include "moc_qquickdragaxis_p.cpp" diff --git a/src/quick/handlers/qquickdraghandler.cpp b/src/quick/handlers/qquickdraghandler.cpp index 492897b68b..b9a2c183c2 100644 --- a/src/quick/handlers/qquickdraghandler.cpp +++ b/src/quick/handlers/qquickdraghandler.cpp @@ -343,3 +343,5 @@ void QQuickDragHandler::setTranslation(const QVector2D &trans) */ QT_END_NAMESPACE + +#include "moc_qquickdraghandler_p.cpp" diff --git a/src/quick/handlers/qquickhandlerpoint.cpp b/src/quick/handlers/qquickhandlerpoint.cpp index 72efdfd0f4..7103206470 100644 --- a/src/quick/handlers/qquickhandlerpoint.cpp +++ b/src/quick/handlers/qquickhandlerpoint.cpp @@ -348,3 +348,5 @@ void QQuickHandlerPoint::reset(const QVector<QQuickHandlerPoint> &points) */ QT_END_NAMESPACE + +#include "moc_qquickhandlerpoint_p.cpp" diff --git a/src/quick/handlers/qquickhoverhandler.cpp b/src/quick/handlers/qquickhoverhandler.cpp index 3361415eac..a65730607a 100644 --- a/src/quick/handlers/qquickhoverhandler.cpp +++ b/src/quick/handlers/qquickhoverhandler.cpp @@ -154,6 +154,98 @@ void QQuickHoverHandler::setHovered(bool hovered) } /*! + \internal + \qmlproperty flags QtQuick::HoverHandler::acceptedButtons + + This property is not used in HoverHandler. +*/ + +/*! + \qmlproperty flags QtQuick::HoverHandler::acceptedDevices + + The types of pointing devices that can activate the pointer handler. + + By default, this property is set to + \l{QInputDevice::DeviceType}{PointerDevice.AllDevices}. + If you set it to an OR combination of device types, it will ignore pointer + events from the non-matching devices. + + For example, an item could be made to respond to mouse hover in one way, + and stylus hover in another way, with two handlers: + + \snippet pointerHandlers/hoverMouseOrStylus.qml 0 + + The available device types are as follows: + + \value PointerDevice.Mouse A mouse. + \value PointerDevice.TouchScreen A touchscreen. + \value PointerDevice.TouchPad A touchpad or trackpad. + \value PointerDevice.Stylus A stylus on a graphics tablet. + \value PointerDevice.Airbrush An airbrush on a graphics tablet. + \value PointerDevice.Puck A digitizer with crosshairs, on a graphics tablet. + \value PointerDevice.AllDevices Any type of pointing device. + + \sa QInputDevice::DeviceType +*/ + +/*! + \qmlproperty flags QtQuick::HoverHandler::acceptedPointerTypes + + The types of pointing instruments (generic, stylus, eraser, and so on) + that can activate the pointer handler. + + By default, this property is set to + \l {QPointingDevice::PointerType} {PointerDevice.AllPointerTypes}. + If you set it to an OR combination of device types, it will ignore events + from non-matching events. + + For example, you could provide feedback by changing the cursor depending on + whether a stylus or eraser is hovering over a graphics tablet: + + \snippet pointerHandlers/hoverStylusOrEraser.qml 0 + + The available pointer types are as follows: + + \value PointerDevice.Generic A mouse or a device that emulates a mouse. + \value PointerDevice.Finger A finger on a touchscreen (hover detection is unlikely). + \value PointerDevice.Pen A stylus on a graphics tablet. + \value PointerDevice.Eraser An eraser on a graphics tablet. + \value PointerDevice.Cursor A digitizer with crosshairs, on a graphics tablet. + \value PointerDevice.AllPointerTypes Any type of pointing device. + + \sa QPointingDevice::PointerType +*/ + +/*! + \qmlproperty flags QtQuick::HoverHandler::acceptedModifiers + + If this property is set, a hover event is handled only if the given keyboard + modifiers are pressed. The event is ignored without the modifiers. + + This property is set to \c Qt.KeyboardModifierMask by default, resulting + in handling hover events regardless of any modifier keys. + + For example, an \l[QML]{Item} could have two handlers of the same type, one + of which is enabled only if the required keyboard modifiers are pressed: + + \snippet pointerHandlers/hoverModifiers.qml 0 + + The available modifiers are as follows: + + \value Qt.NoModifier No modifier key is allowed. + \value Qt.ShiftModifier A Shift key on the keyboard must be pressed. + \value Qt.ControlModifier A Ctrl key on the keyboard must be pressed. + \value Qt.AltModifier An Alt key on the keyboard must be pressed. + \value Qt.MetaModifier A Meta key on the keyboard must be pressed. + \value Qt.KeypadModifier A keypad button must be pressed. + \value Qt.GroupSwitchModifier A Mode_switch key on the keyboard must be pressed. + X11 only (unless activated on Windows by a command line argument). + \value Qt.KeyboardModifierMask The handler ignores modifier keys. + + \sa Qt::KeyboardModifier +*/ + +/*! \since 5.15 \qmlproperty Qt::CursorShape QtQuick::HoverHandler::cursorShape This property holds the cursor shape that will appear whenever @@ -202,3 +294,5 @@ void QQuickHoverHandler::setHovered(bool hovered) */ QT_END_NAMESPACE + +#include "moc_qquickhoverhandler_p.cpp" diff --git a/src/quick/handlers/qquickmultipointhandler.cpp b/src/quick/handlers/qquickmultipointhandler.cpp index 2a9ecd341c..443cf4ffbc 100644 --- a/src/quick/handlers/qquickmultipointhandler.cpp +++ b/src/quick/handlers/qquickmultipointhandler.cpp @@ -436,3 +436,5 @@ QMetaProperty &QQuickMultiPointHandlerPrivate::yMetaProperty() const } QT_END_NAMESPACE + +#include "moc_qquickmultipointhandler_p.cpp" diff --git a/src/quick/handlers/qquickpinchhandler.cpp b/src/quick/handlers/qquickpinchhandler.cpp index bf43d56a93..7232f0bb2f 100644 --- a/src/quick/handlers/qquickpinchhandler.cpp +++ b/src/quick/handlers/qquickpinchhandler.cpp @@ -546,3 +546,5 @@ void QQuickPinchHandler::handlePointerEventImpl(QQuickPointerEvent *event) */ QT_END_NAMESPACE + +#include "moc_qquickpinchhandler_p.cpp" diff --git a/src/quick/handlers/qquickpointerdevicehandler.cpp b/src/quick/handlers/qquickpointerdevicehandler.cpp index 90f31bf9fd..b7f0580648 100644 --- a/src/quick/handlers/qquickpointerdevicehandler.cpp +++ b/src/quick/handlers/qquickpointerdevicehandler.cpp @@ -314,3 +314,5 @@ bool QQuickPointerDeviceHandler::wantsPointerEvent(QQuickPointerEvent *event) } QT_END_NAMESPACE + +#include "moc_qquickpointerdevicehandler_p.cpp" diff --git a/src/quick/handlers/qquickpointerhandler.cpp b/src/quick/handlers/qquickpointerhandler.cpp index 25c5e684b7..908c616d74 100644 --- a/src/quick/handlers/qquickpointerhandler.cpp +++ b/src/quick/handlers/qquickpointerhandler.cpp @@ -742,3 +742,5 @@ bool QQuickPointerHandlerPrivate::dragOverThreshold(const QQuickEventPoint *poin } QT_END_NAMESPACE + +#include "moc_qquickpointerhandler_p.cpp" diff --git a/src/quick/handlers/qquickpointhandler.cpp b/src/quick/handlers/qquickpointhandler.cpp index 30f62332ba..6b7b70f17a 100644 --- a/src/quick/handlers/qquickpointhandler.cpp +++ b/src/quick/handlers/qquickpointhandler.cpp @@ -163,3 +163,5 @@ QVector2D QQuickPointHandler::translation() const } QT_END_NAMESPACE + +#include "moc_qquickpointhandler_p.cpp" diff --git a/src/quick/handlers/qquicksinglepointhandler.cpp b/src/quick/handlers/qquicksinglepointhandler.cpp index b51f53b74f..d785d8c0ca 100644 --- a/src/quick/handlers/qquicksinglepointhandler.cpp +++ b/src/quick/handlers/qquicksinglepointhandler.cpp @@ -218,3 +218,5 @@ void QQuickSinglePointHandlerPrivate::reset() } QT_END_NAMESPACE + +#include "moc_qquicksinglepointhandler_p.cpp" diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp index 2284750f15..b722cf7538 100644 --- a/src/quick/handlers/qquicktaphandler.cpp +++ b/src/quick/handlers/qquicktaphandler.cpp @@ -431,3 +431,5 @@ void QQuickTapHandler::updateTimeHeld() from the previous \c tapCount. */ QT_END_NAMESPACE + +#include "moc_qquicktaphandler_p.cpp" diff --git a/src/quick/handlers/qquickwheelhandler.cpp b/src/quick/handlers/qquickwheelhandler.cpp index 16f38af962..7e48d67b8b 100644 --- a/src/quick/handlers/qquickwheelhandler.cpp +++ b/src/quick/handlers/qquickwheelhandler.cpp @@ -527,3 +527,5 @@ QMetaProperty &QQuickWheelHandlerPrivate::targetMetaProperty() const } QT_END_NAMESPACE + +#include "moc_qquickwheelhandler_p.cpp" diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index 1173b055a0..ac962f6f61 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -2274,3 +2274,5 @@ Q_QUICK_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const QQuickEventPoint *eve #endif QT_END_NAMESPACE + +#include "moc_qquickevents_p_p.cpp" diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 7bf242a527..a9f5aec7a3 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -2937,4 +2937,6 @@ void QQuickFlickable::setBoundsMovement(BoundsMovement movement) QT_END_NAMESPACE +#include "moc_qquickflickable_p_p.cpp" + #include "moc_qquickflickable_p.cpp" diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp index 04c5da6167..bf6e17a5d7 100644 --- a/src/quick/items/qquickimage.cpp +++ b/src/quick/items/qquickimage.cpp @@ -945,3 +945,7 @@ void QQuickImage::setMipmap(bool use) */ QT_END_NAMESPACE + +#include "moc_qquickimage_p_p.cpp" + +#include "moc_qquickimage_p.cpp" diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index 125518e51b..f14b29b1b8 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -128,6 +128,8 @@ QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcTransient) QT_END_NAMESPACE +#include "moc_qquickitemsmodule_p.cpp" + static QQmlPrivate::AutoParentResult qquickitem_autoParent(QObject *obj, QObject *parent) { // When setting a parent (especially during dynamic object creation) in QML, diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index 00ac3de9e7..0a5514d5f9 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -439,9 +439,8 @@ void QQuickLoader::loadFromSource() } if (isComponentComplete()) { - QQmlComponent::CompilationMode mode = d->asynchronous ? QQmlComponent::Asynchronous : QQmlComponent::PreferSynchronous; if (!d->component) - d->component.setObject(new QQmlComponent(qmlEngine(this), d->source, mode, this), this); + d->createComponent(); d->load(); } } @@ -806,11 +805,8 @@ void QQuickLoader::componentComplete() Q_D(QQuickLoader); QQuickItem::componentComplete(); if (active()) { - if (d->loadingFromSource) { - QQmlComponent::CompilationMode mode = d->asynchronous ? QQmlComponent::Asynchronous : QQmlComponent::PreferSynchronous; - if (!d->component) - d->component.setObject(new QQmlComponent(qmlEngine(this), d->source, mode, this), this); - } + if (d->loadingFromSource && !d->component) + d->createComponent(); d->load(); } } @@ -1044,6 +1040,22 @@ void QQuickLoaderPrivate::updateStatus() } } +void QQuickLoaderPrivate::createComponent() +{ + Q_Q(QQuickLoader); + const QQmlComponent::CompilationMode mode = asynchronous + ? QQmlComponent::Asynchronous + : QQmlComponent::PreferSynchronous; + if (QQmlContext *context = qmlContext(q)) { + if (QQmlEngine *engine = context->engine()) { + component.setObject(new QQmlComponent(engine, source, mode, q), q); + return; + } + } + + qmlWarning(q) << "createComponent: Cannot find a QML engine."; +} + #include <moc_qquickloader_p.cpp> QT_END_NAMESPACE diff --git a/src/quick/items/qquickloader_p_p.h b/src/quick/items/qquickloader_p_p.h index 39d50280c5..b178803c7d 100644 --- a/src/quick/items/qquickloader_p_p.h +++ b/src/quick/items/qquickloader_p_p.h @@ -98,6 +98,7 @@ public: QV4::ReturnedValue extractInitialPropertyValues(QQmlV4Function *args, QObject *loader, bool *error); QQuickLoader::Status computeStatus() const; void updateStatus(); + void createComponent(); qreal getImplicitWidth() const override; qreal getImplicitHeight() const override; diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index 982d089b5f..867a36a362 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -825,7 +825,8 @@ void QQuickMouseArea::mouseDoubleClickEvent(QMouseEvent *event) emit this->doubleClicked(&me); if (!me.isAccepted()) d->propagate(&me, QQuickMouseAreaPrivate::DoubleClick); - d->doubleClick = d->isDoubleClickConnected() || me.isAccepted(); + if (d->pressed) + d->doubleClick = d->isDoubleClickConnected() || me.isAccepted(); } QQuickItem::mouseDoubleClickEvent(event); } diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp index 383718c979..7573b41f67 100644 --- a/src/quick/items/qquickmultipointtoucharea.cpp +++ b/src/quick/items/qquickmultipointtoucharea.cpp @@ -685,7 +685,7 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event) emit released(_releasedTouchPoints); if (moved) emit updated(_movedTouchPoints); - if (started) + if (started && !_pressedTouchPoints.isEmpty()) emit pressed(_pressedTouchPoints); if (ended || moved || started) emit touchUpdated(_touchPoints.values()); } @@ -730,12 +730,15 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p) void QQuickMultiPointTouchArea::addTouchPoint(const QMouseEvent *e) { QQuickTouchPoint *dtp = nullptr; - for (QQuickTouchPoint *tp : qAsConst(_touchPrototypes)) + for (QQuickTouchPoint *tp : qAsConst(_touchPrototypes)) { if (!tp->inUse()) { tp->setInUse(true); dtp = tp; break; + } else if (_mouseTouchPoint == tp) { + return; // do not allow more than one touchpoint to react to the mouse (QTBUG-83662) } + } if (dtp == nullptr) dtp = new QQuickTouchPoint(false); diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp index 1a07eb5923..df6f271b0d 100644 --- a/src/quick/items/qquickpincharea.cpp +++ b/src/quick/items/qquickpincharea.cpp @@ -710,6 +710,8 @@ bool QQuickPinchArea::event(QEvent *event) clearPinch(); break; case Qt::ZoomNativeGesture: { + if (d->pinchRejected) + break; qreal scale = d->pinchLastScale * (1.0 + gesture->value()); QQuickPinchEvent pe(d->pinchStartCenter, scale, d->pinchLastAngle, 0.0); pe.setStartCenter(d->pinchStartCenter); @@ -727,7 +729,10 @@ bool QQuickPinchArea::event(QEvent *event) else emit pinchStarted(&pe); d->inPinch = true; - updatePinchTarget(); + if (pe.accepted()) + updatePinchTarget(); + else + d->pinchRejected = true; } break; case Qt::SmartZoomNativeGesture: { if (gesture->value() > 0.0 && d->pinch && d->pinch->target()) { @@ -751,6 +756,8 @@ bool QQuickPinchArea::event(QEvent *event) emit smartZoom(&pe); } break; case Qt::RotateNativeGesture: { + if (d->pinchRejected) + break; qreal angle = d->pinchLastAngle + gesture->value(); QQuickPinchEvent pe(d->pinchStartCenter, d->pinchLastScale, angle, 0.0); pe.setStartCenter(d->pinchStartCenter); @@ -769,7 +776,10 @@ bool QQuickPinchArea::event(QEvent *event) emit pinchStarted(&pe); d->inPinch = true; d->pinchRotation = angle; - updatePinchTarget(); + if (pe.accepted()) + updatePinchTarget(); + else + d->pinchRejected = true; } break; default: return QQuickItem::event(event); diff --git a/src/quick/items/qquickscalegrid.cpp b/src/quick/items/qquickscalegrid.cpp index 23f179be1d..82875c9e52 100644 --- a/src/quick/items/qquickscalegrid.cpp +++ b/src/quick/items/qquickscalegrid.cpp @@ -217,3 +217,5 @@ QString QQuickGridScaledImage::pixmapUrl() const } QT_END_NAMESPACE + +#include "moc_qquickscalegrid_p_p.cpp" diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp index 5feec60874..3c10a65450 100644 --- a/src/quick/items/qquicktableview.cpp +++ b/src/quick/items/qquicktableview.cpp @@ -3096,3 +3096,5 @@ QQuickTableSectionSizeProviderPrivate::~QQuickTableSectionSizeProviderPrivate() #include "moc_qquicktableview_p.cpp" QT_END_NAMESPACE + +#include "moc_qquicktableview_p_p.cpp" diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index e823ca1095..c135a7f272 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -965,7 +965,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) const qreal availWidth = availableWidth(); const qreal availHeight = availableHeight(); - lineWidth = q->widthValid() && availWidth > 0 ? availWidth : naturalWidth; + lineWidth = q->widthValid() && q->width() > 0 ? availWidth : naturalWidth; maxHeight = q->heightValid() ? availHeight : FLT_MAX; // If the width of the item has changed and it's possible the result of wrapping, diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 1d9e3761a2..5dad4d4d42 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -1204,7 +1204,15 @@ void QQuickTextEdit::setCursorVisible(bool on) /*! \qmlproperty int QtQuick::TextEdit::cursorPosition - The position of the cursor in the TextEdit. + The position of the cursor in the TextEdit. The cursor is positioned between + characters. + + \note The \e characters in this case refer to the string of \l QChar objects, + therefore 16-bit Unicode characters, and the position is considered an index + into this string. This does not necessarily correspond to individual graphemes + in the writing system, as a single grapheme may be represented by multiple + Unicode characters, such as in the case of surrogate pairs, linguistic + ligatures or diacritics. */ int QQuickTextEdit::cursorPosition() const { diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 97ece4e10d..c3d013f166 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -831,7 +831,20 @@ void QQuickTextInput::setCursorVisible(bool on) /*! \qmlproperty int QtQuick::TextInput::cursorPosition - The position of the cursor in the TextInput. + The position of the cursor in the TextInput. The cursor is positioned between + characters. + + \note The \e characters in this case refer to the string of \l QChar objects, + therefore 16-bit Unicode characters, and the position is considered an index + into this string. This does not necessarily correspond to individual graphemes + in the writing system, as a single grapheme may be represented by multiple + Unicode characters, such as in the case of surrogate pairs, linguistic + ligatures or diacritics. + + \l displayText is different if echoMode is set to \l TextInput.Password: then + each passwordMaskCharacter is a "narrow" character + (the cursorPosition always moves by 1), even if the text in the TextInput is not. + */ int QQuickTextInput::cursorPosition() const { @@ -1152,6 +1165,7 @@ void QQuickTextInput::setInputMask(const QString &im) /*! \qmlproperty bool QtQuick::TextInput::acceptableInput + \readonly This property is always true unless a validator or input mask has been set. If a validator or input mask has been set, this property will only be true diff --git a/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp b/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp index 7c98e2c1e1..13b4c63c3c 100644 --- a/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp +++ b/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp @@ -180,3 +180,5 @@ QSGTexture *Texture::removedFromAtlas() const } QT_END_NAMESPACE + +#include "moc_qsgcompressedatlastexture_p.cpp" diff --git a/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp b/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp index 65abb2a1af..ce433a0411 100644 --- a/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp +++ b/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp @@ -382,3 +382,5 @@ QSize QSGCompressedTextureFactory::textureSize() const } QT_END_NAMESPACE + +#include "moc_qsgcompressedtexture_p.cpp" diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index ea1a1a9b93..79d3fca500 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -4024,6 +4024,7 @@ void Renderer::renderBatches() if (m_useDepthBuffer) { glClearDepthf(1); // calls glClearDepth() under the hood for desktop OpenGL + glDepthMask(true); } glColorMask(true, true, true, true); glDisable(GL_SCISSOR_TEST); diff --git a/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp b/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp index c5cbd0c979..d2eb22f45a 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp +++ b/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp @@ -105,7 +105,7 @@ void QSGMaterialRhiShaderPrivate::prepare(QShader::Variant vertexShaderVariant) ubufBinding = -1; ubufSize = 0; ubufStages = { }; - memset(combinedImageSamplerBindings, 0, sizeof(combinedImageSamplerBindings)); + memset(static_cast<void *>(combinedImageSamplerBindings), 0, sizeof(combinedImageSamplerBindings)); vertexShader = fragmentShader = nullptr; masterUniformData.clear(); diff --git a/src/quick/scenegraph/qsgrhishadereffectnode.cpp b/src/quick/scenegraph/qsgrhishadereffectnode.cpp index e86dae7c09..b0d3ca78f5 100644 --- a/src/quick/scenegraph/qsgrhishadereffectnode.cpp +++ b/src/quick/scenegraph/qsgrhishadereffectnode.cpp @@ -572,10 +572,10 @@ void QSGRhiShaderEffectMaterial::updateTextureProviders(bool layoutChange) QSGRhiShaderEffectNode::QSGRhiShaderEffectNode(QSGDefaultRenderContext *rc, QSGRhiGuiThreadShaderEffectManager *mgr) : QSGShaderEffectNode(mgr), - m_rc(rc), m_mgr(mgr), m_material(this) { + Q_UNUSED(rc); setFlag(UsePreprocess, true); setMaterial(&m_material); } @@ -884,3 +884,5 @@ bool QSGRhiGuiThreadShaderEffectManager::reflect(ShaderInfo *result) } QT_END_NAMESPACE + +#include "moc_qsgrhishadereffectnode_p.cpp" diff --git a/src/quick/scenegraph/qsgrhishadereffectnode_p.h b/src/quick/scenegraph/qsgrhishadereffectnode_p.h index 26460d24b2..3c382743ee 100644 --- a/src/quick/scenegraph/qsgrhishadereffectnode_p.h +++ b/src/quick/scenegraph/qsgrhishadereffectnode_p.h @@ -139,7 +139,6 @@ private Q_SLOTS: void handleTextureProviderDestroyed(QObject *object); private: - QSGDefaultRenderContext *m_rc; QSGRhiGuiThreadShaderEffectManager *m_mgr; QSGRhiShaderEffectMaterial m_material; }; diff --git a/src/quick/scenegraph/util/qsgplaintexture.cpp b/src/quick/scenegraph/util/qsgplaintexture.cpp index f00918bb4e..7c3cf90325 100644 --- a/src/quick/scenegraph/util/qsgplaintexture.cpp +++ b/src/quick/scenegraph/util/qsgplaintexture.cpp @@ -466,3 +466,5 @@ void QSGPlainTexturePrivate::updateRhiTexture(QRhi *rhi, QRhiResourceUpdateBatch } QT_END_NAMESPACE + +#include "moc_qsgplaintexture_p.cpp" diff --git a/src/quick/util/qquicksmoothedanimation.cpp b/src/quick/util/qquicksmoothedanimation.cpp index 254b1af0a2..d511dc0562 100644 --- a/src/quick/util/qquicksmoothedanimation.cpp +++ b/src/quick/util/qquicksmoothedanimation.cpp @@ -569,4 +569,6 @@ void QQuickSmoothedAnimation::setMaximumEasingTime(int v) QT_END_NAMESPACE +#include "moc_qquicksmoothedanimation_p_p.cpp" + #include "moc_qquicksmoothedanimation_p.cpp" diff --git a/src/quick/util/qquicktimeline.cpp b/src/quick/util/qquicktimeline.cpp index abe6eb7261..949724e87c 100644 --- a/src/quick/util/qquicktimeline.cpp +++ b/src/quick/util/qquicktimeline.cpp @@ -957,3 +957,5 @@ QQuickTimeLineObject *QQuickTimeLineCallback::callbackObject() const } QT_END_NAMESPACE + +#include "moc_qquicktimeline_p_p.cpp" diff --git a/src/quickshapes/qquickshapegenericrenderer.cpp b/src/quickshapes/qquickshapegenericrenderer.cpp index 289dee1081..ff840eabaf 100644 --- a/src/quickshapes/qquickshapegenericrenderer.cpp +++ b/src/quickshapes/qquickshapegenericrenderer.cpp @@ -1280,3 +1280,5 @@ QSGMaterialShader *QQuickShapeConicalGradientMaterial::createShader() const } QT_END_NAMESPACE + +#include "moc_qquickshapegenericrenderer_p.cpp" diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index b75bf820d5..c66e2dccf3 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -268,6 +268,7 @@ private slots: void dataViewCtor(); void uiLanguage(); + void forOfAndGc(); public: Q_INVOKABLE QJSValue throwingCppMethod1(); @@ -5250,6 +5251,77 @@ void tst_QJSEngine::uiLanguage() } } +void tst_QJSEngine::forOfAndGc() +{ + // We want to guard against the iterator of a for..of loop leaving the result unprotected from + // garbage collection. It should be possible to construct a pure JS test case, but due to the + // vaguaries of garbage collection it's hard to reliably trigger the crash. This test is the + // best I could come up with. + + QQmlEngine engine; + QQmlComponent c(&engine); + c.setData(R"( + import QtQml 2.15 + import QtQml.Models 2.15 + + QtObject { + id: counter + property int count: 0 + + property DelegateModel model: DelegateModel { + id: filesModel + + model: ListModel { + Component.onCompleted: { + for (let idx = 0; idx < 50; idx++) + append({"i" : idx}) + } + } + + groups: [ + DelegateModelGroup { + name: "selected" + } + ] + + function getSelected() { + for (let i = 0; i < items.count; ++i) { + var item = items.get(i) + for (let el of item.groups) { + if (el === "selected") + ++counter.count + } + } + } + + property bool bSelect: true + function selectAll() { + for (let i = 0; i < items.count; ++i) { + if (bSelect && !items.get(i).inSelected) + items.addGroups(i, 1, ["selected"]) + else + items.removeGroups(i, 1, ["selected"]) + getSelected() + } + bSelect = !bSelect + } + } + + property Timer timer: Timer { + running: true + interval: 1 + repeat: true + onTriggered: filesModel.selectAll() + } + } + )", QUrl()); + + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + + QTRY_VERIFY(o->property("count").toInt() > 32768); +} + QTEST_MAIN(tst_QJSEngine) #include "tst_qjsengine.moc" diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 696566d987..2291c31895 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -241,6 +241,7 @@ private slots: void topLevelGeneratorFunction(); void generatorCrashNewProperty(); void generatorCallsGC(); + void noYieldInInnerFunction(); void qtbug_10696(); void qtbug_11606(); void qtbug_11600(); @@ -6516,6 +6517,19 @@ void tst_qqmlecmascript::generatorCallsGC() QVERIFY2(o != nullptr, qPrintable(component.errorString())); } +void tst_qqmlecmascript::noYieldInInnerFunction() +{ + QJSEngine engine; + const QString program = R"( + function *a() { + (function() { yield 1; })(); + }; + )"; + auto result = engine.evaluate(program); + QVERIFY(result.isError()); + QCOMPARE(result.errorType(), QJSValue::SyntaxError); +} + // Test the "Qt.include" method void tst_qqmlecmascript::include() { diff --git a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp index b49832499e..9315b2d24d 100644 --- a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp +++ b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp @@ -89,15 +89,13 @@ QT_END_NAMESPACE static const C::Group Visible = C::Group(2); static const C::Group Selection = C::Group(3); +constexpr auto VisibleFlag = C::Flag(0x04); +constexpr auto SelectionFlag = C::Flag(0x08); + class tst_qqmllistcompositor : public QObject { Q_OBJECT - enum { - VisibleFlag = 0x04, - SelectionFlag = 0x08 - }; - void populateChange( C::Change &change, int sIndex, int vIndex, int dIndex, int cIndex, int count, int flags, int moveId) { diff --git a/tests/auto/quick/qquickloader/data/noEngine.qml b/tests/auto/quick/qquickloader/data/noEngine.qml new file mode 100644 index 0000000000..19e619f32e --- /dev/null +++ b/tests/auto/quick/qquickloader/data/noEngine.qml @@ -0,0 +1,32 @@ +import QtQuick 2 + +Item { + id: root + property bool a: false + property int changes: 0 + onAChanged: { + m.model = 0 + m.model = 1 + ++changes; + } + + Repeater { + id: m + model: 1 + + Item { + Timer { + onTriggered: { + root.a = true + l.source = "loaded.qml" + } + interval: 0 + running: true + } + + Loader { + id: l + } + } + } +} diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp index dddacbaa0b..db678ae5a1 100644 --- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp +++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp @@ -133,6 +133,7 @@ private slots: void setSourceAndCheckStatus(); void asyncLoaderRace(); + void noEngine(); }; Q_DECLARE_METATYPE(QList<QQmlError>) @@ -1515,6 +1516,20 @@ void tst_QQuickLoader::asyncLoaderRace() QCOMPARE(loader->item(), nullptr); } +void tst_QQuickLoader::noEngine() +{ + QQmlEngine engine; + const QUrl url = testFileUrl("noEngine.qml"); + QQmlComponent component(&engine, url); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); + QScopedPointer<QObject> o(component.create()); + + const QString message = url.toString() + + QStringLiteral(":27:13: QML Loader: createComponent: Cannot find a QML engine."); + QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); + QTRY_COMPARE(o->property("changes").toInt(), 1); +} + QTEST_MAIN(tst_QQuickLoader) #include "tst_qquickloader.moc" diff --git a/tests/auto/quick/qquickmousearea/data/doubleClickToHide.qml b/tests/auto/quick/qquickmousearea/data/doubleClickToHide.qml new file mode 100644 index 0000000000..01f6eaabed --- /dev/null +++ b/tests/auto/quick/qquickmousearea/data/doubleClickToHide.qml @@ -0,0 +1,19 @@ +import QtQuick 2.0 + +Item { + id: root + property int clicked: 0 + property int doubleClicked: 0 + property int released: 0 + + MouseArea { + width: 200; height: 200 + onClicked: { root.clicked++ } + onDoubleClicked: { + root.doubleClicked++ + visible = false + } + onReleased: { root.released++ } + } +} + diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 1c99357ab7..27fee2aab3 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -161,6 +161,7 @@ private slots: void nestedEventDelivery(); void settingHiddenInPressUngrabs(); void containsMouseAndVisibility(); + void doubleClickToHide(); private: int startDragDistance() const { @@ -2500,6 +2501,33 @@ void tst_QQuickMouseArea::containsMouseAndVisibility() QVERIFY(!mouseArea->hovered()); } +// QTBUG-35995 and QTBUG-102158 +void tst_QQuickMouseArea::doubleClickToHide() +{ + QQuickView window; + QByteArray errorMessage; + QVERIFY2(QQuickTest::initView(window, testFileUrl("doubleClickToHide.qml"), true, &errorMessage), errorMessage.constData()); + window.show(); + window.requestActivate(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + + QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea *>(); + QVERIFY(mouseArea); + + QTest::mouseDClick(&window, Qt::LeftButton, Qt::NoModifier, {10, 10}); + + QCOMPARE(window.rootObject()->property("clicked").toInt(), 1); + QCOMPARE(window.rootObject()->property("doubleClicked").toInt(), 1); + QCOMPARE(mouseArea->isVisible(), false); + QCOMPARE(mouseArea->pressed(), false); + QCOMPARE(mouseArea->pressedButtons(), Qt::NoButton); + + mouseArea->setVisible(true); + + QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, {10, 10}); + QCOMPARE(window.rootObject()->property("clicked").toInt(), 2); +} + QTEST_MAIN(tst_QQuickMouseArea) #include "tst_qquickmousearea.moc" diff --git a/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST b/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST index cfbd47d3dc..db8595544b 100644 --- a/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST +++ b/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST @@ -1,6 +1,6 @@ [nonOverlapping] # QTBUG-101499 -ubuntu-20 +ubuntu-20.04 ubuntu-16.04 ubuntu-18.04 opensuse-42.3 @@ -8,7 +8,7 @@ opensuse-leap sles [nested] # QTBUG-101499 -ubuntu-20 +ubuntu-20.04 ubuntu-16.04 ubuntu-18.04 opensuse-42.3 diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/nestedPinchArea.qml b/tests/auto/quick/qquickmultipointtoucharea/data/nestedPinchArea.qml new file mode 100644 index 0000000000..0e51804b30 --- /dev/null +++ b/tests/auto/quick/qquickmultipointtoucharea/data/nestedPinchArea.qml @@ -0,0 +1,44 @@ +import QtQuick 2.15 + +MultiPointTouchArea { + width: 240 + height: 320 + mouseEnabled: true + property int pressedCount: 0 + property int updatedCount: 0 + property int releasedCount: 0 + + onPressed: (points) => { pressedCount = points.length } + onUpdated: (points) => { updatedCount = points.length } + onReleased: (points) => { releasedCount = points.length } + + touchPoints: [ + TouchPoint { + id: point1 + objectName: "point1" + }, + TouchPoint { + id: point2 + objectName: "point2" + } + ] + + PinchArea { + anchors.fill: parent + } + + Rectangle { + width: 30; height: 30 + color: "green" + x: point1.x + y: point1.y + } + + Rectangle { + id: rectangle + width: 30; height: 30 + color: "yellow" + x: point2.x + y: point2.y + } +} diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp index c18a220996..a9d557915a 100644 --- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp +++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp @@ -77,6 +77,7 @@ private slots: void mouseGestureStarted(); void cancel(); void stationaryTouchWithChangingPressure(); + void nestedPinchAreaMouse(); private: QQuickView *createAndShowView(const QString &file); @@ -1408,6 +1409,53 @@ void tst_QQuickMultiPointTouchArea::stationaryTouchWithChangingPressure() // QTB QCOMPARE(point1->pressure(), 0); } +void tst_QQuickMultiPointTouchArea::nestedPinchAreaMouse() +{ + QScopedPointer<QQuickView> window(createAndShowView("nestedPinchArea.qml")); + QQuickMultiPointTouchArea *mpta = qobject_cast<QQuickMultiPointTouchArea *>(window->rootObject()); + QVERIFY(mpta); + + QQuickTouchPoint *point1 = mpta->findChild<QQuickTouchPoint*>("point1"); + QCOMPARE(point1->pressed(), false); + QQuickTouchPoint *point2 = mpta->findChild<QQuickTouchPoint*>("point2"); + QCOMPARE(point2->pressed(), false); + QSignalSpy pressedSpy(mpta, &QQuickMultiPointTouchArea::pressed); + QSignalSpy updatedSpy(mpta, &QQuickMultiPointTouchArea::updated); + QSignalSpy releasedSpy(mpta, &QQuickMultiPointTouchArea::released); + + QPoint p1(20, 20); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, p1); + QCOMPARE(point1->pressed(), true); + QCOMPARE(point2->pressed(), false); + QCOMPARE(pressedSpy.count(), 1); + QCOMPARE(mpta->property("pressedCount").toInt(), 1); + QCOMPARE(updatedSpy.count(), 0); + QCOMPARE(mpta->property("updatedCount").toInt(), 0); + QCOMPARE(releasedSpy.count(), 0); + QCOMPARE(mpta->property("releasedCount").toInt(), 0); + + p1 += QPoint(0, 15); + QTest::mouseMove(window.data(), p1); + QCOMPARE(point1->pressed(), true); + QCOMPARE(point2->pressed(), false); + QCOMPARE(pressedSpy.count(), 1); + QCOMPARE(mpta->property("pressedCount").toInt(), 1); + QCOMPARE(updatedSpy.count(), 1); + QCOMPARE(mpta->property("updatedCount").toInt(), 1); + QCOMPARE(releasedSpy.count(), 0); + QCOMPARE(mpta->property("releasedCount").toInt(), 0); + + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, p1); + QCOMPARE(point1->pressed(), false); + QCOMPARE(point2->pressed(), false); + QCOMPARE(pressedSpy.count(), 1); + QCOMPARE(mpta->property("pressedCount").toInt(), 1); + QCOMPARE(updatedSpy.count(), 1); + QCOMPARE(mpta->property("updatedCount").toInt(), 1); + QCOMPARE(releasedSpy.count(), 1); + QCOMPARE(mpta->property("releasedCount").toInt(), 1); +} + QTEST_MAIN(tst_QQuickMultiPointTouchArea) diff --git a/tests/auto/quick/qquicktext/data/fontSizeMode.qml b/tests/auto/quick/qquicktext/data/fontSizeMode.qml index 48e7c7b6d0..d5e794824f 100644 --- a/tests/auto/quick/qquicktext/data/fontSizeMode.qml +++ b/tests/auto/quick/qquicktext/data/fontSizeMode.qml @@ -16,7 +16,7 @@ Item { height: 35 minimumPointSize: 8 minimumPixelSize: 8 - font.pixelSize: 25 + font.pixelSize: 23 font.family: "Helvetica" } } diff --git a/tests/auto/quick/qquicktext/data/padding.qml b/tests/auto/quick/qquicktext/data/padding.qml index ab0a37d041..f830af0e40 100644 --- a/tests/auto/quick/qquicktext/data/padding.qml +++ b/tests/auto/quick/qquicktext/data/padding.qml @@ -9,4 +9,30 @@ Text { leftPadding: 30 rightPadding: 40 bottomPadding: 50 + + Rectangle { + width: parent.leftPadding + height: parent.height + color: "#6600FF00" + } + + Rectangle { + width: parent.width + height: parent.topPadding + color: "#66888800" + } + + Rectangle { + x: parent.width - parent.rightPadding + width: parent.rightPadding + height: parent.height + color: "#6600FFFF" + } + + Rectangle { + y: parent.height - parent.bottomPadding + width: parent.width + height: parent.bottomPadding + color: "#66880088" + } } diff --git a/tests/auto/quick/qquicktext/data/paddingInLoader.qml b/tests/auto/quick/qquicktext/data/paddingInLoader.qml new file mode 100644 index 0000000000..6ef7c25a9b --- /dev/null +++ b/tests/auto/quick/qquicktext/data/paddingInLoader.qml @@ -0,0 +1,14 @@ +import QtQuick 2.12 + +Item { + width: 30 + height: 30 + Loader { + anchors.fill: parent + sourceComponent: Text { + rightPadding: 30 + text: "Some text" + elide: Text.ElideRight + } + } +} diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index fe3f696dfa..ff191bbc7f 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -55,6 +55,8 @@ QT_BEGIN_NAMESPACE extern void qt_setQtEnableTestFont(bool value); QT_END_NAMESPACE +Q_LOGGING_CATEGORY(lcTests, "qt.quick.tests") + class tst_qquicktext : public QQmlDataTest { Q_OBJECT @@ -153,6 +155,7 @@ private slots: void growFromZeroWidth(); void padding(); + void paddingInLoader(); void hintingPreference(); @@ -4342,6 +4345,20 @@ void tst_qquicktext::padding() obj->setElideMode(QQuickText::ElideRight); QCOMPARE(obj->implicitWidth(), cw + obj->leftPadding() + obj->rightPadding()); QCOMPARE(obj->implicitHeight(), ch + obj->topPadding() + obj->bottomPadding()); + + obj->setLeftPadding(0); + QCOMPARE(obj->implicitWidth(), cw + obj->leftPadding() + obj->rightPadding()); + + obj->setWidth(cw); + obj->setRightPadding(cw); + QCOMPARE(obj->contentWidth(), 0); + + for (int incr = 1; incr < 50 && qFuzzyIsNull(obj->contentWidth()); ++incr) + obj->setWidth(cw + incr); + QVERIFY(obj->contentWidth() > 0); + qCDebug(lcTests) << "increasing Text width from" << cw << "to" << obj->width() + << "rendered a character: contentWidth now" << obj->contentWidth(); + obj->setElideMode(QQuickText::ElideNone); obj->resetWidth(); @@ -4386,6 +4403,34 @@ void tst_qquicktext::padding() delete root; } +void tst_qquicktext::paddingInLoader() // QTBUG-83413 +{ + QQuickView view(testFileUrl("paddingInLoader.qml")); + view.show(); + view.requestActivate(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + QQuickText *qtext = view.rootObject()->findChild<QQuickText*>(); + QVERIFY(qtext); + QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(qtext); + QVERIFY(textPrivate); + QCOMPARE(qtext->contentWidth(), 0); // does not render text, because width == rightPadding + QCOMPARE(textPrivate->availableWidth(), 0); + + qtext->setLeftPadding(qtext->width()); + qtext->setRightPadding(0); + QCOMPARE(qtext->contentWidth(), 0); // does not render text, because width == leftPadding + QCOMPARE(textPrivate->availableWidth(), 0); + + qtext->setRightPadding(qtext->width()); + QCOMPARE(qtext->contentWidth(), 0); // does not render text: available space is negative + QCOMPARE(textPrivate->availableWidth(), -qtext->width()); + + qtext->setLeftPadding(2); + qtext->setRightPadding(2); + QVERIFY(qtext->contentWidth() > 0); // finally space is available to render text + QCOMPARE(textPrivate->availableWidth(), qtext->width() - 4); +} + void tst_qquicktext::hintingPreference() { { |