From 7e526d9b05ea6ab6d19c8ca826f97af86ffa67f2 Mon Sep 17 00:00:00 2001 From: Leander Schulten Date: Wed, 9 Dec 2020 16:12:36 +0100 Subject: [PATCH 01/15] QmlJs: Fix reformatter for arrow functions Fixes: QTCREATORBUG-23019 Change-Id: I6c6bee7092cb12f225ad744df2b3834dfd4bbc8f Reviewed-by: Fawzi Mohamed --- src/libs/qmljs/parser/qmljs.g | 14 +++++++------ src/libs/qmljs/parser/qmljsparser.cpp | 11 +++++----- src/libs/qmljs/qmljsreformatter.cpp | 28 ++++++++++++++++++++------ tests/auto/qml/reformatter/jssyntax.js | 9 +++++++++ 4 files changed, 45 insertions(+), 17 deletions(-) diff --git a/src/libs/qmljs/parser/qmljs.g b/src/libs/qmljs/parser/qmljs.g index 54aaf3b010c..6fd265ebc19 100644 --- a/src/libs/qmljs/parser/qmljs.g +++ b/src/libs/qmljs/parser/qmljs.g @@ -4019,14 +4019,16 @@ ArrowFunction_In: ArrowParameters T_ARROW ConciseBodyLookahead AssignmentExpress /. case $rule_number: { AST::ReturnStatement *ret = new (pool) AST::ReturnStatement(sym(4).Expression); - ret->returnToken = sym(4).Node->firstSourceLocation(); - ret->semicolonToken = sym(4).Node->lastSourceLocation(); + const auto zeroLength = [](SourceLocation l){ l.length = 0; return l; }; + ret->returnToken = zeroLength(sym(4).Node->firstSourceLocation()); + ret->semicolonToken = zeroLength(sym(4).Node->lastSourceLocation()); AST::StatementList *statements = (new (pool) AST::StatementList(ret))->finish(); - AST::FunctionExpression *f = new (pool) AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, statements); + AST::FunctionExpression *f = new (pool) + AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, statements); f->isArrowFunction = true; f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1); - f->lbraceToken = sym(4).Node->firstSourceLocation(); - f->rbraceToken = sym(4).Node->lastSourceLocation(); + f->lbraceToken = zeroLength(sym(4).Node->firstSourceLocation()); + f->rbraceToken = zeroLength(sym(4).Node->lastSourceLocation()); sym(1).Node = f; } break; ./ @@ -4039,7 +4041,7 @@ ArrowFunction_In: ArrowParameters T_ARROW ConciseBodyLookahead T_FORCE_BLOCK Fun AST::FunctionExpression *f = new (pool) AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, sym(6).StatementList); f->isArrowFunction = true; f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1); - f->lbraceToken = loc(6); + f->lbraceToken = loc(5); f->rbraceToken = loc(7); sym(1).Node = f; } break; diff --git a/src/libs/qmljs/parser/qmljsparser.cpp b/src/libs/qmljs/parser/qmljsparser.cpp index 57b03b6cfbf..ec6087f6435 100644 --- a/src/libs/qmljs/parser/qmljsparser.cpp +++ b/src/libs/qmljs/parser/qmljsparser.cpp @@ -3001,15 +3001,16 @@ case 241: { case 528: { AST::ReturnStatement *ret = new (pool) AST::ReturnStatement(sym(4).Expression); - ret->returnToken = sym(4).Node->firstSourceLocation(); - ret->semicolonToken = sym(4).Node->lastSourceLocation(); + const auto zeroLength = [](SourceLocation l){ l.length = 0; return l; }; + ret->returnToken = zeroLength(sym(4).Node->firstSourceLocation()); + ret->semicolonToken = zeroLength(sym(4).Node->lastSourceLocation()); AST::StatementList *statements = (new (pool) AST::StatementList(ret))->finish(); AST::FunctionExpression *f = new (pool) AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, statements); f->isArrowFunction = true; f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1); - f->lbraceToken = sym(4).Node->firstSourceLocation(); - f->rbraceToken = sym(4).Node->lastSourceLocation(); + f->lbraceToken = zeroLength(sym(4).Node->firstSourceLocation()); + f->rbraceToken = zeroLength(sym(4).Node->lastSourceLocation()); sym(1).Node = f; } break; @@ -3022,7 +3023,7 @@ case 241: { AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, sym(6).StatementList); f->isArrowFunction = true; f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1); - f->lbraceToken = loc(6); + f->lbraceToken = loc(5); f->rbraceToken = loc(7); sym(1).Node = f; } break; diff --git a/src/libs/qmljs/qmljsreformatter.cpp b/src/libs/qmljs/qmljsreformatter.cpp index b723f9ff7bd..52b5afc0b1d 100644 --- a/src/libs/qmljs/qmljsreformatter.cpp +++ b/src/libs/qmljs/qmljsreformatter.cpp @@ -1097,7 +1097,8 @@ protected: { out(ast->returnToken); if (ast->expression) { - out(" "); + if (ast->returnToken.isValid()) + out(" "); accept(ast->expression); } return false; @@ -1218,17 +1219,32 @@ protected: bool visit(FunctionExpression *ast) override { - out("function ", ast->functionToken); - if (!ast->name.isNull()) - out(ast->identifierToken); + if (!ast->isArrowFunction) { + out("function ", ast->functionToken); + if (!ast->name.isNull()) + out(ast->identifierToken); + } out(ast->lparenToken); + if (ast->isArrowFunction && ast->formals && ast->formals->next) + out("("); accept(ast->formals); + if (ast->isArrowFunction && ast->formals && ast->formals->next) + out(")"); out(ast->rparenToken); + if (ast->isArrowFunction && !ast->formals) + out("()"); out(" "); + if (ast->isArrowFunction) + out("=> "); out(ast->lbraceToken); if (ast->body) { - lnAcceptIndented(ast->body); - newLine(); + if (ast->body->next || ast->lbraceToken.isValid()) { + lnAcceptIndented(ast->body); + newLine(); + } else { + // print a single statement in one line. E.g. x => x * 2 + accept(ast->body); + } } out(ast->rbraceToken); return false; diff --git a/tests/auto/qml/reformatter/jssyntax.js b/tests/auto/qml/reformatter/jssyntax.js index d651cd7822c..c59e73e77e2 100644 --- a/tests/auto/qml/reformatter/jssyntax.js +++ b/tests/auto/qml/reformatter/jssyntax.js @@ -12,6 +12,15 @@ function foo(a, b) { var foo = function (a, b) {} +const func1 = x => x * 2 +const func2 = x => { + return x * 7 +} +const func3 = (x, y) => x + y +const func4 = (x, y) => { + return x + y +} + while (true) { for (var a = 1; a < 5; ++a) { switch (a) { From 771e269a3b0b3222be1ca7fa150a8e8ab5aac71f Mon Sep 17 00:00:00 2001 From: Leander Schulten Date: Wed, 9 Dec 2020 22:46:50 +0100 Subject: [PATCH 02/15] QmlJs: Fix reformatter for template strings Change-Id: Ie0b7909d634d1e2e735377b053f7a1c1c2518f78 Reviewed-by: Fawzi Mohamed --- src/libs/qmljs/qmljsreformatter.cpp | 7 +++++++ tests/auto/qml/reformatter/jssyntax.js | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/libs/qmljs/qmljsreformatter.cpp b/src/libs/qmljs/qmljsreformatter.cpp index 52b5afc0b1d..de69df50438 100644 --- a/src/libs/qmljs/qmljsreformatter.cpp +++ b/src/libs/qmljs/qmljsreformatter.cpp @@ -802,6 +802,13 @@ protected: bool visit(StringLiteralPropertyName *ast) override { out(ast->id.toString()); return true; } bool visit(NumericLiteralPropertyName *ast) override { out(QString::number(ast->id)); return true; } + bool visit(TemplateLiteral *ast) override + { + out(ast->literalToken); + accept(ast->expression); + return true; + } + bool visit(ArrayMemberExpression *ast) override { accept(ast->base); diff --git a/tests/auto/qml/reformatter/jssyntax.js b/tests/auto/qml/reformatter/jssyntax.js index c59e73e77e2..edba1a406cf 100644 --- a/tests/auto/qml/reformatter/jssyntax.js +++ b/tests/auto/qml/reformatter/jssyntax.js @@ -21,6 +21,11 @@ const func4 = (x, y) => { return x + y } +const s1 = `test` +const s2 = `${42 * 1}` +const s3 = `test ${s2}` +const s4 = `${s2}${s3}test` + while (true) { for (var a = 1; a < 5; ++a) { switch (a) { From ea4a53a1aa4585458c7acddac095b69d37819189 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 17 Dec 2020 15:15:04 +0100 Subject: [PATCH 03/15] Bump version to 4.14.1 Change-Id: I0391715109a6ac43da4b3b744a845cf914b0d0b2 Reviewed-by: Eike Ziller --- cmake/QtCreatorIDEBranding.cmake | 4 ++-- qbs/modules/qtc/qtc.qbs | 4 ++-- qtcreator_ide_branding.pri | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/QtCreatorIDEBranding.cmake b/cmake/QtCreatorIDEBranding.cmake index 9ae08876d36..a431bb7343d 100644 --- a/cmake/QtCreatorIDEBranding.cmake +++ b/cmake/QtCreatorIDEBranding.cmake @@ -1,6 +1,6 @@ -set(IDE_VERSION "4.14.0") # The IDE version. +set(IDE_VERSION "4.14.1") # The IDE version. set(IDE_VERSION_COMPAT "4.14.0") # The IDE Compatibility version. -set(IDE_VERSION_DISPLAY "4.14.0") # The IDE display version. +set(IDE_VERSION_DISPLAY "4.14.1") # The IDE display version. set(IDE_COPYRIGHT_YEAR "2020") # The IDE current copyright year. set(IDE_SETTINGSVARIANT "QtProject") # The IDE settings variation. diff --git a/qbs/modules/qtc/qtc.qbs b/qbs/modules/qtc/qtc.qbs index 57b00a53cae..3c67ce83e51 100644 --- a/qbs/modules/qtc/qtc.qbs +++ b/qbs/modules/qtc/qtc.qbs @@ -4,10 +4,10 @@ import qbs.FileInfo import "qtc.js" as HelperFunctions Module { - property string qtcreator_display_version: '4.14.0' + property string qtcreator_display_version: '4.14.1' property string ide_version_major: '4' property string ide_version_minor: '14' - property string ide_version_release: '0' + property string ide_version_release: '1' property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release diff --git a/qtcreator_ide_branding.pri b/qtcreator_ide_branding.pri index 99c5f152382..f9fbc83a83b 100644 --- a/qtcreator_ide_branding.pri +++ b/qtcreator_ide_branding.pri @@ -1,6 +1,6 @@ -QTCREATOR_VERSION = 4.14.0 +QTCREATOR_VERSION = 4.14.1 QTCREATOR_COMPAT_VERSION = 4.14.0 -QTCREATOR_DISPLAY_VERSION = 4.14.0 +QTCREATOR_DISPLAY_VERSION = 4.14.1 QTCREATOR_COPYRIGHT_YEAR = 2020 IDE_DISPLAY_NAME = Qt Creator From 305ca7e4345da1fa558157d09a92a232653940a4 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 11 Dec 2020 12:23:49 +0100 Subject: [PATCH 04/15] cmake build: Fix handling of test dependencies Test dependencies are not "real" code dependencies, they just declare that for testing the plugin the other plugin has to be loaded, even though it is _not_ a code dependency. Add PLUGIN_TEST_DEPENDS to add_qtc_plugin. We cannot assume that the target exists at that point, so adapt the usual pattern. Fixes: QTCREATORBUG-25024 Change-Id: I4165ff8df762309e0be0bfe9e8bedef796a3bf17 Reviewed-by: Christian Stenger Reviewed-by: Cristian Adam --- cmake/QtCreatorAPI.cmake | 11 ++++++++++- src/plugins/autotest/CMakeLists.txt | 7 ++----- src/plugins/clangcodemodel/CMakeLists.txt | 7 ++----- src/plugins/clangtools/CMakeLists.txt | 7 ++----- src/plugins/cppeditor/CMakeLists.txt | 1 + src/plugins/debugger/CMakeLists.txt | 1 + src/plugins/designer/CMakeLists.txt | 7 ++----- src/plugins/fakevim/CMakeLists.txt | 7 ++----- src/plugins/genericprojectmanager/CMakeLists.txt | 7 ++----- 9 files changed, 24 insertions(+), 31 deletions(-) diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index a790483e91e..fcbb67e7352 100644 --- a/cmake/QtCreatorAPI.cmake +++ b/cmake/QtCreatorAPI.cmake @@ -277,7 +277,7 @@ function(add_qtc_plugin target_name) cmake_parse_arguments(_arg "SKIP_DEBUG_CMAKE_FILE_CHECK;SKIP_INSTALL;INTERNAL_ONLY;SKIP_TRANSLATION;EXPORT" "VERSION;COMPAT_VERSION;PLUGIN_JSON_IN;PLUGIN_PATH;PLUGIN_NAME;OUTPUT_NAME;BUILD_DEFAULT" - "CONDITION;DEPENDS;PUBLIC_DEPENDS;DEFINES;PUBLIC_DEFINES;INCLUDES;PUBLIC_INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;EXTRA_TRANSLATIONS;PLUGIN_DEPENDS;PLUGIN_RECOMMENDS;PROPERTIES" + "CONDITION;DEPENDS;PUBLIC_DEPENDS;DEFINES;PUBLIC_DEFINES;INCLUDES;PUBLIC_INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;EXTRA_TRANSLATIONS;PLUGIN_DEPENDS;PLUGIN_RECOMMENDS;PLUGIN_TEST_DEPENDS;PROPERTIES" ${ARGN} ) @@ -363,6 +363,15 @@ function(add_qtc_plugin target_name) " { \"Name\" : \"${i}\", \"Version\" : \"${_v}\", \"Type\" : \"optional\" }" ) endforeach(i) + foreach(i IN LISTS _arg_PLUGIN_TEST_DEPENDS) + if (i MATCHES "^QtCreator::") + string(REPLACE "QtCreator::" "" i ${i}) + endif() + set(_v ${IDE_VERSION}) + string(APPEND _arg_DEPENDENCY_STRING + " { \"Name\" : \"${i}\", \"Version\" : \"${_v}\", \"Type\" : \"test\" }" + ) + endforeach(i) string(REPLACE "} {" "},\n {" _arg_DEPENDENCY_STRING "${_arg_DEPENDENCY_STRING}" diff --git a/src/plugins/autotest/CMakeLists.txt b/src/plugins/autotest/CMakeLists.txt index 18521d76084..1da654bdfd6 100644 --- a/src/plugins/autotest/CMakeLists.txt +++ b/src/plugins/autotest/CMakeLists.txt @@ -1,9 +1,6 @@ -if (WITH_TESTS) - set(TEST_COMPONENT QmakeProjectManager QtSupport) -endif() - add_qtc_plugin(AutoTest - PLUGIN_DEPENDS Core CppTools Debugger ProjectExplorer QmlJSTools TextEditor ${TEST_COMPONENT} + PLUGIN_DEPENDS Core CppTools Debugger ProjectExplorer QmlJSTools TextEditor + PLUGIN_TEST_DEPENDS QmakeProjectManager QtSupport QbsProjectManager SOURCES autotest.qrc autotest_global.h diff --git a/src/plugins/clangcodemodel/CMakeLists.txt b/src/plugins/clangcodemodel/CMakeLists.txt index 56ee68416de..ac90081b3a8 100644 --- a/src/plugins/clangcodemodel/CMakeLists.txt +++ b/src/plugins/clangcodemodel/CMakeLists.txt @@ -1,11 +1,8 @@ -if (WITH_TESTS) - set(TST_COMPONENT CppEditor QmakeProjectManager) -endif() - add_qtc_plugin(ClangCodeModel CONDITION TARGET libclang DEPENDS ClangSupport CPlusPlus - PLUGIN_DEPENDS Core CppTools TextEditor ${TST_COMPONENT} + PLUGIN_DEPENDS Core CppTools TextEditor + PLUGIN_TEST_DEPENDS CppEditor QmakeProjectManager SOURCES clangactivationsequencecontextprocessor.cpp clangactivationsequencecontextprocessor.h clangactivationsequenceprocessor.cpp clangactivationsequenceprocessor.h diff --git a/src/plugins/clangtools/CMakeLists.txt b/src/plugins/clangtools/CMakeLists.txt index 314edab2f3b..4db954d385a 100644 --- a/src/plugins/clangtools/CMakeLists.txt +++ b/src/plugins/clangtools/CMakeLists.txt @@ -1,14 +1,11 @@ -if (WITH_TESTS) - set(TST_COMPONENT QmakeProjectManager) -endif() - find_package(yaml-cpp QUIET MODULE) add_qtc_plugin(ClangTools CONDITION TARGET yaml-cpp DEPENDS ClangSupport yaml-cpp - PLUGIN_DEPENDS Core Debugger CppTools CppEditor ${TST_COMPONENT} + PLUGIN_DEPENDS Core Debugger CppTools CppEditor PLUGIN_RECOMMENDS CppEditor + PLUGIN_TEST_DEPENDS QmakeProjectManager QbsProjectManager INCLUDES ${CLANG_INCLUDE_DIRS} SOURCES clangfileinfo.h diff --git a/src/plugins/cppeditor/CMakeLists.txt b/src/plugins/cppeditor/CMakeLists.txt index d2a55ca8cfa..ca614cc90ae 100644 --- a/src/plugins/cppeditor/CMakeLists.txt +++ b/src/plugins/cppeditor/CMakeLists.txt @@ -1,6 +1,7 @@ add_qtc_plugin(CppEditor DEFINES CPPEDITOR_LIBRARY PLUGIN_DEPENDS Core CppTools ProjectExplorer TextEditor + PLUGIN_TEST_DEPENDS QmakeProjectManager SOURCES cppautocompleter.cpp cppautocompleter.h cppcodemodelinspectordialog.cpp cppcodemodelinspectordialog.h cppcodemodelinspectordialog.ui diff --git a/src/plugins/debugger/CMakeLists.txt b/src/plugins/debugger/CMakeLists.txt index bc05b7dbb19..0a9ec99a1f6 100644 --- a/src/plugins/debugger/CMakeLists.txt +++ b/src/plugins/debugger/CMakeLists.txt @@ -2,6 +2,7 @@ add_qtc_plugin(Debugger DEPENDS LanguageUtils QmlDebug QmlJS QtcSsh registryaccess PLUGIN_DEPENDS Core CppTools ProjectExplorer QtSupport TextEditor PLUGIN_RECOMMENDS QmakeProjectManager + PLUGIN_TEST_DEPENDS QmakeProjectManager SOURCES analyzer/analyzerbase.qrc analyzer/analyzerconstants.h diff --git a/src/plugins/designer/CMakeLists.txt b/src/plugins/designer/CMakeLists.txt index cb7016d0eee..44c8875619b 100644 --- a/src/plugins/designer/CMakeLists.txt +++ b/src/plugins/designer/CMakeLists.txt @@ -1,13 +1,10 @@ -if (WITH_TESTS) - set(TST_COMPONENT CppEditor) -endif() - add_qtc_plugin(Designer CONDITION TARGET Qt5::DesignerComponents AND TARGET Qt5::Designer DEPENDS designerintegrationv2 Qt5::Designer Qt5::PrintSupport Qt5::DesignerComponents DEFINES CPP_ENABLED - PLUGIN_DEPENDS Core CppTools ProjectExplorer QtSupport ResourceEditor TextEditor ${TST_COMPONENT} + PLUGIN_DEPENDS Core CppTools ProjectExplorer QtSupport ResourceEditor TextEditor + PLUGIN_TEST_DEPENDS CppEditor SOURCES codemodelhelpers.cpp codemodelhelpers.h cpp/formclasswizard.cpp cpp/formclasswizard.h diff --git a/src/plugins/fakevim/CMakeLists.txt b/src/plugins/fakevim/CMakeLists.txt index 0dd4f690f28..ddb6f3c1f1e 100644 --- a/src/plugins/fakevim/CMakeLists.txt +++ b/src/plugins/fakevim/CMakeLists.txt @@ -1,9 +1,6 @@ -if (WITH_TESTS) - set(TST_COMPONENT CppEditor CppTools) -endif() - add_qtc_plugin(FakeVim - PLUGIN_DEPENDS Core TextEditor ${TST_COMPONENT} + PLUGIN_DEPENDS Core TextEditor + PLUGIN_TEST_DEPENDS CppEditor CppTools SOURCES ${TEST_SOURCES} fakevim.qrc fakevimactions.cpp fakevimactions.h diff --git a/src/plugins/genericprojectmanager/CMakeLists.txt b/src/plugins/genericprojectmanager/CMakeLists.txt index 13ed2d53737..ec12a0af555 100644 --- a/src/plugins/genericprojectmanager/CMakeLists.txt +++ b/src/plugins/genericprojectmanager/CMakeLists.txt @@ -1,9 +1,6 @@ -if (WITH_TESTS) - set(TST_COMPONENT CppEditor) -endif() - add_qtc_plugin(GenericProjectManager - PLUGIN_DEPENDS Core ProjectExplorer QtSupport TextEditor ${TST_COMPONENT} + PLUGIN_DEPENDS Core ProjectExplorer QtSupport TextEditor + PLUGIN_TEST_DEPENDS CppEditor PLUGIN_RECOMMENDS CppTools SOURCES ${TEST_SOURCES} filesselectionwizardpage.cpp filesselectionwizardpage.h From f74b31759867e8872bf151ac7dc8160ba31eeac1 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 18 Dec 2020 14:38:34 +0100 Subject: [PATCH 05/15] Fix compilation of ClangFormat plugin against LLVM with clang-cpp The ClangFormat plugin needs to link against clang-cpp in that case as well. Fixes: QTCREATORBUG-25138 Change-Id: I84b1784b291d8944a9dee66ec14db32ad72ff8b5 Reviewed-by: Cristian Adam --- cmake/FindClang.cmake | 2 ++ src/plugins/clangformat/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/FindClang.cmake b/cmake/FindClang.cmake index b515820be1e..c745174ca19 100644 --- a/cmake/FindClang.cmake +++ b/cmake/FindClang.cmake @@ -9,8 +9,10 @@ option(CLANGTOOLING_LINK_CLANG_DYLIB "Force linking of Clang tooling against cla if (TARGET clangTooling AND NOT CLANGTOOLING_LINK_CLANG_DYLIB) set(CLANG_TOOLING_LIBS libclang clangTooling clangQuery clangIndex) + set(CLANG_FORMAT_LIB clangFormat) elseif (TARGET clang-cpp) set(CLANG_TOOLING_LIBS libclang clang-cpp) + set(CLANG_FORMAT_LIB clang-cpp) endif() diff --git a/src/plugins/clangformat/CMakeLists.txt b/src/plugins/clangformat/CMakeLists.txt index 83593064265..641343239cb 100644 --- a/src/plugins/clangformat/CMakeLists.txt +++ b/src/plugins/clangformat/CMakeLists.txt @@ -1,6 +1,6 @@ add_qtc_plugin(ClangFormat CONDITION TARGET libclang AND LLVM_PACKAGE_VERSION VERSION_GREATER_EQUAL 10.0.0 AND QTC_CLANG_BUILDMODE_MATCH - DEPENDS Utils Qt5::Widgets clangFormat + DEPENDS Utils Qt5::Widgets ${CLANG_FORMAT_LIB} INCLUDES "${CLANG_INCLUDE_DIRS}" PLUGIN_DEPENDS Core TextEditor CppEditor CppTools ProjectExplorer SOURCES From c650c9473db32fc2197a32017b0ef3406cf75280 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 18 Dec 2020 15:07:10 +0100 Subject: [PATCH 06/15] cmake build: Don't install highlighting files when using system lib When using the system provided KF5SyntaxHighlighting library, the highlighting files are taken from the system too. Fixes: QTCREATORBUG-25143 Change-Id: Iac0b9734bc96e1f72d1494622081da7e279e5554 Reviewed-by: Cristian Adam --- .../syntax-highlighting/CMakeLists.txt | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt index 062ae058c31..8aadf8525f3 100644 --- a/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt @@ -44,13 +44,15 @@ add_qtc_library(KSyntaxHighlighting SHARED ) qtc_add_public_header(autogenerated/src/lib/State) -install( - DIRECTORY data/syntax - DESTINATION "${IDE_DATA_PATH}/generic-highlighter/" -) +if(TARGET KSyntaxHighlighting) + install( + DIRECTORY data/syntax + DESTINATION "${IDE_DATA_PATH}/generic-highlighter/" + ) -# copy resource directories during build -qtc_copy_to_builddir(copy_generic_highligher_to_builddir - DIRECTORIES data/syntax - DESTINATION "${IDE_DATA_PATH}/generic-highlighter/syntax" -) + # copy resource directories during build + qtc_copy_to_builddir(copy_generic_highligher_to_builddir + DIRECTORIES data/syntax + DESTINATION "${IDE_DATA_PATH}/generic-highlighter/syntax" + ) +endif() From 3724878043a90a1f4cb2a6816c82146b5bc0d48c Mon Sep 17 00:00:00 2001 From: Knud Dollereder Date: Fri, 18 Dec 2020 16:25:02 +0100 Subject: [PATCH 07/15] Prevent access of invalid parent properties when retrieving the parent ids of a ModelNode Change-Id: Ic754786e2bd3744b7a4bd67b9db385be368e5925 Reviewed-by: Tim Jenssen --- .../qmldesigner/components/curveeditor/curveeditormodel.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.cpp b/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.cpp index 7827cf03c0f..8b0a0357b1c 100644 --- a/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.cpp @@ -225,6 +225,9 @@ PropertyTreeItem::ValueType typeFrom(const QmlDesigner::QmlTimelineKeyframeGroup std::vector parentIds(const QmlDesigner::ModelNode &node) { + if (!node.hasParentProperty()) + return {}; + std::vector out; QmlDesigner::ModelNode parent = node.parentProperty().parentModelNode(); From 03274561e963969a9b0f6d98b294c9b0b6d07b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kama=20W=C3=B3jcik?= Date: Fri, 18 Dec 2020 16:34:29 +0100 Subject: [PATCH 08/15] Add label with event id list to transition flow Change-Id: Ica6ce4424b22a91c348aab5866b4e978bf9c6173 Reviewed-by: Thomas Hartmann --- .../components/formeditor/formeditoritem.cpp | 39 +++++++++++++++++++ .../components/formeditor/formeditorview.cpp | 19 ++++++++- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp index 77d35ea6578..483c08046c7 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp @@ -888,6 +888,7 @@ public: , labelFlags(Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextDontClip) , labelFlipSide(false) , hitTesting(hitTest) + , events() { // width if (node.modelNode().hasAuxiliaryData("width")) @@ -952,6 +953,13 @@ public: // label flip side if (node.modelNode().hasAuxiliaryData("labelFlipSide")) labelFlipSide = node.modelNode().auxiliaryData("labelFlipSide").toBool(); + + isSelected = node.modelNode().isSelected(); + const char eventsName[] = "eventIds"; + + if (node.modelNode().hasVariantProperty(eventsName)) + events = node.modelNode().variantProperty(eventsName).value().toString(); + } qreal width; @@ -977,6 +985,8 @@ public: int labelFlags; bool labelFlipSide; bool hitTesting; + bool isSelected; + QString events; }; static bool verticalOverlap(const QRectF &from, const QRectF &to) @@ -1453,6 +1463,35 @@ QPointF FormEditorTransitionItem::instancePosition() const static void drawLabel(QPainter *painter, const Connection &connection) { + // draw label with event ids + if (connection.config.isSelected && !connection.config.events.isEmpty()) + { + qreal offset = connection.config.labelOffset; + QStringList events = connection.config.events.split(','); + int fontSize = connection.config.fontSize; + QString output = events[0].trimmed(); + qreal minWidth = offset * 12; + int letterWidth = fontSize * 0.6; // assumption on max letter length + if (minWidth < output.size() * letterWidth) minWidth = output.size() * letterWidth; + int eventCount = events.size(); + for (int i = 1; i < eventCount; ++i) + { + output.append('\n'); + QString id = events[i].trimmed(); + output.append(id); + if (minWidth < id.size() * letterWidth) minWidth = id.size() * letterWidth; + } + const QPointF pos = connection.path.pointAtPercent(0.0); + painter->save(); + painter->setBrush(QColor(70, 70, 70, 200)); + painter->setPen(Qt::lightGray); + + painter->drawRoundedRect(pos.x(), pos.y() + offset, minWidth, 1.5 * fontSize * eventCount + offset * 4, offset / 2, offset / 2); + painter->drawText(pos.x(), pos.y() + 2 * offset, minWidth, offset * 2, Qt::AlignHCenter, QObject::tr("Connected Events")); + painter->drawLine(pos.x() + offset, pos.y() + 4 * offset, pos.x() + minWidth - offset, pos.y() + offset * 4); + painter->drawText(pos.x() + offset, pos.y() + 4 * offset, minWidth - offset, 1.5 * fontSize * eventCount, Qt::AlignLeft, output); + painter->restore(); + } if (connection.config.label.isEmpty()) return; diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp index bd11cc1d380..dde5fd8732e 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp @@ -379,7 +379,7 @@ void FormEditorView::nodeIdChanged(const ModelNode& node, const QString &/*newId } void FormEditorView::selectedNodesChanged(const QList &selectedNodeList, - const QList &/*lastSelectedNodeList*/) + const QList &lastSelectedNodeList) { m_currentTool->setItems(scene()->itemsForQmlItemNodes(toQmlItemNodeListKeppInvalid(selectedNodeList))); @@ -389,6 +389,23 @@ void FormEditorView::selectedNodesChanged(const QList &selectedNodeLi m_formEditorWidget->zoomSelectionAction()->setEnabled(false); else m_formEditorWidget->zoomSelectionAction()->setEnabled(true); + + for (const ModelNode &node : lastSelectedNodeList) { /*Set Z to 0 for unselected items */ + QmlVisualNode visualNode(node); /* QmlVisualNode extends ModelNode with extra methods for "visual nodes" */ + if (visualNode.isFlowTransition()) { /* Check if a QmlVisualNode Transition */ + if (FormEditorItem *item = m_scene->itemForQmlItemNode(visualNode.toQmlItemNode())) { /* Get the form editor item from the form editor */ + item->setZValue(0); + } + } + } + for (const ModelNode &node : selectedNodeList) { + QmlVisualNode visualNode(node); + if (visualNode.isFlowTransition()) { + if (FormEditorItem *item = m_scene->itemForQmlItemNode(visualNode.toQmlItemNode())) { + item->setZValue(11); + } + } + } } void FormEditorView::variantPropertiesChanged(const QList &propertyList, From 0f9a206bd55935d1c33260ad820a9599c3317490 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 22 Dec 2020 11:20:43 +0100 Subject: [PATCH 09/15] cmake build: Make separate debug info optional In the CMake build in general, but still use it for RelWithDebInfo builds with the build*.py scripts. Fixes: QTCREATORBUG-25151 Change-Id: I8414f953278ebb395f73414c12af0ed7bd4fcdbe Reviewed-by: Cristian Adam --- cmake/QtCreatorAPI.cmake | 1 + cmake/QtcSeparateDebugInfo.cmake | 4 ++-- scripts/build.py | 2 ++ scripts/build_plugin.py | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index fcbb67e7352..5e88b575120 100644 --- a/cmake/QtCreatorAPI.cmake +++ b/cmake/QtCreatorAPI.cmake @@ -36,6 +36,7 @@ set(_THIS_MODULE_BASE_DIR "${CMAKE_CURRENT_LIST_DIR}") option(BUILD_PLUGINS_BY_DEFAULT "Build plugins by default. This can be used to build all plugins by default, or none." ON) option(BUILD_EXECUTABLES_BY_DEFAULT "Build executables by default. This can be used to build all executables by default, or none." ON) option(BUILD_LIBRARIES_BY_DEFAULT "Build libraries by default. This can be used to build all libraries by default, or none." ON) +option(QTC_SEPARATE_DEBUG_INFO "Extract debug information from binary files." OFF) function(qtc_plugin_enabled varName name) if (NOT (name IN_LIST __QTC_PLUGINS)) diff --git a/cmake/QtcSeparateDebugInfo.cmake b/cmake/QtcSeparateDebugInfo.cmake index 7cc8ff3f0d6..768e2974612 100644 --- a/cmake/QtcSeparateDebugInfo.cmake +++ b/cmake/QtcSeparateDebugInfo.cmake @@ -3,9 +3,9 @@ set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}) endif() # Enable separate debug information for the given target -# when doing RelWithDebInfo build +# when QTC_SEPARATE_DEBUG_INFO is set function(qtc_enable_separate_debug_info target installDestination) - if (NOT CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo) + if (NOT QTC_SEPARATE_DEBUG_INFO) return() endif() if (NOT UNIX AND NOT MINGW) diff --git a/scripts/build.py b/scripts/build.py index 1aa491f1bc1..afc289fd327 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -119,9 +119,11 @@ def build_qtcreator(args, paths): with_docs_str = 'OFF' if args.no_docs else 'ON' build_date_option = 'OFF' if args.no_build_date else 'ON' test_option = 'ON' if args.with_tests else 'OFF' + separate_debug_info_option = 'ON' if args.with_debug_info else 'OFF' cmake_args = ['cmake', '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths), '-DCMAKE_BUILD_TYPE=' + args.build_type, + '-DQTC_SEPARATE_DEBUG_INFO=' + separate_debug_info_option, '-DSHOW_BUILD_DATE=' + build_date_option, '-DWITH_DOCS=' + with_docs_str, '-DBUILD_DEVELOPER_DOCS=' + with_docs_str, diff --git a/scripts/build_plugin.py b/scripts/build_plugin.py index c1b12a97f9e..8ec5eb44641 100755 --- a/scripts/build_plugin.py +++ b/scripts/build_plugin.py @@ -70,9 +70,11 @@ def build(args, paths): os.makedirs(paths.result) prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt_creator, paths.qt] prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths] + separate_debug_info_option = 'ON' if args.with_debug_info else 'OFF' cmake_args = ['cmake', '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths), '-DCMAKE_BUILD_TYPE=' + args.build_type, + '-DQTC_SEPARATE_DEBUG_INFO=' + separate_debug_info_option, '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.install), '-G', 'Ninja'] From 121e563052d3ba83e758ade8884003826e269297 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 22 Dec 2020 14:41:11 +0100 Subject: [PATCH 10/15] Update litehtml to latest master Adds support for ordered lists. Change-Id: I467689cdad08df297b20fbffe02d217d117ed56f Reviewed-by: Cristian Adam --- src/plugins/help/qlitehtml/CMakeLists.txt | 14 -------------- src/plugins/help/qlitehtml/litehtml | 2 +- src/plugins/help/qlitehtml/qlitehtml.pri | 4 ++++ src/plugins/help/qlitehtml/qlitehtml.qbs | 4 ++++ 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/plugins/help/qlitehtml/CMakeLists.txt b/src/plugins/help/qlitehtml/CMakeLists.txt index 5c7957a88c5..f6227a8f4c5 100644 --- a/src/plugins/help/qlitehtml/CMakeLists.txt +++ b/src/plugins/help/qlitehtml/CMakeLists.txt @@ -5,21 +5,7 @@ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/litehtml/CMakeLists.txt) endif() set(CMAKE_POSITION_INDEPENDENT_CODE ON) - # suppress warning about VERSION being overwritten or not - # and add subdirectory - set(ORIG_VERSION ${PROJECT_VERSION}) - set(ORIG_MAJOR ${PROJECT_VERSION_MAJOR}) - set(ORIG_MINOR ${PROJECT_VERSION_MINOR}) - set(ORIG_PATCH ${PROJECT_VERSION_PATCH}) - set(PROJECT_VERSION "") - set(PROJECT_VERSION_MAJOR "") - set(PROJECT_VERSION_MINOR "") - set(PROJECT_VERSION_PATCH "") add_subdirectory(litehtml EXCLUDE_FROM_ALL) - set(PROJECT_VERSION ${ORIG_VERSION}) - set(PROJECT_VERSION_MAJOR ${ORIG_MAJOR}) - set(PROJECT_VERSION_MINOR ${ORIG_MINOR}) - set(PROJECT_VERSION_PATCH ${ORIG_PATCH}) set(CMAKE_POSITION_INDEPENDENT_CODE "${ORIG_FPIC}") # force optimized litehtml even in debug diff --git a/src/plugins/help/qlitehtml/litehtml b/src/plugins/help/qlitehtml/litehtml index 816730ff1f9..db7f59d5886 160000 --- a/src/plugins/help/qlitehtml/litehtml +++ b/src/plugins/help/qlitehtml/litehtml @@ -1 +1 @@ -Subproject commit 816730ff1f94201dc7ea8189c81ab9f404abc941 +Subproject commit db7f59d5886fd50f84d48720c79dc2e6152efa83 diff --git a/src/plugins/help/qlitehtml/qlitehtml.pri b/src/plugins/help/qlitehtml/qlitehtml.pri index 794f8d124ca..c5cfc42baab 100644 --- a/src/plugins/help/qlitehtml/qlitehtml.pri +++ b/src/plugins/help/qlitehtml/qlitehtml.pri @@ -65,6 +65,7 @@ exists($$PWD/litehtml/CMakeLists.txt) { $$LH_SRC/src/element.cpp \ $$LH_SRC/src/el_font.cpp \ $$LH_SRC/src/el_image.cpp \ + $$LH_SRC/src/el_li.cpp \ $$LH_SRC/src/el_link.cpp \ $$LH_SRC/src/el_para.cpp \ $$LH_SRC/src/el_script.cpp \ @@ -79,6 +80,7 @@ exists($$PWD/litehtml/CMakeLists.txt) { $$LH_SRC/src/html_tag.cpp \ $$LH_SRC/src/iterators.cpp \ $$LH_SRC/src/media_query.cpp \ + $$LH_SRC/src/num_cvt.cpp \ $$LH_SRC/src/style.cpp \ $$LH_SRC/src/stylesheet.cpp \ $$LH_SRC/src/table.cpp \ @@ -108,6 +110,7 @@ exists($$PWD/litehtml/CMakeLists.txt) { $$LH_HDR/el_div.h \ $$LH_HDR/el_font.h \ $$LH_HDR/el_image.h \ + $$LH_HDR/el_li.h \ $$LH_HDR/el_link.h \ $$LH_HDR/el_para.h \ $$LH_HDR/el_script.h \ @@ -123,6 +126,7 @@ exists($$PWD/litehtml/CMakeLists.txt) { $$LH_HDR/html_tag.h \ $$LH_HDR/iterators.h \ $$LH_HDR/media_query.h \ + $$LH_HDR/num_cvt.h \ $$LH_HDR/os_types.h \ $$LH_HDR/style.h \ $$LH_HDR/stylesheet.h \ diff --git a/src/plugins/help/qlitehtml/qlitehtml.qbs b/src/plugins/help/qlitehtml/qlitehtml.qbs index 38ae6397f88..823e7be6bef 100644 --- a/src/plugins/help/qlitehtml/qlitehtml.qbs +++ b/src/plugins/help/qlitehtml/qlitehtml.qbs @@ -136,6 +136,7 @@ Product { "element.cpp", "el_font.cpp", "el_image.cpp", + "el_li.cpp", "el_link.cpp", "el_para.cpp", "el_script.cpp", @@ -150,6 +151,7 @@ Product { "html_tag.cpp", "iterators.cpp", "media_query.cpp", + "num_cvt.cpp", "style.cpp", "stylesheet.cpp", "table.cpp", @@ -185,6 +187,7 @@ Product { "el_div.h", "el_font.h", "el_image.h", + "el_li.h", "el_link.h", "el_para.h", "el_script.h", @@ -200,6 +203,7 @@ Product { "html_tag.h", "iterators.h", "media_query.h", + "num_cvt.h", "os_types.h", "style.h", "stylesheet.h", From 5badf2dab5151a5c9d8a1864ca2c41cc5f4b19e4 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 21 Dec 2020 11:04:54 +0100 Subject: [PATCH 11/15] WebAssembly: Mark plugin experimental The plugin was meant to be experimental, but was forgotten to be marked as such. Fixes: QTCREATORBUG-25130 Change-Id: I9286329bb960c100e96879b9bf7c00133c06dc7f Reviewed-by: Eike Ziller --- src/plugins/webassembly/WebAssembly.json.in | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/webassembly/WebAssembly.json.in b/src/plugins/webassembly/WebAssembly.json.in index 6c247c29fa9..6245d74456e 100644 --- a/src/plugins/webassembly/WebAssembly.json.in +++ b/src/plugins/webassembly/WebAssembly.json.in @@ -2,6 +2,7 @@ \"Name\" : \"WebAssembly\", \"Version\" : \"$$QTCREATOR_VERSION\", \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\", + \"Experimental\" : true, \"DisabledByDefault\" : true, \"Vendor\" : \"The Qt Company Ltd\", \"Copyright\" : \"(C) $$QTCREATOR_COPYRIGHT_YEAR The Qt Company Ltd\", From 084944a96b79a822c670a389b53388996cf0548d Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Fri, 27 Nov 2020 20:21:20 +0200 Subject: [PATCH 12/15] Fix Qt Creator + Coco build param name "interface" is causing Qt Creator build fail when integrating Froglogic Coco tools with Qt Creator. Fixes: QTCREATORBUG-25146 Change-Id: If3fa3d44e941089a882deb44ba12dec6d00ad73d Reviewed-by: Miikka Heikkinen Reviewed-by: Thomas Hartmann (cherry picked from commit f30565873a067b29ccb62cf1b728b183afd4bf36) --- src/libs/sqlite/sqlitetransaction.h | 40 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/libs/sqlite/sqlitetransaction.h b/src/libs/sqlite/sqlitetransaction.h index a21d4f94360..09a60446d26 100644 --- a/src/libs/sqlite/sqlitetransaction.h +++ b/src/libs/sqlite/sqlitetransaction.h @@ -74,8 +74,8 @@ public: protected: ~AbstractTransaction() = default; - AbstractTransaction(TransactionInterface &interface) - : m_interface(interface) + AbstractTransaction(TransactionInterface &transactionInterface) + : m_interface(transactionInterface) { } @@ -112,8 +112,8 @@ public: } protected: - AbstractThrowingSessionTransaction(TransactionInterface &interface) - : m_interface(interface) + AbstractThrowingSessionTransaction(TransactionInterface &transactionInterface) + : m_interface(transactionInterface) {} protected: @@ -140,8 +140,8 @@ public: } protected: - AbstractThrowingTransaction(TransactionInterface &interface) - : AbstractTransaction(interface) + AbstractThrowingTransaction(TransactionInterface &transactionInterface) + : AbstractTransaction(transactionInterface) { } }; @@ -161,8 +161,8 @@ public: } protected: - AbstractNonThrowingDestructorTransaction(TransactionInterface &interface) - : AbstractTransaction(interface) + AbstractNonThrowingDestructorTransaction(TransactionInterface &transactionInterface) + : AbstractTransaction(transactionInterface) { } }; @@ -171,10 +171,10 @@ template class BasicDeferredTransaction final : public BaseTransaction { public: - BasicDeferredTransaction(TransactionInterface &interface) - : BaseTransaction(interface) + BasicDeferredTransaction(TransactionInterface &transactionInterface) + : BaseTransaction(transactionInterface) { - interface.deferredBegin(); + transactionInterface.deferredBegin(); } ~BasicDeferredTransaction() @@ -190,10 +190,10 @@ template class BasicImmediateTransaction final : public BaseTransaction { public: - BasicImmediateTransaction(TransactionInterface &interface) - : BaseTransaction(interface) + BasicImmediateTransaction(TransactionInterface &transactionInterface) + : BaseTransaction(transactionInterface) { - interface.immediateBegin(); + transactionInterface.immediateBegin(); } ~BasicImmediateTransaction() @@ -209,10 +209,10 @@ template class BasicExclusiveTransaction final : public BaseTransaction { public: - BasicExclusiveTransaction(TransactionInterface &interface) - : BaseTransaction(interface) + BasicExclusiveTransaction(TransactionInterface &transactionInterface) + : BaseTransaction(transactionInterface) { - interface.exclusiveBegin(); + transactionInterface.exclusiveBegin(); } ~BasicExclusiveTransaction() @@ -228,10 +228,10 @@ using ExclusiveNonThrowingDestructorTransaction class ImmediateSessionTransaction final : public AbstractThrowingSessionTransaction { public: - ImmediateSessionTransaction(TransactionInterface &interface) - : AbstractThrowingSessionTransaction(interface) + ImmediateSessionTransaction(TransactionInterface &transactionInterface) + : AbstractThrowingSessionTransaction(transactionInterface) { - interface.immediateSessionBegin(); + transactionInterface.immediateSessionBegin(); } ~ImmediateSessionTransaction() From 6ebfc77d356d7eeb992ee4d796f373cbb27dd82f Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Wed, 23 Dec 2020 13:27:54 +0100 Subject: [PATCH 13/15] Git: Add missing emit Found by clazy. Change-Id: I1b74f28e86a1bddf1ef4c77aa20eda1141ec8045 Reviewed-by: Orgad Shaneh --- src/plugins/git/gitplugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index a4b4e06109f..ee4992bd756 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -471,7 +471,7 @@ GitPlugin::~GitPlugin() void GitPluginPrivate::onApplySettings() { - configurationChanged(); + emit configurationChanged(); updateRepositoryBrowserAction(); bool gitFoundOk; QString errorMessage; From c12a3909bb696e52d45e384ef21397710380fb1f Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Mon, 28 Dec 2020 16:55:19 +0100 Subject: [PATCH 14/15] JavaScriptFilter: Fix copying to clipboard It seems that QStrings stored in a QVariant can always be converted to EngineAction, therefore this check can be removed. The conversion then always resulted in the value zero, which got equal to EngineAction::Reset in commit 8d09191d2d1d. While at it, forbid copying an empty string to the clipboard, when the engine was aborted due to a timeout. Change-Id: Iaa4d9af52d4afd0e82f3b542d5f4e79bc8f6bdca Reviewed-by: Orgad Shaneh --- src/plugins/coreplugin/locator/javascriptfilter.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/coreplugin/locator/javascriptfilter.cpp b/src/plugins/coreplugin/locator/javascriptfilter.cpp index 245ddb61e20..8600580e0cd 100644 --- a/src/plugins/coreplugin/locator/javascriptfilter.cpp +++ b/src/plugins/coreplugin/locator/javascriptfilter.cpp @@ -32,7 +32,7 @@ namespace Core { namespace Internal { -enum class EngineAction { Reset, Abort }; +enum class EngineAction { Reset = 1, Abort }; JavaScriptFilter::JavaScriptFilter() { @@ -98,11 +98,13 @@ void JavaScriptFilter::accept(Core::LocatorFilterEntry selection, QString *newTe if (selection.internalData.isNull()) return; - if (selection.internalData.canConvert() - && selection.internalData.value() == EngineAction::Reset) { + const EngineAction action = selection.internalData.value(); + if (action == EngineAction::Reset) { m_engine.reset(); return; } + if (action == EngineAction::Abort) + return; QClipboard *clipboard = QGuiApplication::clipboard(); clipboard->setText(selection.internalData.toString()); From e09867d7de8276e6a78b592fc8653d6241307614 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 14 Dec 2020 08:25:11 +0100 Subject: [PATCH 15/15] Debugger: Do not limit inferior output chunks to 1024 chars with LLDB Task-number: QTCREATORBUG-24667 Change-Id: Ie59db04b0c1e46c4c06a1761eee3859ae18bcf7f Reviewed-by: Andy Shaw Reviewed-by: David M. Cotter Reviewed-by: Eike Ziller --- share/qtcreator/debugger/lldbbridge.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 1a61068aaa5..9b921f69060 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -1464,17 +1464,19 @@ class Dumper(DumperBase): elif eventType == lldb.SBProcess.eBroadcastBitInterrupt: # 2 pass elif eventType == lldb.SBProcess.eBroadcastBitSTDOUT: - # FIXME: Size? - msg = self.process.GetSTDOUT(1024) - if msg is not None: - self.report('output={channel="stdout",data="%s"}' % self.hexencode(msg)) + self.handleInferiorOutput(self.process.GetSTDOUT, "stdout") elif eventType == lldb.SBProcess.eBroadcastBitSTDERR: - msg = self.process.GetSTDERR(1024) - if msg is not None: - self.report('output={channel="stderr",data="%s"}' % self.hexencode(msg)) + self.handleInferiorOutput(self.process.GetSTDERR, "stderr") elif eventType == lldb.SBProcess.eBroadcastBitProfileData: pass + def handleInferiorOutput(self, proc, channel): + while True: + msg = proc(1024) + if msg == None or len(msg) == 0: + break + self.report('output={channel="%s",data="%s"}' % (channel, self.hexencode(msg))) + def describeBreakpoint(self, bp): isWatch = isinstance(bp, lldb.SBWatchpoint) if isWatch: