From c6301ec79747e4568264b69adedeebe25f4b6cd3 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 25 Jul 2019 13:21:16 +0200 Subject: [PATCH 01/22] PerfProfiler: Fix warning from SignalSlotEditor::fromUi() It said 'no destination widget called "PerfLoadDialog"'. Another fix might have been to use "PerfProfiler::Internal::PerfLoadDialog", but since the connection is done in code, and I actually prefer that way, this remove the broken connections from the .ui file. Change-Id: I04652bece855c90a11fd2ea2bb872717a3cde88a Reviewed-by: Eike Ziller --- src/plugins/perfprofiler/perfloaddialog.ui | 34 ---------------------- 1 file changed, 34 deletions(-) diff --git a/src/plugins/perfprofiler/perfloaddialog.ui b/src/plugins/perfprofiler/perfloaddialog.ui index c08b6433f1a..dc6ae1972ac 100644 --- a/src/plugins/perfprofiler/perfloaddialog.ui +++ b/src/plugins/perfprofiler/perfloaddialog.ui @@ -109,38 +109,4 @@ - - - buttonBox - accepted() - PerfLoadDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - PerfLoadDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - From 2ad475a4f57ce2b7af9f1f31be4f852113cdd0a3 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 17 Jul 2019 20:27:40 +0200 Subject: [PATCH 02/22] Squish: Update expected trees Change-Id: I4962634155ba37780781bbd2b0f25f1d2be2a7ec Reviewed-by: Christian Stenger --- .../testdata/projecttree_creator.tsv | 10 +++------- .../testdata/projecttree_creator.tsv | 18 +++++------------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/tests/system/suite_general/tst_opencreator_qbs/testdata/projecttree_creator.tsv b/tests/system/suite_general/tst_opencreator_qbs/testdata/projecttree_creator.tsv index 6e594bcb6c3..eee343829d2 100644 --- a/tests/system/suite_general/tst_opencreator_qbs/testdata/projecttree_creator.tsv +++ b/tests/system/suite_general/tst_opencreator_qbs/testdata/projecttree_creator.tsv @@ -4873,9 +4873,7 @@ "zoomin_overlay@2x.png" "7" "zoomout_overlay.png" "7" "zoomout_overlay@2x.png" "7" -"tooltip" "6" -"images" "7" -"f1.png" "8" +"f1.png" "7" "utils_global.h" "4" "utilsicons.cpp" "4" "utilsicons.h" "4" @@ -7576,10 +7574,8 @@ "debugger.qbs:248" "5" "debuggerunittests.qrc" "5" "/" "6" -"unit-tests" "7" -"simple" "8" -"main.cpp" "9" -"simple.pro" "9" +"main.cpp" "8" +"simple.pro" "8" "Debugger dev headers" "3" "debugger.qbs:6" "4" "Group 1" "4" diff --git a/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv b/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv index 550fda20b6c..4710adcf131 100644 --- a/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv +++ b/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv @@ -4259,9 +4259,7 @@ "zoomin_overlay@2x.png" "8" "zoomout_overlay.png" "8" "zoomout_overlay@2x.png" "8" -"tooltip" "7" -"images" "8" -"f1.png" "9" +"f1.png" "8" "Other files" "3" "utils.qbs" "4" "utils_dependencies" "2" @@ -7292,10 +7290,8 @@ "tracepointoverlay@2x.png" "7" "debuggerunittests.qrc" "4" "/" "5" -"unit-tests" "6" -"simple" "7" -"main.cpp" "8" -"simple.pro" "8" +"main.cpp" "7" +"simple.pro" "7" "Other files" "3" "debugger.qbs" "4" "debugger_dependencies" "2" @@ -18043,9 +18039,7 @@ "zoomin_overlay@2x.png" "8" "zoomout_overlay.png" "8" "zoomout_overlay@2x.png" "8" -"tooltip" "7" -"images" "8" -"f1.png" "9" +"f1.png" "8" "Headers" "3" "echoclangcodemodelserver.h" "4" "Sources" "3" @@ -19279,9 +19273,7 @@ "zoomin_overlay@2x.png" "9" "zoomout_overlay.png" "9" "zoomout_overlay@2x.png" "9" -"tooltip" "8" -"images" "9" -"f1.png" "10" +"f1.png" "9" "gmock_dependency" "3" "gmock_dependency.pri" "4" "Headers" "4" From 1ac892766593664e807a7fb96c7610814a781cb9 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 17 Jul 2019 21:31:06 +0200 Subject: [PATCH 03/22] Squish: Update tst_openqt_creator Change-Id: I2fed662652f7f8f5cbe4b281bdde5791ea57e2d7 Reviewed-by: Christian Stenger --- tests/system/suite_general/tst_openqt_creator/test.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/system/suite_general/tst_openqt_creator/test.py b/tests/system/suite_general/tst_openqt_creator/test.py index d615d7d85fa..230549ecc8d 100644 --- a/tests/system/suite_general/tst_openqt_creator/test.py +++ b/tests/system/suite_general/tst_openqt_creator/test.py @@ -62,12 +62,10 @@ def main(): if not test.verify(object.exists(":Qt Creator_Core::OutputWindow"), "Did the General Messages view show up?"): openGeneralMessages() - # Verify messages appear once, from using default kit before configuring + # Verify message appears once, written before a kit was selected for qtcreator.pro generalMessages = str(waitForObject(":Qt Creator_Core::OutputWindow").plainText) - test.compare(generalMessages.count("Project MESSAGE: Cannot build Qt Creator with Qt version 5.6.1."), 1, - "Warning about outdated Qt shown?") - test.compare(generalMessages.count("Project ERROR: Use at least Qt 5.9.0."), 1, - "Minimum Qt version shown (once when parsing with default kit, once with selected)?") + test.compare(generalMessages.count('Cannot parse project "qtcreator": No kit selected.'), 1, + 'Warning about missing kit selection shown?') # Verify that qmljs.g is in the project even when we don't know where (QTCREATORBUG-17609) selectFromLocator("p qmljs.g", "qmljs.g") From 3987d4fe020c79534b1ba43955929255241ccf0b Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 5 Jul 2019 11:26:07 +0200 Subject: [PATCH 04/22] QmlDesigner: Filter item library assets Change-Id: I3d6b1dbfc071e73277ad8ea60ec0e14ec1602bfb Reviewed-by: Brook Cronin Reviewed-by: Tim Jenssen --- .../propertyeditor/fileresourcesmodel.cpp | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp index 245d6047074..0b5f79a39e7 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp @@ -162,6 +162,33 @@ QVariant FileResourcesModel::modelNodeBackend() const return QVariant(); } +bool filterMetaIcons(const QString &fileName) +{ + + QFileInfo info(fileName); + + if (info.dir().path().split("/").contains("designer")) { + + QDir currentDir = info.dir(); + + int i = 0; + while (!currentDir.isRoot() && i < 3) { + if (currentDir.dirName() == "designer") { + if (!currentDir.entryList({"*.metainfo"}).isEmpty()) + return false; + } + + currentDir.cdUp(); + ++i; + } + + if (info.dir().dirName() == "designer") + return false; + } + + return true; +} + void FileResourcesModel::setupModel() { m_lock = true; @@ -174,7 +201,8 @@ void FileResourcesModel::setupModel() QDirIterator it(m_dirPath.absolutePath(), filterList, QDir::Files, QDirIterator::Subdirectories); while (it.hasNext()) { QString absolutePath = it.next(); - m_model.append(m_dirPath.relativeFilePath(absolutePath)); + if (filterMetaIcons(absolutePath)) + m_model.append(m_dirPath.relativeFilePath(absolutePath)); } m_lock = false; From 2a15098c98aa43a59e8ca3a79e4ee37004e58e57 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 26 Jul 2019 16:52:18 +0200 Subject: [PATCH 05/22] Update qbs submodule To HEAD of 1.14 branch. Change-Id: Ie8884427e1d46e2c0aae47ef5a45730d8fba6134 Reviewed-by: hjk --- src/shared/qbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/qbs b/src/shared/qbs index 27b78ea67f8..2269ddc60e4 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit 27b78ea67f82fca051666599603273c12ecb403b +Subproject commit 2269ddc60e47bfea459ef034ab1be112716b4764 From f9659211ac4dffacc62437ef5363300e42f243c2 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Mon, 29 Jul 2019 13:51:43 +0200 Subject: [PATCH 06/22] CMake: Fix target names for "current executable" selection This patch is not applicable to the master-branch: The buildkeys for cmake targets have changed there. Task-number: QTCREATORBUG-22634 Change-Id: I1c8abc42792a004bdadc893129c96e1b7ed428f6 Reviewed-by: Eike Ziller --- src/plugins/cmakeprojectmanager/cmakebuildstep.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index 364337308ba..911ac7ae2f0 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -349,10 +349,15 @@ Utils::CommandLine CMakeBuildStep::cmakeCommand(CMakeRunConfiguration *rc) const QString target; if (isCurrentExecutableTarget(m_buildTarget)) { - if (rc) - target = rc->buildKey().section('\n', 0, 0); - else + if (rc) { + target = rc->buildKey(); + const int pos = target.indexOf("///::///"); + if (pos >= 0) { + target = target.mid(pos + 8); + } + } else { target = "<" + tr(ADD_RUNCONFIGURATION_TEXT) + ">"; + } } else { target = m_buildTarget; } From 9481845293a863e6d37af2abad9b3a2fdb9f075d Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 23 Jul 2019 13:05:07 +0200 Subject: [PATCH 07/22] CMake: Add helper method to find the default build target for a BuildStep Add a helper method to find the default build target for a CMakeBuildStep based on the BuildStepList the step is part of. Use all/install/clean targets as appropriate. This change has been cherry-picked from master branch: 8b9821440d0c74083476f5b80c7212de71d4013a Change-Id: Idc0c5fae7dfd255039b87ace77c02688cdd76e8f Reviewed-by: Eike Ziller --- .../cmakeprojectmanager/cmakebuildstep.cpp | 21 ++++++++++++------- .../cmakeprojectmanager/cmakebuildstep.h | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index 911ac7ae2f0..cc2bcbfeb60 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -91,14 +91,8 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl) : } // Set a good default build target: - if (m_buildTarget.isEmpty()) { - if (bsl->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) - setBuildTarget(cleanTarget()); - else if (bsl->id() == ProjectExplorer::Constants::BUILDSTEPS_DEPLOY) - setBuildTarget(installTarget()); - else - setBuildTarget(allTarget()); - } + if (m_buildTarget.isEmpty()) + setBuildTarget(defaultBuildTarget()); connect(target(), &Target::kitChanged, this, &CMakeBuildStep::cmakeCommandChanged); connect(project(), &Project::parsingFinished, @@ -277,6 +271,17 @@ BuildStepConfigWidget *CMakeBuildStep::createConfigWidget() return new CMakeBuildStepConfigWidget(this); } +QString CMakeBuildStep::defaultBuildTarget() const +{ + const ProjectConfiguration *const pc = qobject_cast(parent()); + const Core::Id parentId = pc ? pc->id() : Core::Id(); + if (parentId == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) + return cleanTarget(); + if (parentId == ProjectExplorer::Constants::BUILDSTEPS_DEPLOY) + return installTarget(); + return allTarget(); +} + void CMakeBuildStep::stdOutput(const QString &line) { if (m_percentProgress.indexIn(line) != -1) { diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.h b/src/plugins/cmakeprojectmanager/cmakebuildstep.h index 9b906f883fa..51f621abc79 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.h +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.h @@ -98,6 +98,8 @@ private: void doRun() override; ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override; + QString defaultBuildTarget() const; + void runImpl(); void handleProjectWasParsed(bool success); From cf65db29e7de4bbaa484008786493b765ef411bc Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 23 Jul 2019 13:07:05 +0200 Subject: [PATCH 08/22] CMake: Update target list in build step list widget Update the target list in the build step list widget for CMakeBuildSteps, even when "current executable" meta-target is selected. This change was cherry-picked from master branch: ce7407dc03d94b034d5079944e2dd2d38f187815 Change-Id: Ifc1d8dc67894202eb38fe6088552797b198c7463 Reviewed-by: Eike Ziller --- src/plugins/cmakeprojectmanager/cmakebuildstep.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index cc2bcbfeb60..a46de056426 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -113,10 +113,10 @@ void CMakeBuildStep::handleBuildTargetChanges(bool success) { if (!success) return; // Do not change when parsing failed. - if (isCurrentExecutableTarget(m_buildTarget)) - return; // Do not change just because a different set of build targets is there... - if (!static_cast(project())->buildTargetTitles().contains(m_buildTarget)) + if (!isCurrentExecutableTarget(m_buildTarget) + && !static_cast(project())->buildTargetTitles().contains(m_buildTarget)) { setBuildTarget(allTarget()); + } emit buildTargetsChanged(); } From 6e49f78b13d4bda91f0599fb3c2f0af76af14746 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 23 Jul 2019 13:08:17 +0200 Subject: [PATCH 09/22] CMake: Select better default target when a buildstep's target is no longer found Select a better fallback target when a buildstep's target is no longer defined. This change was cherry-picked from master branch: 9519f125e93d00221e962a1e1d3907839dac5d00 Change-Id: I7ef27361793125258cd2a73448d91d2561db5901 Reviewed-by: Eike Ziller --- src/plugins/cmakeprojectmanager/cmakebuildstep.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index a46de056426..05ce969a852 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -115,7 +115,7 @@ void CMakeBuildStep::handleBuildTargetChanges(bool success) return; // Do not change when parsing failed. if (!isCurrentExecutableTarget(m_buildTarget) && !static_cast(project())->buildTargetTitles().contains(m_buildTarget)) { - setBuildTarget(allTarget()); + setBuildTarget(defaultBuildTarget()); } emit buildTargetsChanged(); } From 87a71794b23963c5f3d877a6b42fb52dd869f8c7 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 29 Jul 2019 15:35:21 +0200 Subject: [PATCH 10/22] CMake build: Fix compilation of QtWebEngine help backend Change-Id: Ic0a719ad0fc6b6444a4c0a8b0677d5f66de6d74f Reviewed-by: Cristian Adam Reviewed-by: Eike Ziller --- src/plugins/help/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/help/CMakeLists.txt b/src/plugins/help/CMakeLists.txt index 7f3c05a75e9..e96f15d91cc 100644 --- a/src/plugins/help/CMakeLists.txt +++ b/src/plugins/help/CMakeLists.txt @@ -42,6 +42,7 @@ find_package(Qt5WebEngineWidgets QUIET) extend_qtc_plugin(Help CONDITION TARGET Qt5::WebEngineWidgets DEPENDS Qt5::WebEngineWidgets + DEFINES QTC_WEBENGINE_HELPVIEWER SOURCES webenginehelpviewer.cpp webenginehelpviewer.h From c253bfaf65589ecaaeb118ee4006680b21c85346 Mon Sep 17 00:00:00 2001 From: Vikas Pachdha Date: Mon, 29 Jul 2019 15:57:23 +0200 Subject: [PATCH 11/22] QmlDesigner: Add Text to list of known Enum scopes Change-Id: I58a5af6232c93df24ef0a515630b8c309d36264d Reviewed-by: Thomas Hartmann --- .../qmldesigner/designercore/model/texttomodelmerger.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index b9b82f5714f..ea72cc51a20 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -97,7 +97,8 @@ QStringList globalQtEnums() QStringList knownEnumScopes() { static const QStringList list = { - "TextInput", "TextEdit", "Material", "Universal", "Font", "Shape", "ShapePath", "AbstractButton" + "TextInput", "TextEdit", "Material", "Universal", "Font", "Shape", "ShapePath", + "AbstractButton", "Text" }; return list; } From a96878932461541e0c094e7a231634d9657923aa Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Mon, 29 Jul 2019 18:18:19 +0200 Subject: [PATCH 12/22] Squish: Stabilize tst_qml_js_console Change-Id: Id5c72fffddcbf88ece36b4109621e10e2a030532 Reviewed-by: Christian Stenger --- tests/system/suite_debugger/tst_qml_js_console/test.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/system/suite_debugger/tst_qml_js_console/test.py b/tests/system/suite_debugger/tst_qml_js_console/test.py index 329839cb7fe..b94303bfb1b 100644 --- a/tests/system/suite_debugger/tst_qml_js_console/test.py +++ b/tests/system/suite_debugger/tst_qml_js_console/test.py @@ -139,6 +139,7 @@ def main(): switchViewTo(ViewConstants.EDIT) # start debugging clickButton(fancyDebugButton) + progressBarWait() waitForObject(":Locals and Expressions_Debugger::Internal::WatchTreeView") rootIndex = getQModelIndexStr("text='QQmlEngine'", ":Locals and Expressions_Debugger::Internal::WatchTreeView") @@ -147,7 +148,9 @@ def main(): doubleClick(waitForObject(mainRect)) if not object.exists(":DebugModeWidget_Debugger::Internal::ConsoleView"): invokeMenuItem("Window", "Output Panes", "QML Debugger Console") - progressBarWait() + # Window might be too small to show Locals, so close what we don't need + for view in ("Stack", "Breakpoints", "Expressions"): + invokeMenuItem("Window", "Views", view) # color and float values have additional ZERO WIDTH SPACE (\u200b), different usage of # whitespaces inside expressions is part of the test checks = [("color", u"#\u200b008000"), ("width", "50"), From ef95a19a5f0f76dd0e2a5b7cb198fbff17a9bf57 Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Thu, 25 Jul 2019 15:16:40 +0200 Subject: [PATCH 13/22] QmlDesigner: Update GradientDialogPopup Controls 2 * Add background radius property to AbstractButton * Use AbstractButton instead of Controls 1 Button for GradientDialogPopup * Remove a few unnecessary imports Change-Id: I02e0c5f198bd701d144effc5a574fc247182ffb4 Reviewed-by: Thomas Hartmann --- .../HelperWidgets/GradientDialogPopup.qml | 31 +++---------------- .../HelperWidgets/GradientPopupIndicator.qml | 1 - .../imports/StudioControls/AbstractButton.qml | 1 + 3 files changed, 6 insertions(+), 27 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientDialogPopup.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientDialogPopup.qml index bbfc5525c7f..a3e886f6b57 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientDialogPopup.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientDialogPopup.qml @@ -25,9 +25,9 @@ import QtQuick 2.1 import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.0 as Controls +import StudioControls 1.0 as StudioControls +import StudioTheme 1.0 as StudioTheme import QtQuickDesignerTheme 1.0 -import QtQuick.Controls.Styles 1.1 Loader { id: gradientDialogLoader @@ -93,33 +93,12 @@ Loader { text: qsTr("Gradient Properties") } - Button { + StudioControls.AbstractButton { width: 16 height: 16 - style: ButtonStyle { - background: Item { - Image { - width: 16 - height: 16 - source: "image://icons/error" - opacity: { - if (control.pressed) - return 0.8 - return 1.0 - } - Rectangle { - z: -1 - anchors.fill: parent - color: control.pressed - || control.hovered ? Theme.qmlDesignerBackgroundColorDarker() : Theme.qmlDesignerButtonColor() - border.color: Theme.qmlDesignerBorderColor() - radius: 2 - } - } - } - } + buttonIcon: StudioTheme.Constants.closeCross onClicked: gradientDialogLoader.visible = false - + backgroundRadius: 2 anchors.right: parent.right anchors.top: parent.top anchors.margins: 4 diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPopupIndicator.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPopupIndicator.qml index f39486c78fa..1f617e44377 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPopupIndicator.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPopupIndicator.qml @@ -25,7 +25,6 @@ import QtQuick 2.1 import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.0 as Controls Image { id: root diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/AbstractButton.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/AbstractButton.qml index 4dec58d4b6c..222334f7cae 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/AbstractButton.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/AbstractButton.qml @@ -33,6 +33,7 @@ T.AbstractButton { property alias buttonIcon: buttonIcon.text property alias iconColor: buttonIcon.color property alias backgroundVisible: buttonBackground.visible + property alias backgroundRadius: buttonBackground.radius implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding) From 0e159760e549e2684789951f7a52b762efa4beb8 Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Thu, 25 Jul 2019 14:27:41 +0200 Subject: [PATCH 14/22] QmlDesigner: Fix context menu looks Change-Id: I6d8a87354456ced6420b62f6a8bfa73a81ce6228 Reviewed-by: Thomas Hartmann --- .../imports/StudioControls/ContextMenu.qml | 17 ++++++++--------- .../imports/StudioControls/MenuItem.qml | 9 ++------- .../imports/StudioControls/MenuSeparator.qml | 5 ++--- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ContextMenu.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ContextMenu.qml index 8589d8129f0..9d7685534a9 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ContextMenu.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ContextMenu.qml @@ -24,20 +24,19 @@ ****************************************************************************/ import QtQuick 2.12 -import QtQuick.Controls 2.12 as Controls2 Menu { id: contextMenu property Item myTextEdit - Controls2.MenuItem { + MenuItem { text: "Undo" enabled: myTextEdit.canUndo onTriggered: myTextEdit.undo() /* shortcut: StandardKey.Undo Shortcuts in QQC2 seem to override global shortcuts */ } - Controls2.MenuItem { + MenuItem { text: "Redo" enabled: myTextEdit.canRedo onTriggered: myTextEdit.redo() @@ -47,32 +46,32 @@ Menu { MenuSeparator { } - Controls2.MenuItem { + MenuItem { text: "Copy" enabled: myTextEdit.selectedText !== "" onTriggered: myTextEdit.copy() /* shortcut: StandardKey.Copy Shortcuts in QQC2 seem to override global shortcuts */ } - Controls2.MenuItem { + MenuItem { text: "Cut" enabled: myTextEdit.selectedText !== "" && !myTextEdit.readOnly onTriggered: myTextEdit.cut() /* shortcut: StandardKey.Cut Shortcuts in QQC2 seem to override global shortcuts */ } - Controls2.MenuItem { + MenuItem { text: "Paste" enabled: myTextEdit.canPaste onTriggered: myTextEdit.paste() /* shortcut: StandardKey.Paste Shortcuts in QQC2 seem to override global shortcuts */ } - Controls2.MenuItem { + MenuItem { text: "Delete" enabled: myTextEdit.selectedText !== "" onTriggered: myTextEdit.remove(myTextEdit.selectionStart, myTextEdit.selectionEnd) /* shortcut: StandardKey.Delete Shortcuts in QQC2 seem to override global shortcuts */ } - Controls2.MenuItem { + MenuItem { text: "Clear" enabled: myTextEdit.text !== "" onTriggered: myTextEdit.clear() @@ -82,7 +81,7 @@ Menu { MenuSeparator { } - Controls2.MenuItem { + MenuItem { text: "Select All" enabled: myTextEdit.text !== "" && myTextEdit.selectedText !== myTextEdit.text diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuItem.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuItem.qml index ff3c1396794..023f9b0f5dc 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuItem.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuItem.qml @@ -46,11 +46,6 @@ T.MenuItem { action: Action {} contentItem: Item { - id: menuItem - - width: control.menu.width - height: StudioTheme.Values.height - Text { id: textLabel text: control.text @@ -77,11 +72,11 @@ T.MenuItem { background: Rectangle { implicitWidth: textLabel.implicitWidth + control.labelSpacing + shortcutLabel.implicitWidth - + control.leftPadding + control.rightPadding // TODO + + control.leftPadding + control.rightPadding implicitHeight: StudioTheme.Values.height x: StudioTheme.Values.border y: StudioTheme.Values.border - width: control.width - (StudioTheme.Values.border * 2) + width: control.menu.width - (StudioTheme.Values.border * 2) height: control.height - (StudioTheme.Values.border * 2) color: control.down ? control.palette.midlight : control.highlighted ? StudioTheme.Values.themeInteraction : "transparent" } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuSeparator.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuSeparator.qml index 4e226f5c584..a2f2f57e946 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuSeparator.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/MenuSeparator.qml @@ -36,11 +36,10 @@ T.MenuSeparator { implicitContentHeight + topPadding + bottomPadding) padding: 0 - verticalPadding: padding contentItem: Rectangle { - implicitWidth: 10 - implicitHeight: StudioTheme.Values.border + width: control.parent.width + height: StudioTheme.Values.border color: StudioTheme.Values.themeControlOutline } } From 6135726f4a62fbf825a9aa33a527c5db5ee0b7d1 Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Wed, 24 Jul 2019 12:28:35 +0200 Subject: [PATCH 15/22] QmlDesigner: Fix standalone ActionIndicator hover Change-Id: I55dbcdffcd755ea16e3dcfb17683c27f3e77e49f Reviewed-by: Thomas Hartmann --- .../imports/StudioControls/ActionIndicator.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml index 6e4f44ae73e..e261ebed677 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml @@ -60,7 +60,8 @@ Rectangle { State { name: "hovered" when: actionIndicator.hover && !actionIndicator.pressed - && !myControl.edit && !myControl.drag && myControl.enabled + && (!myControl || (!myControl.edit && !myControl.drag)) + && actionIndicator.enabled PropertyChanges { target: actionIndicatorIcon scale: 1.2 @@ -68,7 +69,7 @@ Rectangle { }, State { name: "disabled" - when: !myControl.enabled + when: !actionIndicator.enabled PropertyChanges { target: actionIndicatorIcon color: StudioTheme.Values.themeTextColorDisabled From 6c3be76c8d6f4d0918c8cb3e49f59e8a1a7c06f1 Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Wed, 24 Jul 2019 14:09:15 +0200 Subject: [PATCH 16/22] QmlDesigner: Update origin control OriginControl replaces ExtendedFunctionButton with a combination of ExtentendedFunctionLogic and a standalone ActionIndicator. Also changes width and height to current style guide. Change-Id: Idcad01505b1a61964a9a11c3b71c948c6d2a8d7b Reviewed-by: Thomas Hartmann --- .../imports/HelperWidgets/OriginControl.qml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginControl.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginControl.qml index dab46aa0ce1..da2f2cac88d 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginControl.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginControl.qml @@ -25,6 +25,7 @@ import QtQuick 2.1 import QtQuickDesignerTheme 1.0 +import StudioTheme 1.0 as StudioTheme Item { width: grid.width @@ -41,10 +42,19 @@ Item { readonly property color selectedColor: Theme.qmlDesignerBackgroundColorDarkAlternate() readonly property color unselectedColor: Theme.qmlDesignerBackgroundColorDarker() - ExtendedFunctionButton { + ExtendedFunctionLogic { + id: extFuncLogic backendValue: originControl.backendValue - visible: originControl.enabled + } + + ActionIndicator { anchors.left: grid.right + anchors.leftMargin: grid.spacing + + visible: originControl.enabled + icon.color: extFuncLogic.color + icon.text: extFuncLogic.glyph + onClicked: extFuncLogic.show() } ColorLogic { @@ -100,8 +110,8 @@ Item { Rectangle { property bool selected: false id: topLeft - width: 15 - height: 15 + width: StudioTheme.Values.height + height: StudioTheme.Values.height color: selected ? selectedColor : unselectedColor border.width: selected ? 2 : 1 border.color: selected ? originControl.borderColorSelected : originControl.borderColor From c020fb6e3e5e2cb4ab4dcdb76fbc7693b1e45c96 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 26 Jul 2019 08:28:17 +0200 Subject: [PATCH 17/22] AutoTest: Fix parsing of multiple test cases in single qml file Quick tests allow definition of more than one TestCase inside a qml file and even nesting is possible, so support this correctly. Fixes: QTCREATORBUG-22761 Change-Id: I65fcc7cd6063d976d798c3e900d3299a12e2d73f Reviewed-by: David Schulz --- src/plugins/autotest/autotestunittests.cpp | 8 ++-- .../autotest/quick/quicktestparser.cpp | 39 +++++++++-------- .../autotest/quick/quicktesttreeitem.cpp | 20 ++++++--- .../autotest/quick/quicktesttreeitem.h | 2 + .../autotest/quick/quicktestvisitors.cpp | 31 +++++++++---- .../autotest/quick/quicktestvisitors.h | 17 +++++--- .../tests/auto/quickauto/tst_test2.qml | 43 +++++++++++++------ 7 files changed, 104 insertions(+), 56 deletions(-) diff --git a/src/plugins/autotest/autotestunittests.cpp b/src/plugins/autotest/autotestunittests.cpp index 614a61a6c27..b571ed13546 100644 --- a/src/plugins/autotest/autotestunittests.cpp +++ b/src/plugins/autotest/autotestunittests.cpp @@ -131,13 +131,13 @@ void AutoTestUnitTests::testCodeParser_data() << 1 << 0 << 0 << 0; QTest::newRow("mixedAutoTestAndQuickTests") << QString(m_tmpDir->path() + "/mixed_atp/mixed_atp.pro") - << 4 << 7 << 3 << 10; + << 4 << 10 << 4 << 10; QTest::newRow("plainAutoTestQbs") << QString(m_tmpDir->path() + "/plain/plain.qbs") << 1 << 0 << 0 << 0; QTest::newRow("mixedAutoTestAndQuickTestsQbs") << QString(m_tmpDir->path() + "/mixed_atp/mixed_atp.qbs") - << 4 << 7 << 3 << 10; + << 4 << 10 << 4 << 10; } void AutoTestUnitTests::testCodeParserSwitchStartup() @@ -183,8 +183,8 @@ void AutoTestUnitTests::testCodeParserSwitchStartup_data() m_tmpDir->path() + "/mixed_atp/mixed_atp.qbs"}); QList expectedAutoTests = QList() << 1 << 4 << 1 << 4; - QList expectedNamedQuickTests = QList() << 0 << 7 << 0 << 7; - QList expectedUnnamedQuickTests = QList() << 0 << 3 << 0 << 3; + QList expectedNamedQuickTests = QList() << 0 << 10 << 0 << 10; + QList expectedUnnamedQuickTests = QList() << 0 << 4 << 0 << 4; QList expectedDataTagsCount = QList() << 0 << 10 << 0 << 10; QTest::newRow("loadMultipleProjects") diff --git a/src/plugins/autotest/quick/quicktestparser.cpp b/src/plugins/autotest/quick/quicktestparser.cpp index 25423255102..14e04c8a2fb 100644 --- a/src/plugins/autotest/quick/quicktestparser.cpp +++ b/src/plugins/autotest/quick/quicktestparser.cpp @@ -190,20 +190,26 @@ static bool checkQmlDocumentForQuickTestCode(QFutureInterface &testFunctions = qmlVisitor.testFunctions(); + const QVector &testFunctions = qmlVisitor.testFunctions(); + + for (const QuickTestCaseSpec &it : testFunctions) { + const QString testCaseName = it.m_caseName; + const QString functionName = it.m_functionName; + const TestCodeLocationAndType &loc = it.m_functionLocationAndType; + + QuickTestParseResult *parseResult = new QuickTestParseResult(id); + parseResult->proFile = proFile; + parseResult->itemType = TestTreeItem::TestCase; + if (!testCaseName.isEmpty()) { + parseResult->fileName = it.m_name; + parseResult->name = testCaseName; + parseResult->line = it.m_line; + parseResult->column = it.m_column; + } - QuickTestParseResult *parseResult = new QuickTestParseResult(id); - parseResult->proFile = proFile; - parseResult->itemType = TestTreeItem::TestCase; - QMap::ConstIterator it = testFunctions.begin(); - const QMap::ConstIterator end = testFunctions.end(); - for ( ; it != end; ++it) { - const TestCodeLocationAndType &loc = it.value(); QuickTestParseResult *funcResult = new QuickTestParseResult(id); - funcResult->name = it.key(); - funcResult->displayName = it.key(); + funcResult->name = functionName; + funcResult->displayName = functionName; funcResult->itemType = loc.m_type; funcResult->fileName = loc.m_name; funcResult->line = loc.m_line; @@ -211,14 +217,9 @@ static bool checkQmlDocumentForQuickTestCode(QFutureInterfaceproFile = proFile; parseResult->children.append(funcResult); + + futureInterface.reportResult(TestParseResultPtr(parseResult)); } - if (!testCaseName.isEmpty()) { - parseResult->fileName = tcLocationAndType.m_name; - parseResult->name = testCaseName; - parseResult->line = tcLocationAndType.m_line; - parseResult->column = tcLocationAndType.m_column; - } - futureInterface.reportResult(TestParseResultPtr(parseResult)); return true; } diff --git a/src/plugins/autotest/quick/quicktesttreeitem.cpp b/src/plugins/autotest/quick/quicktesttreeitem.cpp index 52d3796463e..c18de0ee9e2 100644 --- a/src/plugins/autotest/quick/quicktesttreeitem.cpp +++ b/src/plugins/autotest/quick/quicktesttreeitem.cpp @@ -323,11 +323,11 @@ TestTreeItem *QuickTestTreeItem::find(const TestParseResult *result) TestTreeItem *group = findFirstLevelChild([path](TestTreeItem *group) { return group->filePath() == path; }); - return group ? group->findChildByFile(result->fileName) : nullptr; + return group ? group->findChildByNameAndFile(result->name, result->fileName) : nullptr; } - return findChildByFile(result->fileName); + return findChildByNameAndFile(result->name, result->fileName); case GroupNode: - return findChildByFile(result->fileName); + return findChildByNameAndFile(result->name, result->fileName); case TestCase: return name().isEmpty() ? findChildByNameAndFile(result->name, result->fileName) : findChildByName(result->name); @@ -345,9 +345,9 @@ TestTreeItem *QuickTestTreeItem::findChild(const TestTreeItem *other) case Root: if (otherType == TestCase && other->name().isEmpty()) return unnamedQuickTests(); - return findChildByFileAndType(other->filePath(), otherType); + return findChildByFileNameAndType(other->filePath(), other->name(), otherType); case GroupNode: - return findChildByFileAndType(other->filePath(), otherType); + return findChildByFileNameAndType(other->filePath(), other->name(), otherType); case TestCase: if (otherType != TestFunction && otherType != TestDataFunction && otherType != TestSpecialFunction) return nullptr; @@ -444,6 +444,16 @@ void QuickTestTreeItem::markForRemovalRecursively(const QString &filePath) } } +TestTreeItem *QuickTestTreeItem::findChildByFileNameAndType(const QString &filePath, + const QString &name, + TestTreeItem::Type tType) + +{ + return findFirstLevelChild([filePath, name, tType](const TestTreeItem *other) { + return other->type() == tType && other->name() == name && other->filePath() == filePath; + }); +} + TestTreeItem *QuickTestTreeItem::unnamedQuickTests() const { if (type() != Root) diff --git a/src/plugins/autotest/quick/quicktesttreeitem.h b/src/plugins/autotest/quick/quicktesttreeitem.h index b9f06d6a079..a9e48fca940 100644 --- a/src/plugins/autotest/quick/quicktesttreeitem.h +++ b/src/plugins/autotest/quick/quicktesttreeitem.h @@ -57,6 +57,8 @@ public: QSet internalTargets() const override; void markForRemovalRecursively(const QString &filePath) override; private: + TestTreeItem *findChildByFileNameAndType(const QString &filePath, const QString &name, + Type tType); TestTreeItem *unnamedQuickTests() const; }; diff --git a/src/plugins/autotest/quick/quicktestvisitors.cpp b/src/plugins/autotest/quick/quicktestvisitors.cpp index f9934e735d2..7243530700a 100644 --- a/src/plugins/autotest/quick/quicktestvisitors.cpp +++ b/src/plugins/autotest/quick/quicktestvisitors.cpp @@ -31,6 +31,7 @@ #include #include #include +#include namespace Autotest { namespace Internal { @@ -96,18 +97,23 @@ bool TestQmlVisitor::visit(QmlJS::AST::UiObjectDefinition *ast) m_typeIsTestCase = true; m_insideTestCase = true; - m_currentTestCaseName.clear(); const auto sourceLocation = ast->firstSourceLocation(); - m_testCaseLocation.m_name = m_currentDoc->fileName(); - m_testCaseLocation.m_line = sourceLocation.startLine; - m_testCaseLocation.m_column = sourceLocation.startColumn - 1; - m_testCaseLocation.m_type = TestTreeItem::TestCase; + QuickTestCaseSpec currentSpec; + currentSpec.m_name = m_currentDoc->fileName(); + currentSpec.m_line = sourceLocation.startLine; + currentSpec.m_column = sourceLocation.startColumn - 1; + currentSpec.m_type = TestTreeItem::TestCase; + m_testCases.push(currentSpec); return true; } void TestQmlVisitor::endVisit(QmlJS::AST::UiObjectDefinition *) { - m_insideTestCase = m_objectStack.pop() == "TestCase"; + if (!m_objectStack.isEmpty() && m_objectStack.pop() == "TestCase") { + if (!m_testCases.isEmpty()) + m_testCases.pop(); + m_insideTestCase = !m_objectStack.isEmpty() && m_objectStack.top() == "TestCase"; + } } bool TestQmlVisitor::visit(QmlJS::AST::ExpressionStatement *ast) @@ -148,15 +154,22 @@ bool TestQmlVisitor::visit(QmlJS::AST::FunctionDeclaration *ast) else locationAndType.m_type = TestTreeItem::TestFunction; - m_testFunctions.insert(name.toString(), locationAndType); + if (m_testCases.isEmpty()) // invalid qml code + return false; + + QuickTestCaseSpec testCaseWithFunc = m_testCases.top(); + testCaseWithFunc.m_functionName = name.toString(); + testCaseWithFunc.m_functionLocationAndType = locationAndType; + m_testFunctions.append(testCaseWithFunc); } return false; } bool TestQmlVisitor::visit(QmlJS::AST::StringLiteral *ast) { - if (m_expectTestCaseName && m_currentTestCaseName.isEmpty()) { - m_currentTestCaseName = ast->value.toString(); + if (m_expectTestCaseName) { + QTC_ASSERT(!m_testCases.isEmpty(), return false); + m_testCases.top().m_caseName = ast->value.toString(); m_expectTestCaseName = false; } return false; diff --git a/src/plugins/autotest/quick/quicktestvisitors.h b/src/plugins/autotest/quick/quicktestvisitors.h index 025ce0198db..b4245a5abc5 100644 --- a/src/plugins/autotest/quick/quicktestvisitors.h +++ b/src/plugins/autotest/quick/quicktestvisitors.h @@ -37,6 +37,14 @@ namespace Autotest { namespace Internal { +class QuickTestCaseSpec : public TestCodeLocationAndType +{ +public: + QString m_caseName; + QString m_functionName; + TestCodeLocationAndType m_functionLocationAndType; +}; + class TestQmlVisitor : public QmlJS::AST::Visitor { public: @@ -50,17 +58,14 @@ public: bool visit(QmlJS::AST::FunctionDeclaration *ast) override; bool visit(QmlJS::AST::StringLiteral *ast) override; - QString testCaseName() const { return m_currentTestCaseName; } - TestCodeLocationAndType testCaseLocation() const { return m_testCaseLocation; } - QMap testFunctions() const { return m_testFunctions; } + QVector testFunctions() const { return m_testFunctions; } bool isValid() const { return m_typeIsTestCase; } private: QmlJS::Document::Ptr m_currentDoc; QmlJS::Snapshot m_snapshot; - QString m_currentTestCaseName; - TestCodeLocationAndType m_testCaseLocation; - QMap m_testFunctions; + QStack m_testCases; + QVector m_testFunctions; QStack m_objectStack; bool m_typeIsTestCase = false; bool m_insideTestCase = false; diff --git a/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto/tst_test2.qml b/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto/tst_test2.qml index d0115c5dd74..b6330ac4ea6 100644 --- a/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto/tst_test2.qml +++ b/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto/tst_test2.qml @@ -34,21 +34,38 @@ TestCase { verify(blubb == bla, "Comparing concat equality") } -// nested TestCases actually fail -// TestCase { -// name: "boo" + TestCase { + name: "boo" -// function test_boo() { -// verify(true); -// } + function test_boo() { + verify(true); + } -// TestCase { -// name: "far" + TestCase { + name: "far" -// function test_far() { -// verify(true); -// } -// } -// } + function test_far() { + verify(true); + } + } + + function test_boo2() { // should not get added to "far", but to "boo" + verify(false); + } + } + + TestCase { + name: "secondBoo" + + function test_bar() { + compare(1, 1); + } + } + + TestCase { // unnamed + function test_func() { + verify(true); + } + } } From 6e84529a88a1f51c35b664391c95eea35418aeeb Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 30 Jul 2019 13:17:35 +0200 Subject: [PATCH 18/22] AutoTest: fine tune quick test case specs and fix multiple inheritance Change-Id: I031c8518437b7b396f5b17a51d2067e4b3661530 Reviewed-by: Christian Stenger --- .../autotest/quick/quicktestparser.cpp | 34 +++++++-------- .../autotest/quick/quicktestvisitors.cpp | 41 ++++++++----------- .../autotest/quick/quicktestvisitors.h | 25 ++++++----- 3 files changed, 49 insertions(+), 51 deletions(-) diff --git a/src/plugins/autotest/quick/quicktestparser.cpp b/src/plugins/autotest/quick/quicktestparser.cpp index 14e04c8a2fb..72592b32a0b 100644 --- a/src/plugins/autotest/quick/quicktestparser.cpp +++ b/src/plugins/autotest/quick/quicktestparser.cpp @@ -190,33 +190,33 @@ static bool checkQmlDocumentForQuickTestCode(QFutureInterface &testFunctions = qmlVisitor.testFunctions(); + const QVector &testCases = qmlVisitor.testCases(); - for (const QuickTestCaseSpec &it : testFunctions) { - const QString testCaseName = it.m_caseName; - const QString functionName = it.m_functionName; - const TestCodeLocationAndType &loc = it.m_functionLocationAndType; + for (const QuickTestCaseSpec &testCase : testCases) { + const QString testCaseName = testCase.m_caseName; QuickTestParseResult *parseResult = new QuickTestParseResult(id); parseResult->proFile = proFile; parseResult->itemType = TestTreeItem::TestCase; if (!testCaseName.isEmpty()) { - parseResult->fileName = it.m_name; + parseResult->fileName = testCase.m_locationAndType.m_name; parseResult->name = testCaseName; - parseResult->line = it.m_line; - parseResult->column = it.m_column; + parseResult->line = testCase.m_locationAndType.m_line; + parseResult->column = testCase.m_locationAndType.m_column; } - QuickTestParseResult *funcResult = new QuickTestParseResult(id); - funcResult->name = functionName; - funcResult->displayName = functionName; - funcResult->itemType = loc.m_type; - funcResult->fileName = loc.m_name; - funcResult->line = loc.m_line; - funcResult->column = loc.m_column; - funcResult->proFile = proFile; + for (auto function : testCase.m_functions) { + QuickTestParseResult *funcResult = new QuickTestParseResult(id); + funcResult->name = function.m_functionName; + funcResult->displayName = function.m_functionName; + funcResult->itemType = function.m_locationAndType.m_type; + funcResult->fileName = function.m_locationAndType.m_name; + funcResult->line = function.m_locationAndType.m_line; + funcResult->column = function.m_locationAndType.m_column; + funcResult->proFile = proFile; - parseResult->children.append(funcResult); + parseResult->children.append(funcResult); + } futureInterface.reportResult(TestParseResultPtr(parseResult)); } diff --git a/src/plugins/autotest/quick/quicktestvisitors.cpp b/src/plugins/autotest/quick/quicktestvisitors.cpp index 7243530700a..f60b59b3684 100644 --- a/src/plugins/autotest/quick/quicktestvisitors.cpp +++ b/src/plugins/autotest/quick/quicktestvisitors.cpp @@ -86,34 +86,29 @@ static bool isDerivedFromTestCase(QmlJS::AST::UiQualifiedId *id, const QmlJS::Do bool TestQmlVisitor::visit(QmlJS::AST::UiObjectDefinition *ast) { const QStringRef name = ast->qualifiedTypeNameId->name; - m_objectStack.push(name.toString()); + m_objectIsTestStack.push(false); if (name != "TestCase") { - m_insideTestCase = false; if (!isDerivedFromTestCase(ast->qualifiedTypeNameId, m_currentDoc, m_snapshot)) return true; } else if (!documentImportsQtTest(m_currentDoc.data())) { return true; // find nested TestCase items as well } - m_typeIsTestCase = true; - m_insideTestCase = true; + m_objectIsTestStack.top() = true; const auto sourceLocation = ast->firstSourceLocation(); QuickTestCaseSpec currentSpec; - currentSpec.m_name = m_currentDoc->fileName(); - currentSpec.m_line = sourceLocation.startLine; - currentSpec.m_column = sourceLocation.startColumn - 1; - currentSpec.m_type = TestTreeItem::TestCase; - m_testCases.push(currentSpec); + currentSpec.m_locationAndType.m_name = m_currentDoc->fileName(); + currentSpec.m_locationAndType.m_line = sourceLocation.startLine; + currentSpec.m_locationAndType.m_column = sourceLocation.startColumn - 1; + currentSpec.m_locationAndType.m_type = TestTreeItem::TestCase; + m_caseParseStack.push(currentSpec); return true; } void TestQmlVisitor::endVisit(QmlJS::AST::UiObjectDefinition *) { - if (!m_objectStack.isEmpty() && m_objectStack.pop() == "TestCase") { - if (!m_testCases.isEmpty()) - m_testCases.pop(); - m_insideTestCase = !m_objectStack.isEmpty() && m_objectStack.top() == "TestCase"; - } + if (!m_objectIsTestStack.isEmpty() && m_objectIsTestStack.pop() && !m_caseParseStack.isEmpty()) + m_testCases << m_caseParseStack.pop(); } bool TestQmlVisitor::visit(QmlJS::AST::ExpressionStatement *ast) @@ -124,7 +119,7 @@ bool TestQmlVisitor::visit(QmlJS::AST::ExpressionStatement *ast) bool TestQmlVisitor::visit(QmlJS::AST::UiScriptBinding *ast) { - if (m_insideTestCase) + if (m_objectIsTestStack.top()) m_expectTestCaseName = ast->qualifiedId->name == "name"; return m_expectTestCaseName; } @@ -137,6 +132,9 @@ void TestQmlVisitor::endVisit(QmlJS::AST::UiScriptBinding *) bool TestQmlVisitor::visit(QmlJS::AST::FunctionDeclaration *ast) { + if (m_caseParseStack.isEmpty()) + return false; + const QStringRef name = ast->name; if (name.startsWith("test_") || name.startsWith("benchmark_") @@ -154,13 +152,8 @@ bool TestQmlVisitor::visit(QmlJS::AST::FunctionDeclaration *ast) else locationAndType.m_type = TestTreeItem::TestFunction; - if (m_testCases.isEmpty()) // invalid qml code - return false; - - QuickTestCaseSpec testCaseWithFunc = m_testCases.top(); - testCaseWithFunc.m_functionName = name.toString(); - testCaseWithFunc.m_functionLocationAndType = locationAndType; - m_testFunctions.append(testCaseWithFunc); + m_caseParseStack.top().m_functions.append( + QuickTestFunctionSpec{name.toString(), locationAndType}); } return false; } @@ -168,8 +161,8 @@ bool TestQmlVisitor::visit(QmlJS::AST::FunctionDeclaration *ast) bool TestQmlVisitor::visit(QmlJS::AST::StringLiteral *ast) { if (m_expectTestCaseName) { - QTC_ASSERT(!m_testCases.isEmpty(), return false); - m_testCases.top().m_caseName = ast->value.toString(); + QTC_ASSERT(!m_caseParseStack.isEmpty(), return false); + m_caseParseStack.top().m_caseName = ast->value.toString(); m_expectTestCaseName = false; } return false; diff --git a/src/plugins/autotest/quick/quicktestvisitors.h b/src/plugins/autotest/quick/quicktestvisitors.h index b4245a5abc5..e4af8661c2f 100644 --- a/src/plugins/autotest/quick/quicktestvisitors.h +++ b/src/plugins/autotest/quick/quicktestvisitors.h @@ -37,12 +37,19 @@ namespace Autotest { namespace Internal { -class QuickTestCaseSpec : public TestCodeLocationAndType +class QuickTestFunctionSpec +{ +public: + QString m_functionName; + TestCodeLocationAndType m_locationAndType; +}; + +class QuickTestCaseSpec { public: QString m_caseName; - QString m_functionName; - TestCodeLocationAndType m_functionLocationAndType; + TestCodeLocationAndType m_locationAndType; + QVector m_functions; }; class TestQmlVisitor : public QmlJS::AST::Visitor @@ -58,17 +65,15 @@ public: bool visit(QmlJS::AST::FunctionDeclaration *ast) override; bool visit(QmlJS::AST::StringLiteral *ast) override; - QVector testFunctions() const { return m_testFunctions; } - bool isValid() const { return m_typeIsTestCase; } + QVector testCases() const { return m_testCases; } + bool isValid() const { return !m_testCases.isEmpty(); } private: QmlJS::Document::Ptr m_currentDoc; QmlJS::Snapshot m_snapshot; - QStack m_testCases; - QVector m_testFunctions; - QStack m_objectStack; - bool m_typeIsTestCase = false; - bool m_insideTestCase = false; + QStack m_caseParseStack; + QVector m_testCases; + QStack m_objectIsTestStack; bool m_expectTestCaseName = false; }; From 3363e42024c79ab46b21fcf1d5e96d62d6ae8159 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 30 Jul 2019 15:07:15 +0200 Subject: [PATCH 19/22] QmlDesigner: Fix changing of dynamic properties We have to use lastSourceLocation().end() instead of offset. SourceLocation was refactored and this was forgotten. Change-Id: I6a43b42b48e03b6b289173a85f5a4a98b2a44628 Reviewed-by: Thomas Hartmann --- .../designercore/filemanager/changepropertyvisitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp index b6ed184f9d5..c76b67dceb9 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp @@ -142,7 +142,7 @@ void ChangePropertyVisitor::replaceMemberValue(UiObjectMember *propertyMember, b if (publicMember->semicolonToken.isValid()) endOffset = publicMember->semicolonToken.end(); else - endOffset = publicMember->statement->lastSourceLocation().offset; + endOffset = publicMember->statement->lastSourceLocation().end(); } else { startOffset = publicMember->lastSourceLocation().end(); endOffset = startOffset; From c3e3d40f903912231dcf47a3bd0701bfad6dde1e Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 30 Jul 2019 15:08:49 +0200 Subject: [PATCH 20/22] QmlDesigner: Extend test Change-Id: I3850814303bc791934044f10a955cfcbc78e76ef Reviewed-by: Thomas Hartmann --- tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp index 31ea4e59147..266dc92508f 100644 --- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp +++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp @@ -611,6 +611,8 @@ void tst_TestCore::testRewriterDynamicProperties() const QString inThere = testRewriterView1->rootModelNode().variantProperty("vv").value().value(); QCOMPARE(inThere, QString("Hello")); + rootModelNode.variantProperty("vv").setDynamicTypeNameAndValue("variant", "hallo2"); + // test model2text // QPlainTextEdit textEdit2; // textEdit2.setPlainText("import QtQuick 1.1; Item{}"); From 4cfcdc65a5d6a611048d273cde0480f050eceabc Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Tue, 30 Jul 2019 13:04:28 +0200 Subject: [PATCH 21/22] Squish: Use parameters in another call to mouseClick(...) Reverts e8727fcae25d96da9e55bb5a98dde813e4e5dfa0 for this line. Change-Id: I6ac752985fb9bcb66a38d7f97d8cc8dc33da4189 Reviewed-by: Christian Stenger --- tests/system/suite_general/tst_default_settings/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/suite_general/tst_default_settings/test.py b/tests/system/suite_general/tst_default_settings/test.py index b92a1c93aea..8e8d6b8824e 100644 --- a/tests/system/suite_general/tst_default_settings/test.py +++ b/tests/system/suite_general/tst_default_settings/test.py @@ -94,7 +94,7 @@ def __processSubItems__(treeObjStr, section, parModelIndexStr, doneItems, itObj = "%s occurrence='%d'}" % (itObj[:-1], alreadyDone + 1) currentSelectedTreeItem = waitForObject(itObj, 3000) tree.scrollTo(it) - mouseClick(currentSelectedTreeItem) + mouseClick(currentSelectedTreeItem, 5, 5, 0, Qt.LeftButton) additionalFunc(indexName, *additionalParameters) currentSelectedTreeItem = None if model.rowCount(it) > 0: From e425d88b6b4ff7762a441693fc814c1b2cf87377 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Tue, 30 Jul 2019 13:11:31 +0200 Subject: [PATCH 22/22] Squish: Update clang detection in tst_default_settings Change-Id: Ia1e0332253a309eae9579fff5cae2659a6089c50 Reviewed-by: Christian Stenger --- tests/system/suite_general/tst_default_settings/test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/system/suite_general/tst_default_settings/test.py b/tests/system/suite_general/tst_default_settings/test.py index 8e8d6b8824e..2956f4acbba 100644 --- a/tests/system/suite_general/tst_default_settings/test.py +++ b/tests/system/suite_general/tst_default_settings/test.py @@ -210,6 +210,7 @@ def __getExpectedCompilers__(): compilers = ["g++", "gcc"] if platform.system() in ('Linux', 'Darwin'): compilers.extend(["clang++", "clang", "afl-clang"]) + compilers.extend(findAllFilesInPATH("clang-[0-9]")) compilers.extend(findAllFilesInPATH("clang-[0-9].[0-9]")) compilers.extend(findAllFilesInPATH("*g++*")) compilers.extend(findAllFilesInPATH("*gcc*"))