From 6068f4e299df4c5bfeef71f64e84c5393a7a5b35 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 15 Jan 2019 10:23:31 +0100 Subject: [PATCH 01/18] QmlDesigner: Add some extra info to warnings and asserts Change-Id: Ib9c924f7a619b5e79480b5a99291cb9969e7f629 Reviewed-by: Tim Jenssen --- .../qmldesigner/designercore/metainfo/nodemetainfo.cpp | 2 +- .../qmldesigner/designercore/model/texttomodelmerger.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index f92358efc9f..7c7df6b4578 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -1519,7 +1519,7 @@ bool NodeMetaInfo::availableInVersion(int majorVersion, int minorVersion) const bool NodeMetaInfo::isSubclassOf(const TypeName &type, int majorVersion, int minorVersion) const { if (!isValid()) { - qWarning() << "NodeMetaInfo is invalid"; + qWarning() << "NodeMetaInfo is invalid" << type; return false; } diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index 125c6d12bda..2f47407f69e 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -1736,6 +1736,11 @@ void ModelValidator::typeDiffers(bool /*isRootNode*/, qDebug() << typeName << modelNode.majorVersion() << majorVersion; } + if (modelNode.minorVersion() != minorVersion) { + qDebug() << Q_FUNC_INFO << modelNode; + qDebug() << typeName << modelNode.minorVersion() << minorVersion; + } + QTC_ASSERT(modelNode.majorVersion() == majorVersion, return); QTC_ASSERT(modelNode.minorVersion() == minorVersion, return); QTC_ASSERT(0, return); From 011f5eb6795e441aaadef6b0f8c38eb904678339 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 18 Jan 2019 10:21:44 +0100 Subject: [PATCH 02/18] QmlDesigner: Do not set modified to true on load This was triggered by restoring the aux data. Task-number: QDS-377 Change-Id: I9cf3c6b2fff3eb318de4a873103d615416912d9c Reviewed-by: Tim Jenssen --- .../qmldesigner/designercore/include/rewriterview.h | 1 + .../qmldesigner/designercore/model/rewriterview.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/plugins/qmldesigner/designercore/include/rewriterview.h b/src/plugins/qmldesigner/designercore/include/rewriterview.h index c9d2e6dd01c..6a69764dbe8 100644 --- a/src/plugins/qmldesigner/designercore/include/rewriterview.h +++ b/src/plugins/qmldesigner/designercore/include/rewriterview.h @@ -208,6 +208,7 @@ private: //variables bool m_instantQmlTextUpdate = false; std::function m_setWidgetStatusCallback; bool m_hasIncompleteTypeInformation = false; + bool m_restoringAuxData = false; mutable QHash m_canonicalIntModelNode; mutable QHash m_canonicalModelNodeInt; diff --git a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp index 131ffe8fe5c..f4cd9c7e796 100644 --- a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp +++ b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp @@ -392,6 +392,9 @@ void RewriterView::deactivateTextMofifierChangeSignals() void RewriterView::auxiliaryDataChanged(const ModelNode &, const PropertyName &name, const QVariant &) { + if (m_restoringAuxData) + return; + if (name.endsWith("@NodeInstance")) return; @@ -1059,6 +1062,8 @@ void RewriterView::restoreAuxiliaryData() { QTC_ASSERT(m_textModifier, return); + m_restoringAuxData = true; + setupCanonicalHashes(); const QString text = m_textModifier->text(); @@ -1072,6 +1077,8 @@ void RewriterView::restoreAuxiliaryData() QmlJS::SimpleReader reader; checkChildNodes(reader.readFromSource(auxSource), this); } + + m_restoringAuxData = false; } } //QmlDesigner From 678925938b333bc6358d30c74843f5410c9098a3 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 22 Jan 2019 15:12:54 +0100 Subject: [PATCH 03/18] QmlDesigner: Remove write locker This can be triggered by states changes. Change-Id: I306b39e579eee6953f8c7b0b72aa3f52615c73ec Reviewed-by: Tim Jenssen --- src/plugins/qmldesigner/designercore/model/abstractview.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/model/abstractview.cpp b/src/plugins/qmldesigner/designercore/model/abstractview.cpp index 5d536fb0c41..46e86552a5d 100644 --- a/src/plugins/qmldesigner/designercore/model/abstractview.cpp +++ b/src/plugins/qmldesigner/designercore/model/abstractview.cpp @@ -591,8 +591,6 @@ void AbstractView::activateTimeline(const ModelNode &timeline) if (currentTimeline().isValid()) currentTimeline().toogleRecording(false); - Internal::WriteLocker locker(m_model.data()); - if (model()) model()->d->notifyCurrentTimelineChanged(timeline); } @@ -615,8 +613,6 @@ void AbstractView::deactivateTimelineRecording() currentTimeline().resetGroupRecording(); } - Internal::WriteLocker locker(m_model.data()); - if (model()) model()->d->notifyCurrentTimelineChanged(ModelNode()); } From 587bd782aa46f85fda12d6a59057a17858d94a8e Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 23 Jan 2019 12:01:46 +0100 Subject: [PATCH 04/18] Debugger: Reduce the amount of ignored stop messages with LLDB This is a workaround for excess messages from the early LLDB 3.x times. LLDB 6.0 is ok with and without this workaround, LLDB 7.0 does not produce the excess messages anymore and the workaround leads to real stop messages e.g. after a breakpoint hit being ignores. Change-Id: I2fad014eb92e066b00dbfe590fe62c543e5343f4 Task-number: QTCREATORBUG-21615 Reviewed-by: Christian Stenger --- share/qtcreator/debugger/lldbbridge.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 6093b94f78a..e61b56768ea 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -856,16 +856,12 @@ class Dumper(DumperBase): pass self.ignoreStops = 0 - self.silentStops = 0 if platform.system() == 'Linux': if self.startMode_ == AttachCore: pass else: if self.useTerminal_: self.ignoreStops = 2 - else: - self.silentStops = 1 - else: if self.useTerminal_: self.ignoreStops = 1 @@ -1343,8 +1339,6 @@ class Dumper(DumperBase): elif self.ignoreStops > 0: self.ignoreStops -= 1 self.process.Continue() - elif self.silentStops > 0: - self.silentStops -= 1 else: self.reportState("stopped") else: From 9964bbfbf7a634c9d3a12f7beb046f3877245c0d Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 23 Jan 2019 14:00:00 +0100 Subject: [PATCH 05/18] QtSupport: Fix crash in QtSupport unit tests Commit f685e2bfb4 introduced a double delete. Change-Id: Ic871d623d4c826ec18f10f1a96ec4a3adfcf63c5 Reviewed-by: Christian Stenger --- src/plugins/qtsupport/qtprojectimporter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/qtsupport/qtprojectimporter.cpp b/src/plugins/qtsupport/qtprojectimporter.cpp index af32e4a4591..b3f95c94f07 100644 --- a/src/plugins/qtsupport/qtprojectimporter.cpp +++ b/src/plugins/qtsupport/qtprojectimporter.cpp @@ -603,6 +603,7 @@ void QtSupportPlugin::testQtProjectImporter_oneProject() KitManager::deregisterKit(k); // Delete kit templates: + QVERIFY(kitTemplates.removeOne(defaultKit)); qDeleteAll(kitTemplates); } From ac1d6d0bc8f189f0804f08701bc26c704f9e99b1 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 23 Jan 2019 13:54:27 +0100 Subject: [PATCH 06/18] Debugger: Fix Attach to process and Run in Terminal LLDB 6.x and 7.x Change-Id: I127ed1e14ccdd239646673f2460be46da22d4965 Reviewed-by: Christian Stenger --- share/qtcreator/debugger/lldbbridge.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index e61b56768ea..5feadf54c75 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -872,10 +872,8 @@ class Dumper(DumperBase): if self.sysRoot_: self.debugger.SetCurrentPlatformSDKRoot(self.sysRoot_) - if os.path.isfile(self.executable_): - self.target = self.debugger.CreateTarget(self.executable_, None, None, True, error) - else: - self.target = self.debugger.CreateTarget(None, None, None, True, error) + exefile = None if self.attachPid_ > 0 else self.executable_ + self.target = self.debugger.CreateTarget(exefile, None, None, True, error) if self.nativeMixed: self.interpreterEventBreakpoint = \ From 527c579237f66d6b6547fb3afd34180e3be9ba63 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 24 Jan 2019 08:57:53 +0100 Subject: [PATCH 07/18] Allow a bit more configuration range for auto-completion timeout Change-Id: I82e9baf97e6895675657e6138f930da766b59079 Reviewed-by: Nikolai Kosjar --- src/plugins/texteditor/completionsettingspage.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/texteditor/completionsettingspage.ui b/src/plugins/texteditor/completionsettingspage.ui index 7eda07d2aed..ce3ba046be3 100644 --- a/src/plugins/texteditor/completionsettingspage.ui +++ b/src/plugins/texteditor/completionsettingspage.ui @@ -101,7 +101,7 @@ - 500 + 2000 50 From de8ef0c0662c0e666b1aaa4b324d720fb7358288 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 23 Jan 2019 14:42:55 +0100 Subject: [PATCH 08/18] Fix ProjectExplorerPlugin::testJsonWizardsIconList() We returned a pointer to temporary data from a function. Amends 6796839da3. Change-Id: I920789b344c93158092ef23e4bb8019cc9c312c9 Reviewed-by: Christian Stenger --- src/plugins/projectexplorer/jsonwizard/jsonwizard_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard_test.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizard_test.cpp index 890291f7015..9a5947cdd1b 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizard_test.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard_test.cpp @@ -248,10 +248,10 @@ void ProjectExplorer::ProjectExplorerPlugin::testJsonWizardsComboBox() QCOMPARE(qPrintable(disabledComboBox->currentText()), "fgh"); } -static const char *iconInsideResource(const QString &relativePathToIcon) +static QString iconInsideResource(const QString &relativePathToIcon) { const QDir resourcePath(Core::ICore::resourcePath()); - return resourcePath.filePath(relativePathToIcon).toLocal8Bit().data(); + return resourcePath.filePath(relativePathToIcon); } void ProjectExplorer::ProjectExplorerPlugin::testJsonWizardsIconList() From e5a5d38c200a33606e7f3d44603f62219f0bf63e Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 23 Jan 2019 15:12:21 +0100 Subject: [PATCH 09/18] Fix ProjectExplorerPlugin::testProject_setup() The absolute test paths must be in the right format for the host platform, i.e. have a drive letter on Windows. Change-Id: Ibf08a9e8a8b1f9ee1bb19d5307205b53012049b5 Reviewed-by: Christian Stenger --- src/plugins/projectexplorer/project.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index 89550892758..c5195ce5247 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -912,15 +912,25 @@ void Project::setPreferredKitPredicate(const Kit::Predicate &predicate) } // namespace ProjectExplorer +#include + #include #include namespace ProjectExplorer { -const Utils::FileName TEST_PROJECT_PATH = Utils::FileName::fromString("/tmp/foobar/baz.project"); -const Utils::FileName TEST_PROJECT_NONEXISTING_FILE = Utils::FileName::fromString("/tmp/foobar/nothing.cpp"); -const Utils::FileName TEST_PROJECT_CPP_FILE = Utils::FileName::fromString("/tmp/foobar/main.cpp"); -const Utils::FileName TEST_PROJECT_GENERATED_FILE = Utils::FileName::fromString("/tmp/foobar/generated.foo"); +static Utils::FileName constructTestPath(const char *basePath) +{ + Utils::FileName drive; + if (Utils::HostOsInfo::isWindowsHost()) + drive = Utils::FileName::fromString("C:"); + return drive + QLatin1String(basePath); +} + +const Utils::FileName TEST_PROJECT_PATH = constructTestPath("/tmp/foobar/baz.project"); +const Utils::FileName TEST_PROJECT_NONEXISTING_FILE = constructTestPath("/tmp/foobar/nothing.cpp"); +const Utils::FileName TEST_PROJECT_CPP_FILE = constructTestPath("/tmp/foobar/main.cpp"); +const Utils::FileName TEST_PROJECT_GENERATED_FILE = constructTestPath("/tmp/foobar/generated.foo"); const QString TEST_PROJECT_MIMETYPE = "application/vnd.test.qmakeprofile"; const QString TEST_PROJECT_DISPLAYNAME = "testProjectFoo"; const char TEST_PROJECT_ID[] = "Test.Project.Id"; From 05cc1a77e58405427f85504ac9aaf8dca771ba3e Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 25 Jan 2019 10:43:31 +0100 Subject: [PATCH 10/18] QFile/QFileInfo: readLink() was replaced by symLinkTarget() (partially cherry picked from qtbase/7c69f6171ddc76d22e4f6e433be69c5cf365db8f) Change-Id: I8910c8d5255f6ea12589c04eeedcec3d8fd3f277 Reviewed-by: Eike Ziller Reviewed-by: Christian Ehrlicher --- src/shared/proparser/qmakeevaluator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp index 3ed649163d2..f0b9b52e29f 100644 --- a/src/shared/proparser/qmakeevaluator.cpp +++ b/src/shared/proparser/qmakeevaluator.cpp @@ -1185,7 +1185,7 @@ bool QMakeEvaluator::loadSpecInternal() # ifdef Q_OS_UNIX if (m_qmakespec.endsWith(QLatin1String("/default-host")) || m_qmakespec.endsWith(QLatin1String("/default"))) { - QString rspec = QFileInfo(m_qmakespec).readLink(); + QString rspec = QFileInfo(m_qmakespec).symLinkTarget(); if (!rspec.isEmpty()) m_qmakespec = QDir::cleanPath(QDir(m_qmakespec).absoluteFilePath(rspec)); } From 80a92d55d3afcc455882d81185f9de6f35687a00 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 25 Jan 2019 15:40:56 +0100 Subject: [PATCH 11/18] QmlDesigner: Fix gradients in Qt 5.12.1 In Qt 5.12.1 gradient is a QJSValue. See commit 1771d298f33543a3fe47decfe0fff10609b01ab1 This patch adds QJSValue support. Change-Id: I1c37b82bf033c38646564d5453e297258dd4b056 Reviewed-by: Tim Jenssen --- .../instances/objectnodeinstance.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp index 7af165a9c6e..3720bdc90a2 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp @@ -44,6 +44,7 @@ #include #include #include +#include static bool isSimpleExpression(const QString &expression) { @@ -264,11 +265,17 @@ static bool isList(const QQmlProperty &property) return property.propertyTypeCategory() == QQmlProperty::List; } +static bool isQJSValue(const QQmlProperty &property) +{ + return !strcmp(property.propertyTypeName(), "QJSValue"); +} + static bool isObject(const QQmlProperty &property) { - return (property.propertyTypeCategory() == QQmlProperty::Object) || - //QVariant can also store QObjects. Lets trust our model. - (QLatin1String(property.propertyTypeName()) == QLatin1String("QVariant")); + /* QVariant and QJSValue can also store QObjects. Lets trust our model. */ + return (property.propertyTypeCategory() == QQmlProperty::Object + || !strcmp(property.propertyTypeName(), "QVariant") + || isQJSValue(property)); } static QVariant objectToVariant(QObject *object) @@ -337,7 +344,10 @@ void ObjectNodeInstance::addToNewProperty(QObject *object, QObject *newParent, c list.append(object); } else if (isObject(property)) { - property.write(objectToVariant(object)); + if (isQJSValue(property)) /* In this case we have to explcitly generate and convert a QJSValue */ + property.write(QVariant::fromValue(engine()->newQObject(object))); + else + property.write(objectToVariant(object)); if (QQuickItem *item = qobject_cast(object)) if (QQuickItem *newParentItem = qobject_cast(newParent)) From 11863cb51781944842dd20eae94fdba359d9a7c7 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 22 Jan 2019 10:56:08 +0100 Subject: [PATCH 12/18] Debugger: add cdb specific symbolAddress Fixes: QTCREATORBUG-21864 Change-Id: I54d89fabd83dd06e5d733519f0b65416077323c9 Reviewed-by: Christian Stenger --- share/qtcreator/debugger/cdbbridge.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/qtcreator/debugger/cdbbridge.py b/share/qtcreator/debugger/cdbbridge.py index d4aab222bbb..9b1dd07810a 100644 --- a/share/qtcreator/debugger/cdbbridge.py +++ b/share/qtcreator/debugger/cdbbridge.py @@ -507,3 +507,7 @@ class Dumper(DumperBase): def putCallItem(self, name, rettype, value, func, *args): return + + def symbolAddress(self, symbolName): + res = self.nativeParseAndEvaluate(symbolName) + return None if res is None else res.address() From 78166b857dc7dc3d06491eee728bc767b1f85281 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 25 Jan 2019 10:50:54 +0100 Subject: [PATCH 13/18] Debugger: Decouple combined engine rampdown further There are apparently uses where one still want to have a fully functional C++ engine even when QML is already done. (cherry picked from commit 3fdb5f53e31f615836b8ed13cecb9527ba165e3c) Task-number: QTCREATORBUG-21857 Change-Id: I5dfd80e5ff02dcc3e5e2d6b5913a75af071f53d3 Reviewed-by: Eike Ziller --- src/plugins/debugger/debuggerengine.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 0925cb79e44..2fb6a803703 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -2543,8 +2543,6 @@ bool DebuggerEngine::isNativeMixedActiveFrame() const void DebuggerEngine::startDying() const { d->m_isDying = true; - if (DebuggerEngine *other = d->m_companionEngine) - other->d->m_isDying = true; } QString DebuggerEngine::runId() const From e109ff6e5fadb0044ea54e3da210f34e6ff9ffb6 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 28 Jan 2019 10:17:09 +0100 Subject: [PATCH 14/18] Tests: Fix handling of optional tests Change-Id: I7ee1cb1a05e1f494a440874f88cb44df6110f802 Reviewed-by: hjk --- tests/auto/debugger/tst_dumpers.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 8f78aa7c47d..c031d4b62ae 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -1699,6 +1699,8 @@ void tst_Dumpers::dumper() return static_cast(item)->internalName() == iname; })); if (!item) { + if (check.optionallyPresent) + return true; qDebug() << "NOT SEEN: " << check.iname; return false; } From ba00dbbe223e08558421e1754d7ba3abe8cc6b77 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 29 Jan 2019 14:48:26 +0100 Subject: [PATCH 15/18] winrt: Fix potential race condition when filling mapping file content Before starting the process step asynchronously, we have to make sure that m_mappingFileContent is initialized properly. Change-Id: I5a2b51319a35bfe397cff994d5f3512f8d76ccf0 Reviewed-by: Joerg Bornemann Reviewed-by: Christian Kandeler --- src/plugins/winrt/winrtpackagedeploymentstep.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/winrt/winrtpackagedeploymentstep.cpp b/src/plugins/winrt/winrtpackagedeploymentstep.cpp index 177d114caba..23104a4a852 100644 --- a/src/plugins/winrt/winrtpackagedeploymentstep.cpp +++ b/src/plugins/winrt/winrtpackagedeploymentstep.cpp @@ -109,8 +109,6 @@ bool WinRtPackageDeploymentStep::init(QList &earlierSteps) void WinRtPackageDeploymentStep::run(QFutureInterface &fi) { - AbstractProcessStep::run(fi); - const QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(target()->kit()); if (!qt) return; @@ -137,6 +135,8 @@ void WinRtPackageDeploymentStep::run(QFutureInterface &fi) } } } + + AbstractProcessStep::run(fi); } bool WinRtPackageDeploymentStep::processSucceeded(int exitCode, QProcess::ExitStatus status) From d363c8101b54f77c17a040e67c168c1f9c68d4a2 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 7 Dec 2018 14:06:07 +0100 Subject: [PATCH 16/18] Tests: Allow removal of objects on the fly Add another option to allow deletion of unused objects on the fly. This option should be used with care. It is recommended to run without -d (or --delete) beforehand and check the results. Anyhow, when deletion is wanted it processes as usual, renames the original objects.map to objects.map~ and recreates the objects.map without the objects that could be deleted. Change-Id: I3898e8b9998e33461140bf4c75887a32d106f22c Reviewed-by: Robert Loehning --- tests/system/tools/findUnusedObjects.py | 49 +++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/tests/system/tools/findUnusedObjects.py b/tests/system/tools/findUnusedObjects.py index a83355ceeb0..09b0064782a 100755 --- a/tests/system/tools/findUnusedObjects.py +++ b/tests/system/tools/findUnusedObjects.py @@ -38,11 +38,13 @@ lastToken = [None, None] stopTokens = ('OP', 'NAME', 'NUMBER', 'ENDMARKER') def parseCommandLine(): - global directory, onlyRemovable, sharedFolders + global directory, onlyRemovable, sharedFolders, deleteObjects parser = OptionParser("\n%prog [OPTIONS] [DIRECTORY]") parser.add_option("-o", "--only-removable", dest="onlyRemovable", action="store_true", default=False, help="list removable objects only") + parser.add_option("-d", "--delete", dest="delete", + action="store_true", default=False) parser.add_option("-s", dest="sharedFolders", action="store", type="string", default="", help="comma-separated list of shared folders") @@ -56,6 +58,7 @@ def parseCommandLine(): parser.print_help() sys.exit(1) onlyRemovable = options.onlyRemovable + deleteObjects = options.delete sharedFolders = map(os.path.abspath, options.sharedFolders.split(',')) def collectObjects(): @@ -153,15 +156,53 @@ def printResult(): print return None -def main(): +def deleteRemovable(): global useCounts, objMap + + deletable = filter(lambda x: useCounts[x] == 0, useCounts) + if len(deletable) == 0: + print("Nothing to delete - leaving objects.map untouched") + return + + data = '' + with open(objMap, "r") as objMapFile: + data = objMapFile.read() + + objMapBackup = objMap + '~' + if os.path.exists(objMapBackup): + os.unlink(objMapBackup) + os.rename(objMap, objMapBackup) + + count = 0 + with open(objMap, "w") as objMapFile: + for line in data.splitlines(): + try: + obj = line.split('\t')[0] + if obj in deletable: + count += 1 + continue + objMapFile.write(line + '\n') + except: + print("Something's wrong in line '%s'" % line) + + print("Deleted %d items, old objects.map has been moved to objects.map~" % count) + return count > 0 + +def main(): + global useCounts, objMap, deleteObjects objMap = checkDirectory(directory) useCounts = dict.fromkeys(collectObjects(), 0) findUsages() atLeastOneRemovable = printResult() + deletedAtLeastOne = deleteObjects and deleteRemovable() + + mssg = None if atLeastOneRemovable: - print "\nAfter removing the listed objects you should re-run this tool" - print "to find objects that might have been used only by these objects.\n" + mssg = "\nAfter removing the listed objects you should re-run this tool\n" + if deletedAtLeastOne: + mssg = "\nYou should re-run this tool\n" + if mssg: + print(mssg + "to find objects that might have been referenced only by removed objects.\n") return 0 if __name__ == '__main__': From bc623f4178081735ff83119e9a474dfef8b4d8f1 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Wed, 23 Jan 2019 15:51:12 +0100 Subject: [PATCH 17/18] Doc: Add methods supported in ui.qml files Fixes: QDS-379 Change-Id: Ib036be5d9c187a416d05b8eb9503723b41532e9d Reviewed-by: Thomas Hartmann --- doc/src/qtquick/qtquick-ui-forms.qdoc | 96 ++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 3 deletions(-) diff --git a/doc/src/qtquick/qtquick-ui-forms.qdoc b/doc/src/qtquick/qtquick-ui-forms.qdoc index 8a320061db4..fe4f7d5ee45 100644 --- a/doc/src/qtquick/qtquick-ui-forms.qdoc +++ b/doc/src/qtquick/qtquick-ui-forms.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Creator documentation. @@ -53,8 +53,6 @@ \list \li JavaScript blocks - \li Function definitions - \li Function calls (except \c qsTr) \li Other bindings than pure expressions \li Signal handlers \li States in other items than the root item @@ -74,6 +72,98 @@ \li Transition \endlist + \section1 Supported Methods + + \QC supports most JavaScript functions that are supported by the QML + engine, as well as a subset of Qt QML methods. + + This section lists the functions that you can use in \e .ui.qml files. + + \section2 JavaScript Functions + + As a rule of thumb, \e {pure functions} are supported. They only depend on + and modify states of parameters that are within their scope, and therefore + always return the same results when given the same parameters. This makes + it possible to convert and reformat property bindings without breaking the + \e .ui.qml files. + + The following JavaScript functions are supported: + + \list + \li \c charAt() + \li \c charCodeAt() + \li \c concat() + \li \c endsWith() + \li \c includes() + \li \c indexOf() + \li \c isFinite() + \li \c isNaN() + \li \c lastIndexOf() + \li \c substring() + \li \c toExponential() + \li \c toFixed() + \li \c toLocaleLowerCase() + \li \c toLocaleString + \li \c toLocaleUpperCase() + \li \c toLowerCase() + \li \c toPrecision() + \li \c toString() + \li \c toUpperCase() + \li \c valueOf() + \endlist + + In addition, all functions of the \c Math and \c Date objects are supported. + + For more information, see + \l{https://doc.qt.io/qt-5/qtqml-javascript-functionlist.html} + {List of JavaScript Objects and Functions}. + + \section2 Qt QML Methods + + \QC supports color methods, helper methods for creating objects of + specific data types, and translation methods. + + The following color methods are supported: + + \list + \li \l{Qt::darker()}{Qt.darker()} + \li \l{Qt::hsla()}{Qt.hsla()} + \li \l{Qt::hsva()}{Qt.hsva()} + \li \l{Qt::lighter()}{Qt.lighter()} + \li \l{Qt::rgba()}{Qt.rgba()} + \li \l{Qt::tint()}{Qt.tint()} + \endlist + + The following helper methods are supported: + + \list + \li \l{Qt::formatDate()}{Qt.formatDate()} + \li \l{Qt::formatDateTime()}{Qt.formatDateTime()} + \li \l{Qt::formatTime()}{Qt.formatTime()} + \li \l{Qt::matrix4x4()}{Qt.matrix4x4()} + \li \l{Qt::point()}{Qt.point()} + \li \l{Qt::quaternion()}{Qt.quaternion()} + \li \l{Qt::rect()}{Qt.rect()} + \li \l{Qt::size()}{Qt.size()} + \li \l{Qt::vector2d()}{Qt.vector2d()} + \li \l{Qt::vector3d()}{Qt.vector3d()} + \li \l{Qt::vector4d()}{Qt.vector4d()} + \endlist + + The following translation methods are supported: + + \list + \li \l{Qt::}{qsTr()} + \li \l{Qt::}{qsTranslate()} + \li \l{Qt::}{qsTranslateNoOp()} + \li \l{Qt::}{qsTrId()} + \li \l{Qt::}{qsTrIdNoOp()} + \li \l{Qt::}{qsTrNoOp()} + \endlist + + For more information about using the methods, see + \l{https://doc.qt.io/qt-5/qml-qtqml-qt.html}{Qt QML Methods}. + \section1 Using Qt Quick UI Forms You can edit the forms in the \uicontrol {Form Editor} and From ac382b68b7c67af45096cb590fc537b5794e8f27 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Wed, 30 Jan 2019 14:26:56 +0100 Subject: [PATCH 18/18] Doc: Show button examples also in Qt Design Studio Manual Use defines to display the correct menu paths to the wizards. Change-Id: I2cd6dff049a674e9646639fa928f7353d97037ac Reviewed-by: Thomas Hartmann --- .../{creator-only => }/qtquick-buttons.qdoc | 10 +++++++++- doc/src/qtquick/qtquick-components.qdoc | 17 +++++++---------- doc/src/qtquick/qtquick-navigator.qdoc | 6 +----- 3 files changed, 17 insertions(+), 16 deletions(-) rename doc/src/qtquick/{creator-only => }/qtquick-buttons.qdoc (97%) diff --git a/doc/src/qtquick/creator-only/qtquick-buttons.qdoc b/doc/src/qtquick/qtquick-buttons.qdoc similarity index 97% rename from doc/src/qtquick/creator-only/qtquick-buttons.qdoc rename to doc/src/qtquick/qtquick-buttons.qdoc index 00a09a7ccca..0f7c5f5235e 100644 --- a/doc/src/qtquick/creator-only/qtquick-buttons.qdoc +++ b/doc/src/qtquick/qtquick-buttons.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Creator documentation. @@ -42,7 +42,11 @@ \list 1 \li Select \uicontrol File > \uicontrol {New File or Project} > + \if defined(qtcreator) \uicontrol Qt > \uicontrol {QML File (Qt Quick 2)} > + \else + \uicontrol {Qt Quick Files} > \uicontrol {Qt Quick File} > + \endif \uicontrol Choose to create a QML file called Button.qml (for example). @@ -147,7 +151,11 @@ \list 1 \li Select \uicontrol File > \uicontrol {New File or Project} > + \if defined(qtcreator) \uicontrol Qt > \uicontrol {QML File (Qt Quick 2)} > + \else + \uicontrol {Qt Quick Files} > \uicontrol {Qt Quick File} > + \endif \uicontrol Choose to create a QML file called Button.qml (for example). diff --git a/doc/src/qtquick/qtquick-components.qdoc b/doc/src/qtquick/qtquick-components.qdoc index 7a83860c722..77e0a8c58a3 100644 --- a/doc/src/qtquick/qtquick-components.qdoc +++ b/doc/src/qtquick/qtquick-components.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Creator documentation. @@ -33,11 +33,7 @@ \contentspage index.html \page quick-components.html \previouspage creator-using-qt-quick-designer.html - \if defined(qtdesignstudio) - \nextpage qtquick-navigator.html - \else \nextpage quick-buttons.html - \endif \title Creating Components @@ -466,15 +462,17 @@ Some ready-made controls, such as a gauge, dial, status indicator, and tumbler, are provided by the \l {Qt Quick Extras} module. - \if defined(qtcreator) \section1 Creating Components in Design Mode \list 1 \li Select \uicontrol File > \uicontrol {New File or Project} > - \uicontrol {Files and Classes} > \uicontrol Qt > - \uicontrol {QML File (Qt Quick 2)} > \uicontrol Choose to create a new .qml - file. + \if defined(qtcreator) + \uicontrol Qt > \uicontrol {QML File (Qt Quick 2)} > + \else + \uicontrol {Qt Quick Files} > \uicontrol {Qt Quick File} > + \endif + \uicontrol Choose to create a new .qml file. \note Components are listed in the \uicontrol {QML Components} section of the \uicontrol Library only if the filename begins with a capital @@ -501,7 +499,6 @@ \li \l{Creating Scalable Buttons and Borders} \endlist - \endif \section1 Moving Within Components diff --git a/doc/src/qtquick/qtquick-navigator.qdoc b/doc/src/qtquick/qtquick-navigator.qdoc index e61e517bac9..0215df96bec 100644 --- a/doc/src/qtquick/qtquick-navigator.qdoc +++ b/doc/src/qtquick/qtquick-navigator.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Creator documentation. @@ -26,11 +26,7 @@ /*! \contentspage {Qt Creator Manual} \page qtquick-navigator.html - \if defined(qtdesignstudio) - \previouspage quick-components.html - \else \previouspage quick-scalable-image.html - \endif \nextpage qtquick-properties.html \title Managing Item Hierarchy