diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-10-26 01:00:13 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-10-26 01:00:13 +0200 |
commit | 257319079562368b6ee731f54e3f69647c3417b7 (patch) | |
tree | 231137a8fecdf1405eedb631bc3008a630cf9e16 | |
parent | 7ecc96305f5ec0ed093e2e1b182cb85b71609bcd (diff) | |
parent | aa3d088e3dbc6e93620310cf8de0782fbb2b2ee8 (diff) |
Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Iaa7dbbe9926d25cfb1b1c51e7013e58cb71d86b5
19 files changed, 138 insertions, 31 deletions
diff --git a/src/qml/doc/images/cpp-qml-integration-flowchart.odg b/src/qml/doc/images/cpp-qml-integration-flowchart.odg Binary files differindex f24021635e..026f89fd73 100644 --- a/src/qml/doc/images/cpp-qml-integration-flowchart.odg +++ b/src/qml/doc/images/cpp-qml-integration-flowchart.odg diff --git a/src/qml/doc/images/cpp-qml-integration-flowchart.png b/src/qml/doc/images/cpp-qml-integration-flowchart.png Binary files differindex 3649ff9e41..97f075f51e 100644 --- a/src/qml/doc/images/cpp-qml-integration-flowchart.png +++ b/src/qml/doc/images/cpp-qml-integration-flowchart.png diff --git a/src/qml/qml/qqmlscriptblob.cpp b/src/qml/qml/qqmlscriptblob.cpp index 6ac30d3ab5..eb103dc434 100644 --- a/src/qml/qml/qqmlscriptblob.cpp +++ b/src/qml/qml/qqmlscriptblob.cpp @@ -68,7 +68,7 @@ QQmlRefPointer<QQmlScriptData> QQmlScriptBlob::scriptData() const void QQmlScriptBlob::dataReceived(const SourceCodeData &data) { - if (!diskCacheDisabled() || diskCacheForced()) { + if (diskCacheEnabled()) { QQmlRefPointer<QV4::ExecutableCompilationUnit> unit = QV4::ExecutableCompilationUnit::create(); QString error; @@ -132,7 +132,7 @@ void QQmlScriptBlob::dataReceived(const SourceCodeData &data) auto executableUnit = QV4::ExecutableCompilationUnit::create(std::move(unit)); - if ((!diskCacheDisabled() || diskCacheForced()) && !isDebugging()) { + if (diskCacheEnabled()) { QString errorString; if (executableUnit->saveToDisk(url(), &errorString)) { QString error; diff --git a/src/qml/qml/qqmltypedata.cpp b/src/qml/qml/qqmltypedata.cpp index fac96a2d02..22587c226a 100644 --- a/src/qml/qml/qqmltypedata.cpp +++ b/src/qml/qml/qqmltypedata.cpp @@ -112,10 +112,7 @@ QQmlMetaType::CompositeMetaTypeIds QQmlTypeData::typeIds() const bool QQmlTypeData::tryLoadFromDiskCache() { - if (diskCacheDisabled() && !diskCacheForced()) - return false; - - if (isDebugging()) + if (!diskCacheEnabled()) return false; QV4::ExecutionEngine *v4 = typeLoader()->engine()->handle(); @@ -634,8 +631,7 @@ void QQmlTypeData::compile(const QQmlRefPointer<QQmlTypeNameCache> &typeNameCach return; } - const bool trySaveToDisk = (!diskCacheDisabled() || diskCacheForced()) - && !m_document->jsModule.debugMode && !typeRecompilation; + const bool trySaveToDisk = diskCacheEnabled() && !typeRecompilation; if (trySaveToDisk) { QString errorString; if (m_compiledData->saveToDisk(url(), &errorString)) { diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 997490361c..c2870396b0 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -707,14 +707,9 @@ bool QQmlTypeLoader::Blob::isDebugging() const return typeLoader()->engine()->handle()->debugger() != nullptr; } -bool QQmlTypeLoader::Blob::diskCacheDisabled() +bool QQmlTypeLoader::Blob::diskCacheEnabled() const { - return disableDiskCache(); -} - -bool QQmlTypeLoader::Blob::diskCacheForced() -{ - return forceDiskCache(); + return (!disableDiskCache() || forceDiskCache()) && !isDebugging(); } bool QQmlTypeLoader::Blob::qmldirDataAvailable(const QQmlRefPointer<QQmlQmldirData> &data, QList<QQmlError> *errors) diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h index d45f0e095c..adecf61896 100644 --- a/src/qml/qml/qqmltypeloader_p.h +++ b/src/qml/qml/qqmltypeloader_p.h @@ -129,9 +129,7 @@ public: virtual QString stringAt(int) const { return QString(); } bool isDebugging() const; - - static bool diskCacheDisabled(); - static bool diskCacheForced(); + bool diskCacheEnabled() const; QQmlImports m_importCache; QVector<PendingImportPtr> m_unresolvedImports; diff --git a/src/quick/doc/src/examples.qdoc b/src/quick/doc/src/examples.qdoc index 8c31e13a2d..a913af47c1 100644 --- a/src/quick/doc/src/examples.qdoc +++ b/src/quick/doc/src/examples.qdoc @@ -176,6 +176,7 @@ Creator. \li \l{Scene Graph - Metal Texture Import}{Metal Texture Import} \li \l{Scene Graph - OpenGL Under QML}{OpenGL Under QML} \li \l{Scene Graph - Direct3D 11 Under QML}{Direct3D 11 Under QML} + \li \l{Scene Graph - Vulkan Under QML}{Vulkan Under QML} \li \l{Scene Graph - Custom Rendering with QSGRenderNode}{Render Node} \li \l{Scene Graph - Painted Item}{Painted Item} \li \l{Scene Graph - Graph}{Graph} diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 796ab6cdd7..c6a19219ff 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -8534,7 +8534,11 @@ void QQuickItemLayer::setSourceRect(const QRectF &sourceRect) /*! \qmlproperty bool QtQuick::Item::layer.smooth - Holds whether the layer is smoothly transformed. + Holds whether the layer is smoothly transformed. When enabled, sampling the + layer's texture is performed using \c linear interpolation, while + non-smooth results in using the \c nearest filtering mode. + + By default, this property is set to \c false. \sa {Item Layers} */ diff --git a/src/quick/scenegraph/qsgrhitextureglyphcache_p.h b/src/quick/scenegraph/qsgrhitextureglyphcache_p.h index a7374d91a4..49854a596e 100644 --- a/src/quick/scenegraph/qsgrhitextureglyphcache_p.h +++ b/src/quick/scenegraph/qsgrhitextureglyphcache_p.h @@ -75,8 +75,10 @@ public: QRhiTexture *texture() const { return m_texture; } void commitResourceUpdates(QRhiResourceUpdateBatch *mergeInto); - int width() const { return m_size.width(); } - int height() const { return m_size.height(); } + // Clamp the default -1 width and height to 0 for compatibility with + // QOpenGLTextureGlyphCache. + int width() const { return qMax(0, m_size.width()); } + int height() const { return qMax(0, m_size.height()); } bool eightBitFormatIsAlphaSwizzled() const; diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/quit.js b/tests/auto/qml/debugger/qqmldebugjs/data/quit.js new file mode 100644 index 0000000000..1a45fd5538 --- /dev/null +++ b/tests/auto/qml/debugger/qqmldebugjs/data/quit.js @@ -0,0 +1,4 @@ +function quit() { + console.log("hit"); + Qt.quit(); +} diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/quitInJS.qml b/tests/auto/qml/debugger/qqmldebugjs/data/quitInJS.qml new file mode 100644 index 0000000000..6e4183100b --- /dev/null +++ b/tests/auto/qml/debugger/qqmldebugjs/data/quitInJS.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "quit.js" as Quit; + +//DO NOT CHANGE + +Item { + Timer { + running: true + triggeredOnStart: true + onTriggered: Quit.quit(); + } +} + diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp index 255d679b1b..5b6c43bc0c 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp +++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp @@ -58,6 +58,8 @@ const char *ONCOMPLETED_QMLFILE = "oncompleted.qml"; const char *CREATECOMPONENT_QMLFILE = "createComponent.qml"; const char *CONDITION_QMLFILE = "condition.qml"; const char *QUIT_QMLFILE = "quit.qml"; +const char *QUITINJS_QMLFILE = "quitInJS.qml"; +const char *QUIT_JSFILE = "quit.js"; const char *CHANGEBREAKPOINT_QMLFILE = "changeBreakpoint.qml"; const char *STEPACTION_QMLFILE = "stepAction.qml"; const char *BREAKPOINTRELOCATION_QMLFILE = "breakpointRelocation.qml"; @@ -109,8 +111,10 @@ private slots: void setBreakpointInScriptOnOptimizedBinding(); void setBreakpointInScriptWithCondition_data() { targetData(); } void setBreakpointInScriptWithCondition(); - void setBreakpointInScriptThatQuits_data() { targetData(); } + void setBreakpointInScriptThatQuits_data() { targetData(); }; void setBreakpointInScriptThatQuits(); + void setBreakpointInJavaScript_data(); + void setBreakpointInJavaScript(); void setBreakpointWhenAttaching(); void clearBreakpoint_data() { targetData(); } @@ -450,6 +454,48 @@ void tst_QQmlDebugJS::setBreakpointInScriptThatQuits() QCOMPARE(m_process->exitStatus(), QProcess::NormalExit); } +void tst_QQmlDebugJS::setBreakpointInJavaScript_data() +{ + QTest::addColumn<bool>("qmlscene"); + QTest::addColumn<bool>("seedCache"); + QTest::newRow("custom / immediate") << false << false; + QTest::newRow("qmlscene / immediate") << true << false; + QTest::newRow("custom / seeded") << false << true; + QTest::newRow("qmlscene / seeded") << true << true; +} + +void tst_QQmlDebugJS::setBreakpointInJavaScript() +{ + QFETCH(bool, qmlscene); + QFETCH(bool, seedCache); + + if (seedCache) { // Make sure there is a qmlc file that the engine should _not_ laod. + QProcess process; + process.start(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", + { testFile(QUITINJS_QMLFILE) }); + QTRY_COMPARE(process.state(), QProcess::NotRunning); + } + + QCOMPARE(init(qmlscene, QUITINJS_QMLFILE), ConnectSuccess); + + const int sourceLine = 2; + + m_client->setBreakpoint(QLatin1String(QUIT_JSFILE), sourceLine, -1, true); + m_client->connect(); + QVERIFY(waitForClientSignal(SIGNAL(stopped()))); + + const QJsonObject body = m_client->response().body.toObject(); + + QCOMPARE(body.value("sourceLine").toInt(), sourceLine); + QCOMPARE(QFileInfo(body.value("script").toObject().value("name").toString()).fileName(), + QLatin1String(QUIT_JSFILE)); + + m_client->continueDebugging(QV4DebugClient::Continue); + + QVERIFY(m_process->waitForFinished()); + QCOMPARE(m_process->exitStatus(), QProcess::NormalExit); +} + void tst_QQmlDebugJS::setBreakpointWhenAttaching() { int sourceLine = 35; diff --git a/tools/qmlcachegen/qmlcachegen.pro b/tools/qmlcachegen/qmlcachegen.pro index bee0b9a37e..ec65cdb5e6 100644 --- a/tools/qmlcachegen/qmlcachegen.pro +++ b/tools/qmlcachegen/qmlcachegen.pro @@ -5,8 +5,10 @@ DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII SOURCES = qmlcachegen.cpp \ resourcefilter.cpp \ - generateloader.cpp \ - resourcefilemapper.cpp + generateloader.cpp + +include(../shared/shared.pri) + TARGET = qmlcachegen build_integration.files = qmlcache.prf qtquickcompiler.prf @@ -38,5 +40,3 @@ QMAKE_TARGET_DESCRIPTION = QML Cache Generator load(qt_tool) -HEADERS += \ - resourcefilemapper.h diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp index 6d48f6203d..c37910bdaf 100644 --- a/tools/qmlimportscanner/main.cpp +++ b/tools/qmlimportscanner/main.cpp @@ -49,6 +49,8 @@ #include <QtCore/QJsonDocument> #include <QtCore/QLibraryInfo> +#include <resourcefilemapper.h> + #include <iostream> #include <algorithm> @@ -80,7 +82,8 @@ void printUsage(const QString &appNameIn) #endif std::wcerr << "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\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() << '\n'; @@ -542,6 +545,7 @@ int main(int argc, char *argv[]) QStringList qmlRootPaths; QStringList scanFiles; QStringList qmlImportPaths; + QStringList qrcFiles; bool generateCmakeContent = false; int i = 1; @@ -569,6 +573,8 @@ int main(int argc, char *argv[]) argReceiver = &qmlImportPaths; } else if (arg == QLatin1String("-cmake-output")) { generateCmakeContent = true; + } else if (arg == QLatin1String("-qrcFiles")) { + argReceiver = &qrcFiles; } else { std::cerr << qPrintable(appName) << ": Invalid argument: \"" << qPrintable(arg) << "\"\n"; @@ -590,6 +596,9 @@ int main(int argc, char *argv[]) } } + if (!qrcFiles.isEmpty()) + scanFiles << ResourceFileMapper(qrcFiles).qmlCompilerFiles(ResourceFileMapper::FileOutput::AbsoluteFilePath); + g_qmlImportPaths = qmlImportPaths; // Find the imports! diff --git a/tools/qmlimportscanner/qmlimportscanner.pro b/tools/qmlimportscanner/qmlimportscanner.pro index a29b582274..d69f1a3b0b 100644 --- a/tools/qmlimportscanner/qmlimportscanner.pro +++ b/tools/qmlimportscanner/qmlimportscanner.pro @@ -4,6 +4,7 @@ QT = core qmldevtools-private DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII SOURCES += main.cpp +include(../shared/shared.pri) load(cmake_functions) diff --git a/tools/qmllint/findunqualified.cpp b/tools/qmllint/findunqualified.cpp index ee2a0c38c1..d72f02b94a 100644 --- a/tools/qmllint/findunqualified.cpp +++ b/tools/qmllint/findunqualified.cpp @@ -530,7 +530,7 @@ void FindUnqualifiedIDVisitor::endVisit(QQmlJS::AST::Catch *) bool FindUnqualifiedIDVisitor::visit(QQmlJS::AST::WithStatement *withStatement) { m_colorOut.write(QString::asprintf("Warning: "), Warning); - m_colorOut.write(QString::asprintf("%d:%d: with statements are strongly discouraged in QML and might cause false positives when analying unqalified identifiers\n", withStatement->firstSourceLocation().startLine, withStatement->firstSourceLocation().startColumn), Normal); + m_colorOut.write(QString::asprintf("%d:%d: with statements are strongly discouraged in QML and might cause false positives when analysing unqalified identifiers\n", withStatement->firstSourceLocation().startLine, withStatement->firstSourceLocation().startColumn), Normal); enterEnvironment(ScopeType::JSLexicalScope, "with"); return true; } diff --git a/tools/qmlcachegen/resourcefilemapper.cpp b/tools/shared/resourcefilemapper.cpp index 244874717f..b9cf463575 100644 --- a/tools/qmlcachegen/resourcefilemapper.cpp +++ b/tools/shared/resourcefilemapper.cpp @@ -58,7 +58,7 @@ QStringList ResourceFileMapper::resourcePaths(const QString &fileName) return resourcePaths; } -QStringList ResourceFileMapper::qmlCompilerFiles() const +QStringList ResourceFileMapper::qmlCompilerFiles(FileOutput fo) const { QStringList files; for (auto it = qrcPathToFileSystemPath.constBegin(), end = qrcPathToFileSystemPath.constEnd(); @@ -67,7 +67,10 @@ QStringList ResourceFileMapper::qmlCompilerFiles() const const QString suffix = QFileInfo(qrcPath).suffix(); if (suffix != QStringLiteral("qml") && suffix != QStringLiteral("js") && suffix != QStringLiteral("mjs")) continue; - files << qrcPath; + if (fo == FileOutput::AbsoluteFilePath) + files << it.value(); + else + files << qrcPath; } return files; } diff --git a/tools/qmlcachegen/resourcefilemapper.h b/tools/shared/resourcefilemapper.h index 2e0ab45171..ed3e486149 100644 --- a/tools/qmlcachegen/resourcefilemapper.h +++ b/tools/shared/resourcefilemapper.h @@ -34,12 +34,16 @@ struct ResourceFileMapper { + enum class FileOutput { + RelativeFilePath, + AbsoluteFilePath + }; ResourceFileMapper(const QStringList &resourceFiles); bool isEmpty() const; QStringList resourcePaths(const QString &fileName); - QStringList qmlCompilerFiles() const; + QStringList qmlCompilerFiles(FileOutput fo = FileOutput::RelativeFilePath) const; private: void populateFromQrcFile(QFile &file); diff --git a/tools/shared/shared.pri b/tools/shared/shared.pri new file mode 100644 index 0000000000..c094b51d5f --- /dev/null +++ b/tools/shared/shared.pri @@ -0,0 +1,3 @@ +INCLUDEPATH += $$PWD +SOURCES += $$PWD/resourcefilemapper.cpp +HEADERS += $$PWD/resourcefilemapper.h |