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/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index 36720bddaf6..45ff4d0696e 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) # If we provide a list of plugins, executables, libraries, then the BUILD__BY_DEFAULT will be set to OFF # and for every element we set BUILD__ to ON @@ -302,7 +303,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} ) @@ -388,6 +389,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/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'] 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: 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() 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..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); @@ -1097,7 +1104,8 @@ protected: { out(ast->returnToken); if (ast->expression) { - out(" "); + if (ast->returnToken.isValid()) + out(" "); accept(ast->expression); } return false; @@ -1218,17 +1226,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/src/plugins/autotest/CMakeLists.txt b/src/plugins/autotest/CMakeLists.txt index 2fe35627b85..2b5931551b0 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/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 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/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()); diff --git a/src/plugins/cppeditor/CMakeLists.txt b/src/plugins/cppeditor/CMakeLists.txt index c038c8314d8..72d83ef26d8 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 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; 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", 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(); 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, 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\", diff --git a/tests/auto/qml/reformatter/jssyntax.js b/tests/auto/qml/reformatter/jssyntax.js index d651cd7822c..edba1a406cf 100644 --- a/tests/auto/qml/reformatter/jssyntax.js +++ b/tests/auto/qml/reformatter/jssyntax.js @@ -12,6 +12,20 @@ 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 +} + +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) {