From f057adcff26355ce1f4a716d218cbc532f3cd192 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 15 Apr 2020 19:30:41 +0200 Subject: [PATCH 01/23] QmlDesigner: Delete all bindings to deleted node When a node is deleted we should remove all bindings to that node. Change-Id: I3a6c3387c535ac8c79bfc83671614ed8abd246a5 Reviewed-by: Tim Jenssen --- src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp index 2597aacf7b0..234872d661f 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp @@ -388,6 +388,8 @@ void QmlObjectNode::destroy() } removeStateOperationsForChildren(modelNode()); + BindingProperty::deleteAllReferencesTo(modelNode()); + QmlFlowViewNode root(view()->rootModelNode()); modelNode().destroy(); From f71286db98fbc93f415a7d9a6050bc2bc79fdd07 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 23 Apr 2020 10:00:23 +0200 Subject: [PATCH 02/23] Debugger: evaluate expression before assigning when using python dumper Fixes: QTCREATORBUG-23711 Change-Id: Ic386b3e4bdd948e74f52116248de1b33a35fe03a Reviewed-by: hjk Reviewed-by: Christian Stenger --- .../qtcreatorcdbext/qtcreatorcdbextension.cpp | 100 +++++++++++------- src/plugins/debugger/cdb/cdbengine.cpp | 11 +- 2 files changed, 69 insertions(+), 42 deletions(-) diff --git a/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp b/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp index 6bbd71367c0..77e537c275e 100644 --- a/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp +++ b/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp @@ -160,7 +160,7 @@ static const CommandDescription commandDescriptions[] = { {"assign","Assigns a value to a variable in current symbol group.", "[-t token] [-h] \n" "-h Data are hex-encoded, binary data\n" - "-u Data are hex-encoded, UTF16 data" + "-e iname is an hex-encoded expression to be evaluated " }, {"threads","Lists threads in GDBMI format.","[-t token]"}, {"registers","Lists registers in GDBMI format","[-t token]"}, @@ -819,57 +819,77 @@ extern "C" HRESULT CALLBACK assign(CIDebugClient *client, PCSTR argsIn) ExtensionCommandContext exc(client); std::string errorMessage; - bool success = false; bool encoded = false; + bool evaluateExpression = false; int token = 0; - do { - StringList tokens = commandTokens(argsIn, &token); - if (tokens.empty()) { - errorMessage = singleLineUsage(commandDescriptions[CmdAssign]); - break; - } - + StringList tokens = commandTokens(argsIn, &token); + while (!tokens.empty()) { if (tokens.front() == "-h") { encoded = true; tokens.pop_front(); + continue; } - if (tokens.empty()) { - errorMessage = singleLineUsage(commandDescriptions[CmdAssign]); - break; + if (tokens.front() == "-e") { + evaluateExpression = true; + tokens.pop_front(); + continue; } + break; + }; - // Parse 'assign locals.x=5' - const std::string::size_type equalsPos = tokens.front().find('='); - if (equalsPos == std::string::npos) { - errorMessage = singleLineUsage(commandDescriptions[CmdAssign]); - break; - } - const std::string iname = tokens.front().substr(0, equalsPos); - const std::string value = tokens.front().substr(equalsPos + 1, tokens.front().size() - equalsPos - 1); - // get the symbolgroup - int currentFrame = ExtensionContext::instance().symbolGroupFrame(); - if (currentFrame < 0) { - CIDebugControl *control = ExtensionCommandContext::instance()->control(); - DEBUG_STACK_FRAME frame; - if (FAILED(control->GetStackTrace(0, 0, 0, &frame, 1, NULL))) { - errorMessage = "No current frame."; - break; + // Parse 'assign locals.x=5' + const std::string::size_type equalsPos = tokens.empty() ? std::string::npos + : tokens.front().find('='); + if (equalsPos == std::string::npos) { + errorMessage = singleLineUsage(commandDescriptions[CmdAssign]); + } else { + std::string iname = tokens.front().substr(0, equalsPos); + const std::string value = tokens.front().substr(equalsPos + 1, + tokens.front().size() - equalsPos - 1); + SymbolGroup *symGroup = nullptr; + if (evaluateExpression) { + WatchesSymbolGroup *watchesSymGroup + = ExtensionContext::instance().watchesSymbolGroup(exc.symbols(), &errorMessage); + std::string tempAssignIname = "watch.tmpassign"; + if (watchesSymGroup) { + if (watchesSymGroup->addWatch(exc.symbols(), + tempAssignIname, + stringFromHex(iname), + &errorMessage)) { + iname = tempAssignIname; + symGroup = watchesSymGroup; + } + } + } else { + // get the symbolgroup + int currentFrame = ExtensionContext::instance().symbolGroupFrame(); + if (currentFrame < 0) { + CIDebugControl *control = ExtensionCommandContext::instance()->control(); + DEBUG_STACK_FRAME frame; + if (FAILED(control->GetStackTrace(0, 0, 0, &frame, 1, NULL))) + errorMessage = "No current frame."; + else + currentFrame = frame.FrameNumber; + } + if (currentFrame >= 0) { + symGroup = ExtensionContext::instance().symbolGroup(exc.symbols(), + exc.threadId(), + currentFrame, + &errorMessage); } - currentFrame = frame.FrameNumber; } - SymbolGroup *symGroup = ExtensionContext::instance().symbolGroup(exc.symbols(), exc.threadId(), currentFrame, &errorMessage); - if (!symGroup) - break; - success = symGroup->assign(iname, encoded ? stringFromHex(value) : value, - SymbolGroupValueContext(exc.dataSpaces(), exc.symbols()), - &errorMessage); - } while (false); + if (symGroup + && symGroup->assign(iname, + encoded ? stringFromHex(value) : value, + SymbolGroupValueContext(exc.dataSpaces(), exc.symbols()), + &errorMessage)) { + ExtensionContext::instance().report('R', token, 0, "assign", "Ok"); + return S_OK; + } + } - if (success) - ExtensionContext::instance().report('R', token, 0, "assign", "Ok"); - else - ExtensionContext::instance().report('N', token, 0, "assign", errorMessage.c_str()); + ExtensionContext::instance().report('N', token, 0, "assign", errorMessage.c_str()); return S_OK; } diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 757110161ba..a98ee3e9a7e 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -929,8 +929,15 @@ void CdbEngine::assignValueInDebugger(WatchItem *w, const QString &expr, const Q qWarning("Internal error: assignValueInDebugger: Invalid state or no stack frame."); return; } - runCommand({m_extensionCommandPrefix + "assign -h " + w->iname + '=' + toHex(value.toString()), - NoFlags}); + if (m_pythonVersion > 0x030000 && w->isWatcher()) { + runCommand({m_extensionCommandPrefix + "assign -h -e " + toHex(w->expression()) + '=' + + toHex(value.toString()), + NoFlags}); + } else { + runCommand({m_extensionCommandPrefix + "assign -h " + w->iname + '=' + toHex(value.toString()), + NoFlags}); + } + // Update all locals in case we change a union or something pointed to // that affects other variables, too. updateLocals(); From ac7283acee1ba60f96fde189374b15bae772f502 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 24 Apr 2020 12:51:01 +0200 Subject: [PATCH 03/23] QmlDesigner: Further fixes for gcc5.3 Amends 8d868d8bbb1742. Change-Id: Ifad7a5d9aa85cf076e2e42ac9489c01dc8995fcd Reviewed-by: Thomas Hartmann --- .../components/itemlibrary/itemlibrarywidget.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp index 13230544ae5..caf0663dce7 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp @@ -103,11 +103,11 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) : m_itemViewQuickWidget->rootContext()->setContextProperties( QVector{ - {"itemLibraryModel", QVariant::fromValue(m_itemLibraryModel.data())}, - {"itemLibraryIconWidth", m_itemIconSize.width()}, - {"itemLibraryIconHeight", m_itemIconSize.height()}, - {"rootView", QVariant::fromValue(this)}, - {"highlightColor", Utils::StyleHelper::notTooBrightHighlightColor()} + {{"itemLibraryModel"}, QVariant::fromValue(m_itemLibraryModel.data())}, + {{"itemLibraryIconWidth"}, m_itemIconSize.width()}, + {{"itemLibraryIconHeight"}, m_itemIconSize.height()}, + {{"rootView"}, QVariant::fromValue(this)}, + {{"highlightColor"}, Utils::StyleHelper::notTooBrightHighlightColor()} } ); From aad05dde548314e03f679f8a65ae5481982f8040 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Fri, 24 Apr 2020 11:27:32 +0200 Subject: [PATCH 04/23] Doc: Fix links in Qt Design Studio Manual Change-Id: Ie5a218fcdb8ed4823ce8caac655cc3081236f07f Reviewed-by: Thomas Hartmann --- doc/qtcreator/src/editors/creator-coding-edit-mode.qdoc | 6 ++++-- doc/qtcreator/src/qtquick/qtquick-adding-dynamics.qdoc | 2 +- doc/qtcreator/src/qtquick/qtquick-components.qdoc | 2 +- doc/qtcreator/src/qtquick/qtquick-ui-forms.qdoc | 8 ++------ 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/doc/qtcreator/src/editors/creator-coding-edit-mode.qdoc b/doc/qtcreator/src/editors/creator-coding-edit-mode.qdoc index 56be275326d..c470d183be3 100644 --- a/doc/qtcreator/src/editors/creator-coding-edit-mode.qdoc +++ b/doc/qtcreator/src/editors/creator-coding-edit-mode.qdoc @@ -130,8 +130,10 @@ \uicontrol {Default line endings} field. To set the line endings to use for a project, select \uicontrol Projects > - \uicontrol {Project Settings} > \uicontrol Editor. For more information, - see \l {Specifying Editor Settings}. + \uicontrol {Project Settings} > \uicontrol Editor. + \if defined(qtcreator) + For more information, see \l {Specifying Editor Settings}. + \endif \section1 Splitting the Editor View diff --git a/doc/qtcreator/src/qtquick/qtquick-adding-dynamics.qdoc b/doc/qtcreator/src/qtquick/qtquick-adding-dynamics.qdoc index a2e4b5865a6..9370ae848f8 100644 --- a/doc/qtcreator/src/qtquick/qtquick-adding-dynamics.qdoc +++ b/doc/qtcreator/src/qtquick/qtquick-adding-dynamics.qdoc @@ -26,7 +26,7 @@ /*! \contentspage index.html \page qtquick-adding-dynamics.html - \previouspage qtquick-fonts.html + \previouspage creator-quick-ui-forms.html \nextpage studio-timeline.html \title Adding Dynamics diff --git a/doc/qtcreator/src/qtquick/qtquick-components.qdoc b/doc/qtcreator/src/qtquick/qtquick-components.qdoc index 4266a4d7d0c..611dd97255e 100644 --- a/doc/qtcreator/src/qtquick/qtquick-components.qdoc +++ b/doc/qtcreator/src/qtquick/qtquick-components.qdoc @@ -33,7 +33,7 @@ \contentspage index.html \page quick-components.html \if defined(qtdesignstudio) - \previouspage studio-prototyping.html + \previouspage quick-uis.html \else \previouspage creator-using-qt-quick-designer.html \endif diff --git a/doc/qtcreator/src/qtquick/qtquick-ui-forms.qdoc b/doc/qtcreator/src/qtquick/qtquick-ui-forms.qdoc index 49f682d7ce7..14bb305be16 100644 --- a/doc/qtcreator/src/qtquick/qtquick-ui-forms.qdoc +++ b/doc/qtcreator/src/qtquick/qtquick-ui-forms.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2019 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Creator documentation. @@ -34,11 +34,7 @@ \contentspage index.html \page creator-quick-ui-forms.html \previouspage qtquick-annotations.html - \if defined(qtdesignstudio) - \nextpage creator-live-preview.html - \else - \nextpage creator-qml-modules-with-plugins.html - \endif + \nextpage qtquick-adding-dynamics.html \title Qt Quick UI Forms From ae080facf513f943727b816589eb7152fb191ba7 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 23 Apr 2020 11:00:30 +0200 Subject: [PATCH 05/23] CMake build: export less generic public includes Do not put every plugin's and lib's source folder into public includes. We require includes of the style and if someone depends on somelib or someplugin. Change-Id: I3a9f200b7c3879cf431b00a1bab4a70f7aa0a9ec Reviewed-by: Cristian Adam --- cmake/QtCreatorAPI.cmake | 11 +++++------ src/libs/clangsupport/CMakeLists.txt | 2 ++ src/libs/modelinglib/CMakeLists.txt | 2 ++ src/libs/sqlite/CMakeLists.txt | 4 +++- src/plugins/qmldesigner/CMakeLists.txt | 4 +++- src/shared/designerintegrationv2/CMakeLists.txt | 10 ++++++---- src/shared/help/CMakeLists.txt | 1 + src/tools/clangbackend/source/CMakeLists.txt | 1 + .../clangpchmanagerbackend/source/CMakeLists.txt | 1 + .../clangrefactoringbackend/source/CMakeLists.txt | 1 + 10 files changed, 25 insertions(+), 12 deletions(-) diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index 993102e139a..f6387b7919f 100644 --- a/cmake/QtCreatorAPI.cmake +++ b/cmake/QtCreatorAPI.cmake @@ -496,11 +496,11 @@ function(add_qtc_library name) file(RELATIVE_PATH include_dir_relative_path ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(${name} - PRIVATE ${_arg_INCLUDES} - PUBLIC + PRIVATE + ${_arg_INCLUDES} "$" + PUBLIC "$" - "$" "$" ) set_public_includes(${name} "${_arg_PUBLIC_INCLUDES}") @@ -755,10 +755,9 @@ function(add_qtc_plugin target_name) ${_arg_INCLUDES} "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_BINARY_DIR}/src" - PUBLIC "$" + PUBLIC "$" - "$" "$" ) set_public_includes(${target_name} "${_arg_PUBLIC_INCLUDES}") @@ -886,7 +885,7 @@ function(extend_qtc_target target_name) if (NOT IS_ABSOLUTE ${_arg_SOURCES_PREFIX}) set(_arg_SOURCES_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/${_arg_SOURCES_PREFIX}") endif() - target_include_directories(${target_name} PUBLIC $) + target_include_directories(${target_name} PRIVATE $) set(_arg_SOURCES ${prefixed_sources}) endif() diff --git a/src/libs/clangsupport/CMakeLists.txt b/src/libs/clangsupport/CMakeLists.txt index b7e02db6457..093213147b2 100644 --- a/src/libs/clangsupport/CMakeLists.txt +++ b/src/libs/clangsupport/CMakeLists.txt @@ -8,6 +8,8 @@ add_qtc_library(ClangSupport CLANG_RESOURCE_DIR="${IDE_LIBEXEC_PATH}/clang/lib/clang/${CLANG_VERSION}/include" CLANG_BINDIR="${IDE_LIBEXEC_PATH}/clang/bin" DEFINES CLANGSUPPORT_BUILD_LIB + PUBLIC_INCLUDES + "${CMAKE_CURRENT_LIST_DIR}" SOURCES alivemessage.cpp alivemessage.h annotationsmessage.cpp annotationsmessage.h diff --git a/src/libs/modelinglib/CMakeLists.txt b/src/libs/modelinglib/CMakeLists.txt index 55c6e3a951d..db79b99ee33 100644 --- a/src/libs/modelinglib/CMakeLists.txt +++ b/src/libs/modelinglib/CMakeLists.txt @@ -3,6 +3,8 @@ add_qtc_library(Modeling DEPENDS Qt5::Widgets Utils PUBLIC_DEPENDS OptionalSvg INCLUDES qtserialization/inc + PUBLIC_INCLUDES + "${CMAKE_CURRENT_LIST_DIR}" SOURCES qmt/config/configcontroller.cpp qmt/config/configcontroller.h qmt/config/sourcepos.cpp qmt/config/sourcepos.h diff --git a/src/libs/sqlite/CMakeLists.txt b/src/libs/sqlite/CMakeLists.txt index 62c8609a7af..d28195f7684 100644 --- a/src/libs/sqlite/CMakeLists.txt +++ b/src/libs/sqlite/CMakeLists.txt @@ -4,7 +4,9 @@ add_qtc_library(Sqlite SQLITE_ENABLE_UNLOCK_NOTIFY SQLITE_ENABLE_COLUMN_METADATA BUILD_SQLITE_LIBRARY DEPENDS Qt5::Core Threads::Threads ${CMAKE_DL_LIBS} - PUBLIC_INCLUDES ../3rdparty/sqlite + INCLUDES ../3rdparty/sqlite + PUBLIC_INCLUDES + "${CMAKE_CURRENT_LIST_DIR}" SOURCES ../3rdparty/sqlite/sqlite3.c createtablesqlstatementbuilder.cpp createtablesqlstatementbuilder.h diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt index 75a8571b818..9c32da72c41 100644 --- a/src/plugins/qmldesigner/CMakeLists.txt +++ b/src/plugins/qmldesigner/CMakeLists.txt @@ -6,7 +6,8 @@ add_qtc_plugin(QmlDesigner DESIGNER_CORE_LIBRARY IDE_LIBRARY_BASENAME=\"${IDE_LIBRARY_BASE_PATH}\" PUBLIC_INCLUDES - ${CMAKE_CURRENT_LIST_DIR}/designercore/include + "${CMAKE_CURRENT_LIST_DIR}" + "${CMAKE_CURRENT_LIST_DIR}/designercore/include" PLUGIN_DEPENDS Core ProjectExplorer QmlJSEditor QmakeProjectManager QmlProjectManager QtSupport TextEditor @@ -155,6 +156,7 @@ extend_qtc_plugin(QmlDesigner extend_qtc_plugin(QmlDesigner SOURCES_PREFIX ../../../share/qtcreator/qml/qmlpuppet/types + PUBLIC_INCLUDES ../../../share/qtcreator/qml/qmlpuppet/types SOURCES enumeration.h ) diff --git a/src/shared/designerintegrationv2/CMakeLists.txt b/src/shared/designerintegrationv2/CMakeLists.txt index 8e2520d50e7..b527260fa49 100644 --- a/src/shared/designerintegrationv2/CMakeLists.txt +++ b/src/shared/designerintegrationv2/CMakeLists.txt @@ -4,9 +4,11 @@ endif() add_qtc_library(designerintegrationv2 STATIC DEPENDS Qt5::Designer Qt5::Widgets + PUBLIC_INCLUDES + "${CMAKE_CURRENT_LIST_DIR}" SOURCES - formresizer.cpp formresizer.h - sizehandlerect.cpp sizehandlerect.h - widgethostconstants.h - widgethost.cpp widgethost.h + formresizer.cpp formresizer.h + sizehandlerect.cpp sizehandlerect.h + widgethostconstants.h + widgethost.cpp widgethost.h ) diff --git a/src/shared/help/CMakeLists.txt b/src/shared/help/CMakeLists.txt index 442911b4b88..6aa583b1542 100644 --- a/src/shared/help/CMakeLists.txt +++ b/src/shared/help/CMakeLists.txt @@ -18,6 +18,7 @@ add_qtc_library(shared_help STATIC "${PLUGIN_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/shared_help_autogen/include${autogen_suffix}" "${CMAKE_CURRENT_BINARY_DIR}/" + "${CMAKE_CURRENT_LIST_DIR}" SOURCES bookmarkdialog.ui bookmarkmanager.cpp bookmarkmanager.h diff --git a/src/tools/clangbackend/source/CMakeLists.txt b/src/tools/clangbackend/source/CMakeLists.txt index fe0ab54deb6..b071cb46b72 100644 --- a/src/tools/clangbackend/source/CMakeLists.txt +++ b/src/tools/clangbackend/source/CMakeLists.txt @@ -3,6 +3,7 @@ add_qtc_library(clangbackend_lib STATIC PUBLIC_DEFINES CLANGSUPPORT_BUILD_LIB PUBLIC_INCLUDES ${CLANG_INCLUDE_DIRS} + "${CMAKE_CURRENT_LIST_DIR}" SOURCES clangasyncjob.h clangbackend_global.h diff --git a/src/tools/clangpchmanagerbackend/source/CMakeLists.txt b/src/tools/clangpchmanagerbackend/source/CMakeLists.txt index 76973c6a21d..fd6644da235 100644 --- a/src/tools/clangpchmanagerbackend/source/CMakeLists.txt +++ b/src/tools/clangpchmanagerbackend/source/CMakeLists.txt @@ -3,6 +3,7 @@ add_qtc_library(clangpchmanagerbackend_lib STATIC PUBLIC_DEPENDS libclang PUBLIC_DEFINES CLANGSUPPORT_BUILD_LIB PUBLIC_INCLUDES + ../../clangrefactoringbackend/source ${CLANG_INCLUDE_DIRS} SOURCES builddependenciesprovider.cpp builddependenciesprovider.h diff --git a/src/tools/clangrefactoringbackend/source/CMakeLists.txt b/src/tools/clangrefactoringbackend/source/CMakeLists.txt index 420e630c886..f06ddee1cc6 100644 --- a/src/tools/clangrefactoringbackend/source/CMakeLists.txt +++ b/src/tools/clangrefactoringbackend/source/CMakeLists.txt @@ -10,6 +10,7 @@ add_qtc_library(clangrefactoringbackend_lib STATIC PUBLIC_INCLUDES ${CLANG_INCLUDE_DIRS} "../../clangpchmanagerbackend/source" + "${CMAKE_CURRENT_LIST_DIR}" SOURCES clangquery.cpp clangquery.h clangquerygatherer.cpp clangquerygatherer.h From d5ac552314e23db0d813c44abd89571b7e0ddd22 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 22 Apr 2020 20:30:05 +0200 Subject: [PATCH 06/23] QmlDesigner: Fix ComboBox for raw strings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie35bda95290042f2faaf938ee67b6ee02e8c55b1 Reviewed-by: Henning Gründl Reviewed-by: Thomas Hartmann --- .../imports/HelperWidgets/ComboBox.qml | 62 +++++++++++-------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ComboBox.qml index b3e8fda3685..2d70e40b1d5 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ComboBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ComboBox.qml @@ -38,6 +38,10 @@ StudioControls.ComboBox { enum ValueType { String, Integer, Enum } property int valueType: ComboBox.ValueType.Enum + onModelChanged: colorLogic.invalidate() + + // This is available in all editors. + onValueTypeChanged: { if (comboBox.valueType === ComboBox.ValueType.Integer) comboBox.useInteger = true @@ -97,28 +101,34 @@ StudioControls.ComboBox { comboBox.valueFromBackendChanged() } else { switch (comboBox.valueType) { - case ComboBox.ValueType.String: - if (comboBox.currentText !== comboBox.backendValue.value) - comboBox.currentText = comboBox.backendValue.value - break - case ComboBox.ValueType.Integer: - if (comboBox.currentIndex !== comboBox.backendValue.value) - comboBox.currentIndex = comboBox.backendValue.value - break - case ComboBox.ValueType.Enum: - default: - var enumString = comboBox.backendValue.enumeration - - if (enumString === "") - enumString = comboBox.backendValue.value - - var index = comboBox.find(enumString) - + case ComboBox.ValueType.String: + if (comboBox.currentText !== comboBox.backendValue.value) { + var index = comboBox.find(comboBox.backendValue.value) if (index < 0) index = 0 if (index !== comboBox.currentIndex) comboBox.currentIndex = index + } + break + case ComboBox.ValueType.Integer: + if (comboBox.currentIndex !== comboBox.backendValue.value) + comboBox.currentIndex = comboBox.backendValue.value + break + case ComboBox.ValueType.Enum: + default: + var enumString = comboBox.backendValue.enumeration + + if (enumString === "") + enumString = comboBox.backendValue.value + + index = comboBox.find(enumString) + + if (index < 0) + index = 0 + + if (index !== comboBox.currentIndex) + comboBox.currentIndex = index } } @@ -137,15 +147,15 @@ StudioControls.ComboBox { return switch (comboBox.valueType) { - case ComboBox.ValueType.String: - comboBox.backendValue.value = comboBox.currentText - break - case ComboBox.ValueType.Integer: - comboBox.backendValue.value = comboBox.currentIndex - break - case ComboBox.ValueType.Enum: - default: - comboBox.backendValue.setEnumeration(comboBox.scope, comboBox.currentText) + case ComboBox.ValueType.String: + comboBox.backendValue.value = comboBox.currentText + break + case ComboBox.ValueType.Integer: + comboBox.backendValue.value = comboBox.currentIndex + break + case ComboBox.ValueType.Enum: + default: + comboBox.backendValue.setEnumeration(comboBox.scope, comboBox.currentText) } } From 92c7662acb8fdb6810cbc949844ce112bc9117dd Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Mon, 6 Apr 2020 14:25:11 +0200 Subject: [PATCH 07/23] ADS: Integrate newest base repository commits 998fe9fa11939eb28dd021ca11d5302c4fe2a005 28dc374fc25fcf5a4100c7ad929cb8da690530ed 0e88467f94194d5bea209f6ddc364358ab92899e d0f4ce324890197683869eafda0f3938ae619b8d c541f2c69b519eceb76ffc54589175c9fd0da8a6 37d305e50d2c0829f031b71a61e290361eea9f07 - Fix/workaround for escape key issue with remaining overlays - Clean up if statements according to style guide Task-number: QDS-1883 Change-Id: I44ddaed67458a75aca91bdd74cd2b5890bd23c38 Reviewed-by: Aleksei German Reviewed-by: Thomas Hartmann --- .../advanceddockingsystem/dockareawidget.cpp | 27 ++++ .../advanceddockingsystem/dockareawidget.h | 7 + src/libs/advanceddockingsystem/dockwidget.cpp | 15 ++- src/libs/advanceddockingsystem/dockwidget.h | 26 +++- .../floatingdockcontainer.cpp | 126 +++++++++++------- .../floatingdockcontainer.h | 1 + 6 files changed, 151 insertions(+), 51 deletions(-) diff --git a/src/libs/advanceddockingsystem/dockareawidget.cpp b/src/libs/advanceddockingsystem/dockareawidget.cpp index 16bd88f5716..6e7f9d5c993 100644 --- a/src/libs/advanceddockingsystem/dockareawidget.cpp +++ b/src/libs/advanceddockingsystem/dockareawidget.cpp @@ -215,6 +215,7 @@ namespace ADS DockManager *m_dockManager = nullptr; bool m_updateTitleBarButtons = false; DockWidgetAreas m_allowedAreas = AllDockAreas; + QSize m_minSizeHint; /** * Private data constructor @@ -264,6 +265,22 @@ namespace ADS * Udpates the enable state of the close and detach button */ void updateTitleBarButtonStates(); + + /** + * Scans all contained dock widgets for the max. minimum size hint + */ + void updateMinimumSizeHint() + { + m_minSizeHint = QSize(); + for (int i = 0; i < m_contentsLayout->count(); ++i) + { + auto widget = m_contentsLayout->widget(i); + m_minSizeHint.setHeight(qMax(m_minSizeHint.height(), + widget->minimumSizeHint().height())); + m_minSizeHint.setWidth(qMax(m_minSizeHint.width(), + widget->minimumSizeHint().width())); + } + } }; // struct DockAreaWidgetPrivate @@ -349,6 +366,10 @@ namespace ADS d->tabBar()->blockSignals(false); tabWidget->setVisible(!dockWidget->isClosed()); dockWidget->setProperty(INDEX_PROPERTY, index); + d->m_minSizeHint.setHeight(qMax(d->m_minSizeHint.height(), + dockWidget->minimumSizeHint().height())); + d->m_minSizeHint.setWidth(qMax(d->m_minSizeHint.width(), + dockWidget->minimumSizeHint().width())); if (activate) { setCurrentIndex(index); } @@ -381,6 +402,7 @@ namespace ADS d->updateTitleBarButtonStates(); updateTitleBarVisibility(); + d->updateMinimumSizeHint(); auto topLevelDockWidget = dockContainerWidget->topLevelDockWidget(); if (topLevelDockWidget) { topLevelDockWidget->emitTopLevelChanged(true); @@ -683,4 +705,9 @@ namespace ADS DockAreaTitleBar *DockAreaWidget::titleBar() const { return d->m_titleBar; } + QSize DockAreaWidget::minimumSizeHint() const + { + return d->m_minSizeHint.isValid() ? d->m_minSizeHint : Super::minimumSizeHint(); + } + } // namespace ADS diff --git a/src/libs/advanceddockingsystem/dockareawidget.h b/src/libs/advanceddockingsystem/dockareawidget.h index 9c23584ae78..74ab85c69f2 100644 --- a/src/libs/advanceddockingsystem/dockareawidget.h +++ b/src/libs/advanceddockingsystem/dockareawidget.h @@ -291,6 +291,13 @@ public: */ void closeOtherAreas(); + /** + * Returns the largest minimumSizeHint() of the dock widgets in this + * area. + * The minimum size hint is updated if a dock widget is removed or added. + */ + virtual QSize minimumSizeHint() const override; + signals: /** * This signal is emitted when user clicks on a tab at an index. diff --git a/src/libs/advanceddockingsystem/dockwidget.cpp b/src/libs/advanceddockingsystem/dockwidget.cpp index 760f425ae78..c703b0a6650 100644 --- a/src/libs/advanceddockingsystem/dockwidget.cpp +++ b/src/libs/advanceddockingsystem/dockwidget.cpp @@ -83,6 +83,7 @@ namespace ADS QSize m_toolBarIconSizeFloating = QSize(24, 24); bool m_isFloatingTopLevel = false; QList m_titleBarActions; + DockWidget::eMinimumSizeHintMode m_minimumSizeHintMode = DockWidget::MinimumSizeHintFromDockWidget; /** * Private data constructor @@ -317,6 +318,11 @@ namespace ADS } } + void DockWidget::setMinimumSizeHintMode(eMinimumSizeHintMode mode) + { + d->m_minimumSizeHintMode = mode; + } + void DockWidget::toggleView(bool open) { // If the toggle view action mode is ActionModeShow, then Open is always @@ -545,7 +551,13 @@ namespace ADS void DockWidget::setClosedState(bool closed) { d->m_closed = closed; } - QSize DockWidget::minimumSizeHint() const { return QSize(60, 40); } + QSize DockWidget::minimumSizeHint() const + { + if (d->m_minimumSizeHintMode == DockWidget::MinimumSizeHintFromDockWidget || !d->m_widget) + return QSize(60, 40); + else + return d->m_widget->minimumSizeHint(); + } void DockWidget::setFloating() { @@ -587,6 +599,7 @@ namespace ADS floatingWidget->hide(); } deleteDockWidget(); + emit closed(); } else { toggleView(false); } diff --git a/src/libs/advanceddockingsystem/dockwidget.h b/src/libs/advanceddockingsystem/dockwidget.h index 0d6efa28d02..687704e3653 100644 --- a/src/libs/advanceddockingsystem/dockwidget.h +++ b/src/libs/advanceddockingsystem/dockwidget.h @@ -184,6 +184,17 @@ public: */ enum eInsertMode { AutoScrollArea, ForceScrollArea, ForceNoScrollArea }; + /** + * The mode of the minimumSizeHint() that is returned by the DockWidget + * minimumSizeHint() function. + * To ensure, that a dock widget does not block resizing, the dock widget + * reimplements minimumSizeHint() function to return a very small minimum + * size hint. If you would like to adhere the minimumSizeHint() from the + * content widget, the set the minimumSizeHintMode() to + * MinimumSizeHintFromContent. + */ + enum eMinimumSizeHintMode { MinimumSizeHintFromDockWidget, MinimumSizeHintFromContent }; + /** * This mode configures the behavior of the toggle view action. * If the mode if ActionModeToggle, then the toggle view action is @@ -218,7 +229,8 @@ public: virtual ~DockWidget() override; /** - * We return a fixed minimum size hint for all dock widgets + * We return a fixed minimum size hint or the size hint of the content + * widget if minimum size hint mode is MinimumSizeHintFromContent */ virtual QSize minimumSizeHint() const override; @@ -327,6 +339,13 @@ public: */ void setToggleViewActionMode(eToggleViewActionMode mode); + /** + * Configures the minimum size hint that is returned by the + * minimumSizeHint() function. + * \see eMinimumSizeHintMode for a detailed description + */ + void setMinimumSizeHintMode(eMinimumSizeHintMode mode); + /** * Sets the dock widget icon that is shown in tabs and in toggle view * actions @@ -339,13 +358,10 @@ public: QIcon icon() const; /** - * If the WithToolBar layout flag is enabled, then this function returns - * the dock widget toolbar. If the flag is disabled, the function returns - * a nullptr. * This function returns the dock widget top tool bar. * If no toolbar is assigned, this function returns nullptr. To get a valid * toolbar you either need to create a default empty toolbar via - * createDefaultToolBar() function or you need to assign you custom + * createDefaultToolBar() function or you need to assign your custom * toolbar via setToolBar(). */ QToolBar *toolBar() const; diff --git a/src/libs/advanceddockingsystem/floatingdockcontainer.cpp b/src/libs/advanceddockingsystem/floatingdockcontainer.cpp index c245dcb2066..18c70834dd7 100644 --- a/src/libs/advanceddockingsystem/floatingdockcontainer.cpp +++ b/src/libs/advanceddockingsystem/floatingdockcontainer.cpp @@ -73,6 +73,7 @@ namespace ADS QPoint m_dragStartMousePosition; DockContainerWidget *m_dropContainer = nullptr; DockAreaWidget *m_singleDockArea = nullptr; + QPoint m_dragStartPos; QWidget *m_mouseEventHandler = nullptr; FloatingWidgetTitleBar *m_titleBar = nullptr; @@ -107,25 +108,30 @@ namespace ADS q->setWindowTitle(text); } + /** + * Reflect the current dock widget title in the floating widget windowTitle() + * depending on the DockManager::FloatingContainerHasWidgetTitle flag + */ void reflectCurrentWidget(DockWidget *currentWidget) { // reflect CurrentWidget's title if configured to do so, otherwise display application name as window title - if (testConfigFlag(DockManager::FloatingContainerHasWidgetTitle)) { + if (testConfigFlag(DockManager::FloatingContainerHasWidgetTitle)) setWindowTitle(currentWidget->windowTitle()); - } else { + else setWindowTitle(QApplication::applicationDisplayName()); - } - // reflect CurrentWidget's icon if configured to do so, otherwise display application icon as window icon - QIcon CurrentWidgetIcon = currentWidget->icon(); - if (testConfigFlag(DockManager::FloatingContainerHasWidgetIcon) - && !CurrentWidgetIcon.isNull()) - { + // reflect currentWidget's icon if configured to do so, otherwise display application icon as window icon + QIcon currentWidgetIcon = currentWidget->icon(); + if (testConfigFlag(DockManager::FloatingContainerHasWidgetIcon) && !currentWidgetIcon.isNull()) q->setWindowIcon(currentWidget->icon()); - } else { + else q->setWindowIcon(QApplication::windowIcon()); - } } + + /** + * Handles escape key press when dragging around the floating widget + */ + void handleEscapeKey(); }; // class FloatingDockContainerPrivate FloatingDockContainerPrivate::FloatingDockContainerPrivate(FloatingDockContainer *parent) @@ -135,17 +141,15 @@ namespace ADS void FloatingDockContainerPrivate::titleMouseReleaseEvent() { setState(DraggingInactive); - if (!m_dropContainer) { + if (!m_dropContainer) return; - } if (m_dockManager->dockAreaOverlay()->dropAreaUnderCursor() != InvalidDockWidgetArea || m_dockManager->containerOverlay()->dropAreaUnderCursor() != InvalidDockWidgetArea) { // Resize the floating widget to the size of the highlighted drop area rectangle DockOverlay *overlay = m_dockManager->containerOverlay(); - if (!overlay->dropOverlayRect().isValid()) { + if (!overlay->dropOverlayRect().isValid()) overlay = m_dockManager->dockAreaOverlay(); - } QRect rect = overlay->dropOverlayRect(); int frameWidth = (q->frameSize().width() - q->rect().width()) / 2; @@ -165,26 +169,22 @@ namespace ADS void FloatingDockContainerPrivate::updateDropOverlays(const QPoint &globalPosition) { - if (!q->isVisible() || !m_dockManager) { + if (!q->isVisible() || !m_dockManager) return; - } auto containers = m_dockManager->dockContainers(); DockContainerWidget *topContainer = nullptr; for (auto containerWidget : containers) { - if (!containerWidget->isVisible()) { + if (!containerWidget->isVisible()) continue; - } - if (m_dockContainer == containerWidget) { + if (m_dockContainer == containerWidget) continue; - } QPoint mappedPos = containerWidget->mapFromGlobal(globalPosition); if (containerWidget->rect().contains(mappedPos)) { - if (!topContainer || containerWidget->isInFrontOf(topContainer)) { + if (!topContainer || containerWidget->isInFrontOf(topContainer)) topContainer = containerWidget; - } } } @@ -223,6 +223,14 @@ namespace ADS } } + void FloatingDockContainerPrivate::handleEscapeKey() + { + qCInfo(adsLog) << Q_FUNC_INFO; + setState(DraggingInactive); + m_dockManager->containerOverlay()->hideOverlay(); + m_dockManager->dockAreaOverlay()->hideOverlay(); + } + FloatingDockContainer::FloatingDockContainer(DockManager *dockManager) : FloatingWidgetBaseType(dockManager) , d(new FloatingDockContainerPrivate(this)) @@ -268,9 +276,8 @@ namespace ADS d->m_titleBar->enableCloseButton(isClosable()); auto dw = topLevelDockWidget(); - if (dw) { + if (dw) dw->emitTopLevelChanged(true); - } } FloatingDockContainer::FloatingDockContainer(DockWidget *dockWidget) @@ -281,17 +288,16 @@ namespace ADS d->m_titleBar->enableCloseButton(isClosable()); auto dw = topLevelDockWidget(); - if (dw) { + if (dw) dw->emitTopLevelChanged(true); - } } FloatingDockContainer::~FloatingDockContainer() { qCInfo(adsLog) << Q_FUNC_INFO; - if (d->m_dockManager) { + if (d->m_dockManager) d->m_dockManager->removeFloatingWidget(this); - } + delete d; } @@ -312,6 +318,10 @@ namespace ADS QWidget::moveEvent(event); switch (d->m_draggingState) { case DraggingMousePressed: + // TODO Is checking for windows only sufficient or has macOS also problems? + if (Utils::HostOsInfo::isWindowsHost()) + QApplication::instance()->installEventFilter(this); + d->setState(DraggingFloatingWidget); d->updateDropOverlays(QCursor::pos()); break; @@ -340,9 +350,8 @@ namespace ADS if (isClosable()) { auto dw = topLevelDockWidget(); if (dw && dw->features().testFlag(DockWidget::DockWidgetDeleteOnClose)) { - if (!dw->closeDockWidgetInternal()) { + if (!dw->closeDockWidgetInternal()) return; - } } this->hide(); @@ -352,19 +361,16 @@ namespace ADS void FloatingDockContainer::hideEvent(QHideEvent *event) { Super::hideEvent(event); - if (event->spontaneous()) { + if (event->spontaneous()) return; - } // Prevent toogleView() events during restore state - if (d->m_dockManager->isRestoringState()) { + if (d->m_dockManager->isRestoringState()) return; - } for (auto dockArea : d->m_dockContainer->openedDockAreas()) { - for (auto dockWidget : dockArea->openedDockWidgets()) { + for (auto dockWidget : dockArea->openedDockWidgets()) dockWidget->toggleView(false); - } } } @@ -379,22 +385,21 @@ namespace ADS // QEvent::NonClientAreaMouseButtonPress return the wrong mouse button // The event always returns Qt::RightButton even if the left button is clicked. // It is really great to work around the whole NonClientMouseArea bugs + + #if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 2)) - if (event->type() - == QEvent:: - NonClientAreaMouseButtonPress /*&& QGuiApplication::mouseButtons().testFlag(Qt::LeftButton)*/) { - qCInfo(adsLog) << Q_FUNC_INFO << "QEvent::NonClientAreaMouseButtonPress" - << event->type(); - d->setState(DraggingMousePressed); - } + if (event->type() == QEvent::NonClientAreaMouseButtonPress + /*&& QGuiApplication::mouseButtons().testFlag(Qt::LeftButton)*/) #else if (event->type() == QEvent::NonClientAreaMouseButtonPress - && QGuiApplication::mouseButtons().testFlag(Qt::LeftButton)) { + && QGuiApplication::mouseButtons().testFlag(Qt::LeftButton)) +#endif + { qCInfo(adsLog) << Q_FUNC_INFO << "QEvent::NonClientAreaMouseButtonPress" << event->type(); + d->m_dragStartPos = pos(); d->setState(DraggingMousePressed); } -#endif } break; case DraggingMousePressed: @@ -440,6 +445,37 @@ namespace ADS return QWidget::event(event); } + bool FloatingDockContainer::eventFilter(QObject *watched, QEvent *event) + { + Q_UNUSED(watched); + // I have not found a way to detect non client area key press events to + // handle escape key presses. On Windows, if the escape key is pressed while + // dragging around a widget, the widget position is reset to its start position + // which in turn generates a QEvent::NonClientAreaMouseButtonRelease event + // if the mouse is outside of the widget after the move to its initial position + // or a QEvent::MouseButtonRelease event, if the mouse is inside of the widget + // after the position has been reset. + // So we can install an event filter on the application to get these events + // here to properly cancel dragging and hide the overlays. + // If we are in DraggingFloatingWidget state, it means the widget + // has been dragged already but if the position is the same like + // the start position, then this is an indication that the escape + // key has been pressed. + if (event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::NonClientAreaMouseButtonRelease) + { + qCInfo(adsLog) << Q_FUNC_INFO << "QEvent::MouseButtonRelease or QEvent::NonClientAreaMouseButtonRelease" + << "d->m_draggingState " << d->m_draggingState; + QApplication::instance()->removeEventFilter(this); + if (d->m_dragStartPos == pos()) + { + d->handleEscapeKey(); + return true; + } + return false; + } + return false; + } + void FloatingDockContainer::startFloating(const QPoint &dragStartMousePos, const QSize &size, eDragState dragState, diff --git a/src/libs/advanceddockingsystem/floatingdockcontainer.h b/src/libs/advanceddockingsystem/floatingdockcontainer.h index 83ca1edddeb..1b6a9d5b2f7 100644 --- a/src/libs/advanceddockingsystem/floatingdockcontainer.h +++ b/src/libs/advanceddockingsystem/floatingdockcontainer.h @@ -188,6 +188,7 @@ protected: // reimplements QWidget virtual void closeEvent(QCloseEvent *event) override; virtual void hideEvent(QHideEvent *event) override; virtual void showEvent(QShowEvent *event) override; + virtual bool eventFilter(QObject *watched, QEvent *event) override; public: using Super = QWidget; From 2b6ce6cea5ffffc2f788ba08f3d9bb06bfcd498e Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 24 Apr 2020 13:01:20 +0200 Subject: [PATCH 08/23] Fix display of some file paths on Windows In particular, the "executable on host" field on RemoteLinux & friends had the wrong separators. Change-Id: Ic36d73e863c78dcefd5c670537dd7c86b081d173 Reviewed-by: hjk --- src/plugins/projectexplorer/projectconfigurationaspects.cpp | 4 ++-- src/plugins/projectexplorer/runconfigurationaspects.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/projectexplorer/projectconfigurationaspects.cpp b/src/plugins/projectexplorer/projectconfigurationaspects.cpp index 44e765e3c19..588318de592 100644 --- a/src/plugins/projectexplorer/projectconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/projectconfigurationaspects.cpp @@ -178,12 +178,12 @@ void BaseStringAspect::toMap(QVariantMap &map) const FilePath BaseStringAspect::filePath() const { - return FilePath::fromString(d->m_value); + return FilePath::fromUserInput(d->m_value); } void BaseStringAspect::setFilePath(const FilePath &val) { - setValue(val.toString()); + setValue(val.toUserOutput()); } void BaseStringAspect::setLabelText(const QString &labelText) diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp index 4ec47bca4e4..343ca369ea9 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp @@ -469,7 +469,7 @@ void ExecutableAspect::setPlaceHolderText(const QString &placeHolderText) void ExecutableAspect::setExecutable(const FilePath &executable) { - m_executable.setValue(executable.toString()); + m_executable.setFilePath(executable); m_executable.setShowToolTipOnLabel(true); } From ab840d004377f96ede62ce92d603f63d90818e89 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 24 Apr 2020 17:19:23 +0200 Subject: [PATCH 09/23] Doc: Fix description of how to get to global "lib search path" setting Change-Id: I7598f91a77c27578f1e6b106f6ae9b0f84481746 Reviewed-by: Leena Miettinen --- .../creator-only/creator-projects-settings-run-desktop.qdocinc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run-desktop.qdocinc b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run-desktop.qdocinc index e0b1c7187e4..732090a5238 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run-desktop.qdocinc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-run-desktop.qdocinc @@ -53,7 +53,7 @@ To disable library linking for the current project, deselect the \uicontrol {Add build library search path to PATH} check box. To disable library linking for all projects, select \uicontrol Tools > - \uicontrol Options > \uicontrol General, and then deselect the + \uicontrol Options > \uicontrol {Build & Run}, and then deselect the \uicontrol {Add linker library search paths to run environment} check box. The \uicontrol {Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)} option From 5795ce2aae14692ceed23d3a673661373f9f8ce5 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 22 Apr 2020 23:24:54 +0200 Subject: [PATCH 10/23] McuSupport: Remove outdated Qt for MCUs kits Add a version to the generated Qt for MCUs kits. That version will increase with every change to the way Qt for MCUs kits get generated. If there are auto-detected Qt for MCUs kits with a different version than the current, remove these kits when a "fresh" gets generated. Task-number: QTCREATORBUG-23891 Change-Id: Iafcd2342d458f9c77ada47180cb61b3b4b090598 Reviewed-by: Eike Ziller --- src/plugins/mcusupport/mcusupportconstants.h | 1 + src/plugins/mcusupport/mcusupportoptions.cpp | 18 ++++++++++++++++++ src/plugins/mcusupport/mcusupportoptions.h | 2 ++ .../mcusupport/mcusupportoptionspage.cpp | 1 + 4 files changed, 22 insertions(+) diff --git a/src/plugins/mcusupport/mcusupportconstants.h b/src/plugins/mcusupport/mcusupportconstants.h index 88489b1196c..17fd68f181f 100644 --- a/src/plugins/mcusupport/mcusupportconstants.h +++ b/src/plugins/mcusupport/mcusupportconstants.h @@ -35,6 +35,7 @@ const char SETTINGS_ID[] = "CC.McuSupport.Configuration"; const char KIT_MCUTARGET_VENDOR_KEY[] = "McuSupport.McuTargetVendor"; const char KIT_MCUTARGET_MODEL_KEY[] = "McuSupport.McuTargetModel"; const char KIT_MCUTARGET_SDKVERSION_KEY[] = "McuSupport.McuTargetSdkVersion"; +const char KIT_MCUTARGET_KITVERSION_KEY[] = "McuSupport.McuTargetKitVersion"; const char SETTINGS_GROUP[] = "McuSupport"; const char SETTINGS_KEY_PACKAGE_PREFIX[] = "Package_"; diff --git a/src/plugins/mcusupport/mcusupportoptions.cpp b/src/plugins/mcusupport/mcusupportoptions.cpp index 719030e3feb..342e273e6e3 100644 --- a/src/plugins/mcusupport/mcusupportoptions.cpp +++ b/src/plugins/mcusupport/mcusupportoptions.cpp @@ -61,6 +61,8 @@ namespace McuSupport { namespace Internal { +static const int KIT_VERSION = 1; // Bumps up whenever details in Kit creation change + static QString packagePathFromSettings(const QString &settingsKey, const QString &defaultPath = {}) { QSettings *s = Core::ICore::settings(); @@ -473,6 +475,7 @@ static void setKitProperties(const QString &kitName, ProjectExplorer::Kit *k, k->setValue(Constants::KIT_MCUTARGET_MODEL_KEY, mcuTarget->qulPlatform()); k->setValue(Constants::KIT_MCUTARGET_SDKVERSION_KEY, McuSupportOptions::supportedQulVersion().toString()); + k->setValue(Constants::KIT_MCUTARGET_KITVERSION_KEY, KIT_VERSION); k->setAutoDetected(true); k->makeSticky(); if (mcuTarget->toolChainPackage()->type() == McuToolChainPackage::TypeDesktop) @@ -613,6 +616,21 @@ QList McuSupportOptions::existingKits(const McuTarget *m }); } +QList McuSupportOptions::outdatedKits() +{ + return Utils::filtered(ProjectExplorer::KitManager::kits(), [](ProjectExplorer::Kit *kit) { + return kit->isAutoDetected() + && !kit->value(Constants::KIT_MCUTARGET_VENDOR_KEY).isNull() + && kit->value(Constants::KIT_MCUTARGET_KITVERSION_KEY) != KIT_VERSION; + }); +} + +void McuSupportOptions::removeOutdatedKits() +{ + for (auto kit : McuSupportOptions::outdatedKits()) + ProjectExplorer::KitManager::deregisterKit(kit); +} + ProjectExplorer::Kit *McuSupportOptions::newKit(const McuTarget *mcuTarget) { using namespace ProjectExplorer; diff --git a/src/plugins/mcusupport/mcusupportoptions.h b/src/plugins/mcusupport/mcusupportoptions.h index b87452cca5c..2843ba6341c 100644 --- a/src/plugins/mcusupport/mcusupportoptions.h +++ b/src/plugins/mcusupport/mcusupportoptions.h @@ -168,6 +168,8 @@ public: QString kitName(const McuTarget* mcuTarget) const; QList existingKits(const McuTarget *mcuTargt); + static QList outdatedKits(); + static void removeOutdatedKits(); ProjectExplorer::Kit *newKit(const McuTarget *mcuTarget); void populatePackagesAndTargets(); static void registerQchFiles(); diff --git a/src/plugins/mcusupport/mcusupportoptionspage.cpp b/src/plugins/mcusupport/mcusupportoptionspage.cpp index e07899028d5..7fabe979314 100644 --- a/src/plugins/mcusupport/mcusupportoptionspage.cpp +++ b/src/plugins/mcusupport/mcusupportoptionspage.cpp @@ -231,6 +231,7 @@ void McuSupportOptionsWidget::apply() return; McuSupportOptions::registerQchFiles(); + McuSupportOptions::removeOutdatedKits(); const McuTarget *mcuTarget = currentMcuTarget(); if (!mcuTarget) From db0d7a2669acf4d51dfdb31ef092669d4d8782c5 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 23 Apr 2020 23:30:40 +0200 Subject: [PATCH 11/23] McuSupport: Make some functions in McuSupportOptions static There is no good enough reason to have them non-static, and upcoming changes will have it a bit easier with static calls. Additionally, make McuTarget::m_toolChainPackage const. Change-Id: I002d5d56606d3b43c4c7a2f63c59e97a81342c69 Reviewed-by: Eike Ziller --- src/plugins/mcusupport/mcusupportoptions.cpp | 36 +++++++++---------- src/plugins/mcusupport/mcusupportoptions.h | 12 +++---- .../mcusupport/mcusupportoptionspage.cpp | 10 +++--- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/plugins/mcusupport/mcusupportoptions.cpp b/src/plugins/mcusupport/mcusupportoptions.cpp index 342e273e6e3..15936c316ff 100644 --- a/src/plugins/mcusupport/mcusupportoptions.cpp +++ b/src/plugins/mcusupport/mcusupportoptions.cpp @@ -321,13 +321,13 @@ QVariant McuToolChainPackage::debuggerId() const } McuTarget::McuTarget(const QString &vendor, const QString &platform, - const QVector &packages, McuToolChainPackage *toolChainPackage) + const QVector &packages, + const McuToolChainPackage *toolChainPackage) : m_vendor(vendor) , m_qulPlatform(platform) , m_packages(packages) , m_toolChainPackage(toolChainPackage) { - QTC_CHECK(m_toolChainPackage == nullptr || m_packages.contains(m_toolChainPackage)); } QString McuTarget::vendor() const @@ -340,7 +340,7 @@ QVector McuTarget::packages() const return m_packages; } -McuToolChainPackage *McuTarget::toolChainPackage() const +const McuToolChainPackage *McuTarget::toolChainPackage() const { return m_toolChainPackage; } @@ -523,7 +523,7 @@ static void setKitDevice(ProjectExplorer::Kit *k, const McuTarget* mcuTarget) } static void setKitEnvironment(ProjectExplorer::Kit *k, const McuTarget* mcuTarget, - McuPackage *qtForMCUsSdkPackage) + const McuPackage *qtForMCUsSdkPackage) { using namespace ProjectExplorer; @@ -537,18 +537,17 @@ static void setKitEnvironment(ProjectExplorer::Kit *k, const McuTarget* mcuTarge && !CMakeProjectManager::CMakeToolManager::defaultCMakeTool()->hasFileApi()) pathAdditions.append(QDir::toNativeSeparators(qtForMCUsSdkPackage->path() + "/bin")); - QVector packagesIncludingSdk; - packagesIncludingSdk.reserve(mcuTarget->packages().size() + 1); - packagesIncludingSdk.append(mcuTarget->packages()); - packagesIncludingSdk.append(qtForMCUsSdkPackage); - - for (auto package : packagesIncludingSdk) { + auto processPackage = [&pathAdditions, &changes](const McuPackage *package) { if (package->addToPath()) pathAdditions.append(QDir::toNativeSeparators(package->path())); if (!package->environmentVariableName().isEmpty()) changes.append({package->environmentVariableName(), QDir::toNativeSeparators(package->path())}); - } + }; + for (auto package : mcuTarget->packages()) + processPackage(package); + processPackage(qtForMCUsSdkPackage); + pathAdditions.append("${Path}"); pathAdditions.append(QDir::toNativeSeparators(Core::ICore::libexecPath() + "/clang/bin")); const QString path = QLatin1String(Utils::HostOsInfo().isWindowsHost() ? "Path" : "PATH"); @@ -592,7 +591,7 @@ static void setKitQtVersionOptions(ProjectExplorer::Kit *k) QtSupport::QtKitAspect::setQtVersion(k, nullptr); } -QString McuSupportOptions::kitName(const McuTarget *mcuTarget) const +QString McuSupportOptions::kitName(const McuTarget *mcuTarget) { // TODO: get version from qulSdkPackage and insert into name const QString colorDepth = mcuTarget->colorDepth() > 0 @@ -607,10 +606,10 @@ QString McuSupportOptions::kitName(const McuTarget *mcuTarget) const .arg(supportedQulVersion().toString(), targetName, colorDepth); } -QList McuSupportOptions::existingKits(const McuTarget *mcuTargt) +QList McuSupportOptions::existingKits(const McuTarget *mcuTarget) { using namespace ProjectExplorer; - const QString mcuTargetKitName = kitName(mcuTargt); + const QString mcuTargetKitName = kitName(mcuTarget); return Utils::filtered(KitManager::kits(), [&mcuTargetKitName](Kit *kit) { return kit->isAutoDetected() && kit->unexpandedDisplayName() == mcuTargetKitName; }); @@ -631,19 +630,20 @@ void McuSupportOptions::removeOutdatedKits() ProjectExplorer::KitManager::deregisterKit(kit); } -ProjectExplorer::Kit *McuSupportOptions::newKit(const McuTarget *mcuTarget) +ProjectExplorer::Kit *McuSupportOptions::newKit(const McuTarget *mcuTarget, + const McuPackage *qtForMCUsSdk) { using namespace ProjectExplorer; - const auto init = [this, mcuTarget](Kit *k) { + const auto init = [mcuTarget, qtForMCUsSdk](Kit *k) { KitGuard kitGuard(k); setKitProperties(kitName(mcuTarget), k, mcuTarget); setKitDevice(k, mcuTarget); setKitToolchains(k, mcuTarget->toolChainPackage()); setKitDebugger(k, mcuTarget->toolChainPackage()); - setKitEnvironment(k, mcuTarget, qtForMCUsSdkPackage); - setKitCMakeOptions(k, mcuTarget, qtForMCUsSdkPackage->path()); + setKitEnvironment(k, mcuTarget, qtForMCUsSdk); + setKitCMakeOptions(k, mcuTarget, qtForMCUsSdk->path()); setKitQtVersionOptions(k); k->setup(); diff --git a/src/plugins/mcusupport/mcusupportoptions.h b/src/plugins/mcusupport/mcusupportoptions.h index 2843ba6341c..72d395090f6 100644 --- a/src/plugins/mcusupport/mcusupportoptions.h +++ b/src/plugins/mcusupport/mcusupportoptions.h @@ -132,11 +132,11 @@ class McuTarget : public QObject public: McuTarget(const QString &vendor, const QString &platform, const QVector &packages, - McuToolChainPackage *toolChainPackage); + const McuToolChainPackage *toolChainPackage); QString vendor() const; QVector packages() const; - McuToolChainPackage *toolChainPackage() const; + const McuToolChainPackage *toolChainPackage() const; QString qulPlatform() const; void setColorDepth(int colorDepth); int colorDepth() const; @@ -146,7 +146,7 @@ private: const QString m_vendor; const QString m_qulPlatform; const QVector m_packages; - McuToolChainPackage *m_toolChainPackage; + const McuToolChainPackage *m_toolChainPackage; int m_colorDepth = -1; }; @@ -165,12 +165,12 @@ public: void setQulDir(const Utils::FilePath &dir); static Utils::FilePath qulDirFromSettings(); - QString kitName(const McuTarget* mcuTarget) const; + static QString kitName(const McuTarget* mcuTarget); - QList existingKits(const McuTarget *mcuTargt); + static QList existingKits(const McuTarget *mcuTarget); static QList outdatedKits(); static void removeOutdatedKits(); - ProjectExplorer::Kit *newKit(const McuTarget *mcuTarget); + static ProjectExplorer::Kit *newKit(const McuTarget *mcuTarget, const McuPackage *qtForMCUsSdk); void populatePackagesAndTargets(); static void registerQchFiles(); static void registerExamples(); diff --git a/src/plugins/mcusupport/mcusupportoptionspage.cpp b/src/plugins/mcusupport/mcusupportoptionspage.cpp index 7fabe979314..e4506b902d4 100644 --- a/src/plugins/mcusupport/mcusupportoptionspage.cpp +++ b/src/plugins/mcusupport/mcusupportoptionspage.cpp @@ -168,7 +168,7 @@ void McuSupportOptionsWidget::updateStatus() mcuTargetValid ? QString::fromLatin1( "A kit %1 for the selected target can be " "generated. Press Apply to generate it.") - .arg(m_options.kitName(mcuTarget)) + .arg(McuSupportOptions::kitName(mcuTarget)) : "Provide the package paths in order to create a kit " "for your target."); } @@ -237,9 +237,9 @@ void McuSupportOptionsWidget::apply() if (!mcuTarget) return; - for (auto existingKit : m_options.existingKits(mcuTarget)) + for (auto existingKit : McuSupportOptions::existingKits(mcuTarget)) ProjectExplorer::KitManager::deregisterKit(existingKit); - m_options.newKit(mcuTarget); + McuSupportOptions::newKit(mcuTarget, m_options.qtForMCUsSdkPackage); } void McuSupportOptionsWidget::populateMcuTargetsComboBox() @@ -247,8 +247,8 @@ void McuSupportOptionsWidget::populateMcuTargetsComboBox() m_options.populatePackagesAndTargets(); m_mcuTargetsComboBox->clear(); m_mcuTargetsComboBox->addItems( - Utils::transform(m_options.mcuTargets, [this](McuTarget *t){ - return m_options.kitName(t); + Utils::transform(m_options.mcuTargets, [](McuTarget *t) { + return McuSupportOptions::kitName(t); })); updateStatus(); } From f2b9bdd9f276d01cb90983875226892a78dc54c5 Mon Sep 17 00:00:00 2001 From: Vikas Pachdha Date: Mon, 27 Apr 2020 12:25:05 +0200 Subject: [PATCH 12/23] Fix QML designer item library crash Task-number: QDS-2011 Change-Id: Ibf0c6db47eb25b730bc31fc7b52b0ec93ab15a63 Reviewed-by: Thomas Hartmann --- src/plugins/qmldesigner/designercore/include/itemlibraryinfo.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/designercore/include/itemlibraryinfo.h b/src/plugins/qmldesigner/designercore/include/itemlibraryinfo.h index 6c91d4917c2..6e70169a6af 100644 --- a/src/plugins/qmldesigner/designercore/include/itemlibraryinfo.h +++ b/src/plugins/qmldesigner/designercore/include/itemlibraryinfo.h @@ -29,6 +29,7 @@ #include "propertycontainer.h" #include +#include namespace QmlDesigner { @@ -88,7 +89,7 @@ public: void addHints(const QHash &hints); private: - QExplicitlySharedDataPointer m_data; + QSharedDataPointer m_data; }; class QMLDESIGNERCORE_EXPORT ItemLibraryInfo : public QObject From 1cea268c9298ffd9477ab00f6507613286de8c59 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 24 Apr 2020 15:10:53 +0200 Subject: [PATCH 13/23] QmlJSEditor: Fix semantic highlighting Do not send empty ranges as they may mess up the highlighting of the file. Fixes: QTCREATORBUG-23729 Change-Id: I77adcccb3a3da890e87f0b2860b945819446a3a8 Reviewed-by: Ulf Hermann --- src/plugins/qmljseditor/qmljssemantichighlighter.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp index 65e9b0ca2e5..b9ef9dc7469 100644 --- a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp +++ b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp @@ -269,8 +269,11 @@ protected: } } - if (type != SemanticHighlighter::UnknownType) - addUse(location, type); + if (type != SemanticHighlighter::UnknownType) { + // do not add uses of length 0 - this messes up highlighting (e.g. anon functions) + if (location.length != 0) + addUse(location, type); + } } void processTypeId(UiQualifiedId *typeId) From cef36248ee5dc05cfdee3a2ec239f9a44e828f03 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 27 Apr 2020 15:25:37 +0200 Subject: [PATCH 14/23] QmlDesigner: Fix crash Since we call updateItemSelection via a timer, there is no guarantee a model is attached. Task-number: QDS-1939 Change-Id: I37bf40cf3d6a057a8bc695d0d0ec73b6cf17fdb5 Reviewed-by: Miikka Heikkinen --- src/plugins/qmldesigner/components/navigator/navigatorview.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp index 86404e0ea0a..ea64f0715a7 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp @@ -410,6 +410,9 @@ void NavigatorView::selectedNodesChanged(const QList &/*selectedNodeL void NavigatorView::updateItemSelection() { + if (!isAttached()) + return; + QItemSelection itemSelection; foreach (const ModelNode &node, selectedModelNodes()) { const QModelIndex index = indexForModelNode(node); From 0a240be6bf66fc517b5e39e4deb9dbb42a1b2f65 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 27 Apr 2020 15:26:22 +0200 Subject: [PATCH 15/23] QmlDesigner: Fix SelectionContext::hasSingleSelectedModelNode This one should use AbstractView::asSingleSelectedModelNode. Change-Id: I6bddd62866d50cbda087924bf55446b6cd087085 Reviewed-by: Tim Jenssen --- .../qmldesigner/components/componentcore/selectioncontext.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/componentcore/selectioncontext.cpp b/src/plugins/qmldesigner/components/componentcore/selectioncontext.cpp index 7dba86920d6..59a9454b095 100644 --- a/src/plugins/qmldesigner/components/componentcore/selectioncontext.cpp +++ b/src/plugins/qmldesigner/components/componentcore/selectioncontext.cpp @@ -78,7 +78,8 @@ QList SelectionContext::selectedModelNodes() const bool SelectionContext::hasSingleSelectedModelNode() const { - return view()->hasSelectedModelNodes(); + return view()->hasSingleSelectedModelNode() + && firstSelectedModelNode().isValid(); } AbstractView *SelectionContext::view() const From 106e0430ed674bc50bb500ce35fb87b551c567dd Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 28 Apr 2020 08:11:07 +0200 Subject: [PATCH 16/23] Bump version Change-Id: Ieb662d20d5bba2e410039bcdeb2459129601187a 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 7550b928634..1e10d7f0016 100644 --- a/cmake/QtCreatorIDEBranding.cmake +++ b/cmake/QtCreatorIDEBranding.cmake @@ -1,9 +1,9 @@ #BINARY_ARTIFACTS_BRANCH = master #PROJECT_USER_FILE_EXTENSION = .user -set(IDE_VERSION "4.12.0") # The IDE version. +set(IDE_VERSION "4.12.1") # The IDE version. set(IDE_VERSION_COMPAT "4.12.0") # The IDE Compatibility version. -set(IDE_VERSION_DISPLAY "4.12.0") # The IDE display version. +set(IDE_VERSION_DISPLAY "4.12.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 584a211d3a1..aa30add4a81 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.12.0' + property string qtcreator_display_version: '4.12.1' property string ide_version_major: '4' property string ide_version_minor: '12' - 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 19b31502f38..f9031c5982d 100644 --- a/qtcreator_ide_branding.pri +++ b/qtcreator_ide_branding.pri @@ -1,6 +1,6 @@ -QTCREATOR_VERSION = 4.12.0 +QTCREATOR_VERSION = 4.12.1 QTCREATOR_COMPAT_VERSION = 4.12.0 -QTCREATOR_DISPLAY_VERSION = 4.12.0 +QTCREATOR_DISPLAY_VERSION = 4.12.1 QTCREATOR_COPYRIGHT_YEAR = 2020 BINARY_ARTIFACTS_BRANCH = 4.12 From 5dfdeec3897a30572e3b23dc9c6f0ddb3fc35cfa Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Mon, 27 Apr 2020 23:24:53 +0200 Subject: [PATCH 17/23] CMake: build fix for unittests Change-Id: I1ead13e7b764a346ac49004ead2bf9ab6362ffb5 Reviewed-by: Eike Ziller --- src/libs/sqlite/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/sqlite/CMakeLists.txt b/src/libs/sqlite/CMakeLists.txt index d28195f7684..36737ca1a28 100644 --- a/src/libs/sqlite/CMakeLists.txt +++ b/src/libs/sqlite/CMakeLists.txt @@ -4,9 +4,9 @@ add_qtc_library(Sqlite SQLITE_ENABLE_UNLOCK_NOTIFY SQLITE_ENABLE_COLUMN_METADATA BUILD_SQLITE_LIBRARY DEPENDS Qt5::Core Threads::Threads ${CMAKE_DL_LIBS} - INCLUDES ../3rdparty/sqlite PUBLIC_INCLUDES "${CMAKE_CURRENT_LIST_DIR}" + ../3rdparty/sqlite SOURCES ../3rdparty/sqlite/sqlite3.c createtablesqlstatementbuilder.cpp createtablesqlstatementbuilder.h From 7982c440d5e74d9edf762d5ace0d0b9d3fb6623a Mon Sep 17 00:00:00 2001 From: Jeremy Ephron Date: Sun, 26 Apr 2020 13:54:50 -0700 Subject: [PATCH 18/23] Debugger: Fix STL map size bug on Windows Fixed a bug in obtaining the size of STL map with MinGW 32/64. Retrieved the size directly rather than unpacking the size from the data (which is not present in on Windows). Tested for compatibility with LLVM/LLDB on macOS. Change-Id: I4d836d6288465e82d694de0405965586683c1355 Reviewed-by: hjk --- share/qtcreator/debugger/stdtypes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/qtcreator/debugger/stdtypes.py b/share/qtcreator/debugger/stdtypes.py index b08b9d603de..9d5cd0029ac 100644 --- a/share/qtcreator/debugger/stdtypes.py +++ b/share/qtcreator/debugger/stdtypes.py @@ -283,7 +283,8 @@ def qdump__std__map(d, value): return # stuff is actually (color, pad) with 'I@', but we can save cycles/ - (compare, stuff, parent, left, right, size) = value.split('pppppp') + (compare, stuff, parent, left, right) = value.split('ppppp') + size = value["_M_t"]["_M_impl"]["_M_node_count"].integer() d.check(0 <= size and size <= 100 * 1000 * 1000) d.putItemCount(size) From fc94174bf74bb9a6a51df4bc75443cffd6b27d23 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 27 Apr 2020 10:10:25 +0200 Subject: [PATCH 19/23] CMake build: Fix copying & installation of resources - just copy & install whole directories, like the qmake build (basically) - copy & install scripts/ only on macOS - do not copy or install welcomescreen/ which is no longer used Fixes: QTCREATORBUG-23907 Fixes: QTCREATORBUG-23909 Fixes: QTCREATORBUG-23911 Change-Id: I0f9016848d15b214c40f454f39c5560d1faa4f32 Reviewed-by: Cristian Adam --- share/qtcreator/CMakeLists.txt | 35 +++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/share/qtcreator/CMakeLists.txt b/share/qtcreator/CMakeLists.txt index 05f64cc2f15..303fb9c7d0b 100644 --- a/share/qtcreator/CMakeLists.txt +++ b/share/qtcreator/CMakeLists.txt @@ -1,25 +1,42 @@ -set(template_directories android cplusplus debugger glsl modeleditor qml qmldesigner - qmlicons qml-type-descriptions schemes scripts snippets styles templates themes welcomescreen) +set(resource_directories + android + cplusplus + debugger + glsl + indexer_preincludes + modeleditor + qml + qmldesigner + qmlicons + qml-type-descriptions + schemes + snippets + styles + templates + themes +) + +if (APPLE) + set(resource_directories ${resource_directories} scripts) +endif() add_custom_target(copy_share_to_builddir ALL COMMENT Copy files into build directory VERBATIM ) -foreach(dir IN ITEMS ${template_directories}) +# copy resource directories during build +foreach(dir IN ITEMS ${resource_directories}) add_custom_command(TARGET copy_share_to_builddir POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_directory "${dir}" "${PROJECT_BINARY_DIR}/${IDE_DATA_PATH}/${dir}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - COMMENT Copy files into build directory + COMMENT Copy resource directories into build directory VERBATIM ) endforeach() -install(DIRECTORY ${template_directories} DESTINATION "${IDE_DATA_PATH}") -install( - FILES indexer_preincludes/qglobal.h indexer_preincludes/windows.h - DESTINATION "${IDE_DATA_PATH}/indexer_preincludes" -) +# create install rule for resource directories +install(DIRECTORY ${resource_directories} DESTINATION "${IDE_DATA_PATH}") add_subdirectory(translations) From 185f03cb339dc7b88f5808e95b4297f4bd4882f2 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 23 Apr 2020 23:30:40 +0200 Subject: [PATCH 20/23] McuSupport: Identify existing Kits for MCU Targets via meta data ... instead of just by kit name. Although the Kit name is quite verbose, it is missing some of the information needed to realiably identify Kits for MCU Targets. Use the Kit meta data for that, instead. This adds the color depth to the kit meta data. Change-Id: I39bc9a681a423a4309290b0f47298dbcb83b2e54 Reviewed-by: Eike Ziller --- src/plugins/mcusupport/mcusupportconstants.h | 2 ++ src/plugins/mcusupport/mcusupportoptions.cpp | 29 +++++++++++++------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/plugins/mcusupport/mcusupportconstants.h b/src/plugins/mcusupport/mcusupportconstants.h index 17fd68f181f..30d28f44df4 100644 --- a/src/plugins/mcusupport/mcusupportconstants.h +++ b/src/plugins/mcusupport/mcusupportconstants.h @@ -32,10 +32,12 @@ const char DEVICE_TYPE[] = "McuSupport.DeviceType"; const char DEVICE_ID[] = "McuSupport.Device"; const char RUNCONFIGURATION[] = "McuSupport.RunConfiguration"; const char SETTINGS_ID[] = "CC.McuSupport.Configuration"; + const char KIT_MCUTARGET_VENDOR_KEY[] = "McuSupport.McuTargetVendor"; const char KIT_MCUTARGET_MODEL_KEY[] = "McuSupport.McuTargetModel"; const char KIT_MCUTARGET_SDKVERSION_KEY[] = "McuSupport.McuTargetSdkVersion"; const char KIT_MCUTARGET_KITVERSION_KEY[] = "McuSupport.McuTargetKitVersion"; +const char KIT_MCUTARGET_COLORDEPTH_KEY[] = "McuSupport.McuTargetColorDepth"; const char SETTINGS_GROUP[] = "McuSupport"; const char SETTINGS_KEY_PACKAGE_PREFIX[] = "Package_"; diff --git a/src/plugins/mcusupport/mcusupportoptions.cpp b/src/plugins/mcusupport/mcusupportoptions.cpp index 15936c316ff..d9aac20374a 100644 --- a/src/plugins/mcusupport/mcusupportoptions.cpp +++ b/src/plugins/mcusupport/mcusupportoptions.cpp @@ -61,7 +61,7 @@ namespace McuSupport { namespace Internal { -static const int KIT_VERSION = 1; // Bumps up whenever details in Kit creation change +static const int KIT_VERSION = 2; // Bumps up whenever details in Kit creation change static QString packagePathFromSettings(const QString &settingsKey, const QString &defaultPath = {}) { @@ -469,17 +469,18 @@ static void setKitProperties(const QString &kitName, ProjectExplorer::Kit *k, const McuTarget* mcuTarget) { using namespace ProjectExplorer; + using namespace Constants; k->setUnexpandedDisplayName(kitName); - k->setValue(Constants::KIT_MCUTARGET_VENDOR_KEY, mcuTarget->vendor()); - k->setValue(Constants::KIT_MCUTARGET_MODEL_KEY, mcuTarget->qulPlatform()); - k->setValue(Constants::KIT_MCUTARGET_SDKVERSION_KEY, - McuSupportOptions::supportedQulVersion().toString()); - k->setValue(Constants::KIT_MCUTARGET_KITVERSION_KEY, KIT_VERSION); + k->setValue(KIT_MCUTARGET_VENDOR_KEY, mcuTarget->vendor()); + k->setValue(KIT_MCUTARGET_MODEL_KEY, mcuTarget->qulPlatform()); + k->setValue(KIT_MCUTARGET_COLORDEPTH_KEY, mcuTarget->colorDepth()); + k->setValue(KIT_MCUTARGET_SDKVERSION_KEY, McuSupportOptions::supportedQulVersion().toString()); + k->setValue(KIT_MCUTARGET_KITVERSION_KEY, KIT_VERSION); k->setAutoDetected(true); k->makeSticky(); if (mcuTarget->toolChainPackage()->type() == McuToolChainPackage::TypeDesktop) - k->setDeviceTypeForIcon(Constants::DEVICE_TYPE); + k->setDeviceTypeForIcon(DEVICE_TYPE); QSet irrelevant = { SysRootKitAspect::id(), QtSupport::QtKitAspect::id() @@ -609,9 +610,17 @@ QString McuSupportOptions::kitName(const McuTarget *mcuTarget) QList McuSupportOptions::existingKits(const McuTarget *mcuTarget) { using namespace ProjectExplorer; - const QString mcuTargetKitName = kitName(mcuTarget); - return Utils::filtered(KitManager::kits(), [&mcuTargetKitName](Kit *kit) { - return kit->isAutoDetected() && kit->unexpandedDisplayName() == mcuTargetKitName; + using namespace Constants; + return Utils::filtered(KitManager::kits(), [mcuTarget](Kit *kit) { + return kit->isAutoDetected() + && kit->value(KIT_MCUTARGET_KITVERSION_KEY) == KIT_VERSION + && kit->value(KIT_MCUTARGET_SDKVERSION_KEY) == + McuSupportOptions::supportedQulVersion().toString() + && (!mcuTarget || ( + kit->value(KIT_MCUTARGET_VENDOR_KEY) == mcuTarget->vendor() + && kit->value(KIT_MCUTARGET_MODEL_KEY) == mcuTarget->qulPlatform() + && kit->value(KIT_MCUTARGET_COLORDEPTH_KEY) == mcuTarget->colorDepth() + )); }); } From 1352ec636fba5bb59e824c917eb023fe9a03d591 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 28 Apr 2020 09:17:06 +0200 Subject: [PATCH 21/23] Debugger: Simplify 'long long int' to 'long long' in display This also fixes the StdMap test case with LLDB 9.0.0 Change-Id: I0e4580b7e64d62664a81fd75a5e142717bf3563a Reviewed-by: Christian Stenger --- src/plugins/debugger/simplifytype.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/debugger/simplifytype.cpp b/src/plugins/debugger/simplifytype.cpp index f8bea299f61..202756a3edb 100644 --- a/src/plugins/debugger/simplifytype.cpp +++ b/src/plugins/debugger/simplifytype.cpp @@ -118,6 +118,7 @@ QString simplifyType(const QString &typeIn) type.remove(0, 7); type.replace("short int", "short"); + type.replace("long long int", "long long"); const bool isLibCpp = type.contains("std::__1"); type.replace("std::__cxx11::", "std::"); From 794f3a5f55e09c0cb3ecd43833f58d11b9fbc263 Mon Sep 17 00:00:00 2001 From: Leander Schulten Date: Wed, 18 Mar 2020 09:19:09 +0100 Subject: [PATCH 22/23] DoxygenGenerator: Ignore attributes in declarations Otherwise the doxygen generation will not work. Change-Id: I07889d84c179ec0ad931d9790f9270ebbd6d259d Reviewed-by: Christian Stenger --- src/plugins/cpptools/doxygengenerator.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plugins/cpptools/doxygengenerator.cpp b/src/plugins/cpptools/doxygengenerator.cpp index 702f92e5247..398a31a8764 100644 --- a/src/plugins/cpptools/doxygengenerator.cpp +++ b/src/plugins/cpptools/doxygengenerator.cpp @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -81,7 +82,7 @@ QString DoxygenGenerator::generate(QTextCursor cursor, const QTextCursor initialCursor = cursor; const QChar &c = cursor.document()->characterAt(cursor.position()); - if (!c.isLetter() && c != QLatin1Char('_')) + if (!c.isLetter() && c != QLatin1Char('_') && c != QLatin1Char('[')) return QString(); // Try to find what would be the declaration we are interested in. @@ -109,8 +110,12 @@ QString DoxygenGenerator::generate(QTextCursor cursor, QString declCandidate = cursor.selectedText(); - if (declCandidate.startsWith(QLatin1String("Q_INVOKABLE"))) - declCandidate = declCandidate.mid(11); + // remove attributes like [[nodiscard]] because + // Document::Ptr::parse(Document::ParseDeclaration) fails on attributes + static QRegularExpression attribute("\\[\\s*\\[.*\\]\\s*\\]"); + declCandidate.replace(attribute, ""); + + declCandidate.replace("Q_INVOKABLE", ""); declCandidate.replace(QChar::ParagraphSeparator, QLatin1Char('\n')); From 05f746cfd029c0232bb5880c50d0b0d7d17f0cc5 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 19 Feb 2020 17:01:41 +0100 Subject: [PATCH 23/23] Add script for building external plugins for packaging Also turn off PCH for building Qt Creator and add some more options for local testing. Change-Id: Ic05099ef1dd8e8c78b174d7cd07a83b2f4a9cbb5 Reviewed-by: Eike Ziller --- scripts/build.py | 45 +++++++------- scripts/build_plugin.py | 130 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+), 20 deletions(-) create mode 100755 scripts/build_plugin.py diff --git a/scripts/build.py b/scripts/build.py index 3c481362395..a58a688dcac 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -83,6 +83,10 @@ def get_arguments(): action='store_true', default=(not common.is_windows_platform())) parser.add_argument('--no-docs', help='Skip documentation generation', action='store_true', default=False) + parser.add_argument('--no-dmg', help='Skip disk image creation (macOS)', + action='store_true', default=False) + parser.add_argument('--no-zip', help='Skip creation of 7zip files for install and developer package', + action='store_true', default=False) return parser.parse_args() def build_qtcreator(args, paths): @@ -124,8 +128,7 @@ def build_qtcreator(args, paths): '-DPYTHON_INCLUDE_DIR=' + os.path.join(args.python_path, 'include')] # TODO this works around a CMake bug https://gitlab.kitware.com/cmake/cmake/issues/20119 - if common.is_linux_platform(): - cmake_args += ['-DBUILD_WITH_PCH=OFF'] + cmake_args += ['-DBUILD_WITH_PCH=OFF'] ide_revision = common.get_commit_SHA(paths.src) if ide_revision: @@ -191,30 +194,32 @@ def deploy_qt(args, paths): paths.build) def package_qtcreator(args, paths): - common.check_print_call(['7z', 'a', '-mmt2', os.path.join(paths.result, 'qtcreator.7z'), '*'], - paths.install) - common.check_print_call(['7z', 'a', '-mmt2', - os.path.join(paths.result, 'qtcreator_dev.7z'), '*'], - paths.dev_install) - if common.is_windows_platform(): + if not args.no_zip: + common.check_print_call(['7z', 'a', '-mmt2', os.path.join(paths.result, 'qtcreator.7z'), '*'], + paths.install) common.check_print_call(['7z', 'a', '-mmt2', - os.path.join(paths.result, 'wininterrupt.7z'), '*'], - paths.wininterrupt_install) - if not args.no_cdb: + os.path.join(paths.result, 'qtcreator_dev.7z'), '*'], + paths.dev_install) + if common.is_windows_platform(): common.check_print_call(['7z', 'a', '-mmt2', - os.path.join(paths.result, 'qtcreatorcdbext.7z'), '*'], - paths.qtcreatorcdbext_install) + os.path.join(paths.result, 'wininterrupt.7z'), '*'], + paths.wininterrupt_install) + if not args.no_cdb: + common.check_print_call(['7z', 'a', '-mmt2', + os.path.join(paths.result, 'qtcreatorcdbext.7z'), '*'], + paths.qtcreatorcdbext_install) if common.is_mac_platform(): if args.keychain_unlock_script: common.check_print_call([args.keychain_unlock_script], paths.install) - common.check_print_call(['python', '-u', - os.path.join(paths.src, 'scripts', 'makedmg.py'), - 'qt-creator.dmg', - 'Qt Creator', - paths.src, - paths.install], - paths.result) + if not args.no_dmg: + common.check_print_call(['python', '-u', + os.path.join(paths.src, 'scripts', 'makedmg.py'), + 'qt-creator.dmg', + 'Qt Creator', + paths.src, + paths.install], + paths.result) def get_paths(args): Paths = collections.namedtuple('Paths', diff --git a/scripts/build_plugin.py b/scripts/build_plugin.py new file mode 100755 index 00000000000..45c16765d3d --- /dev/null +++ b/scripts/build_plugin.py @@ -0,0 +1,130 @@ +#!/usr/bin/env python +############################################################################# +## +## Copyright (C) 2020 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the release tools of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +# import the print function which is used in python 3.x +from __future__ import print_function + +import argparse +import collections +import os + +import common + +def get_arguments(): + parser = argparse.ArgumentParser(description='Build Qt Creator for packaging') + parser.add_argument('--name', help='Name to use for build results', required=True) + parser.add_argument('--src', help='Path to sources', required=True) + parser.add_argument('--build', help='Path that should be used for building', required=True) + parser.add_argument('--qt-path', help='Path to Qt', required=True) + parser.add_argument('--qtc-path', + help='Path to Qt Creator installation including development package', + required=True) + parser.add_argument('--output-path', help='Output path for resulting 7zip files') + parser.add_argument('--add-path', help='Adds a CMAKE_PREFIX_PATH to the build', + action='append', dest='prefix_paths', default=[]) + parser.add_argument('--deploy', help='Installs the "Dependencies" component of the plugin.', + action='store_true', default=False) + parser.add_argument('--debug', help='Enable debug builds', action='store_true', default=False) + return parser.parse_args() + +def build(args, paths): + if not os.path.exists(paths.build): + os.makedirs(paths.build) + if not os.path.exists(paths.result): + os.makedirs(paths.result) + prefix_paths = [paths.qt, paths.qt_creator] + [os.path.abspath(fp) for fp in args.prefix_paths] + build_type = 'Debug' if args.debug else 'Release' + cmake_args = ['cmake', + '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths), + '-DCMAKE_BUILD_TYPE=' + build_type, + '-DCMAKE_INSTALL_PREFIX=' + paths.install, + '-G', 'Ninja'] + + # force MSVC on Windows, because it looks for GCC in the PATH first, + # even if MSVC is first mentioned in the PATH... + # TODO would be nicer if we only did this if cl.exe is indeed first in the PATH + if common.is_windows_platform(): + cmake_args += ['-DCMAKE_C_COMPILER=cl', + '-DCMAKE_CXX_COMPILER=cl'] + + # TODO this works around a CMake bug https://gitlab.kitware.com/cmake/cmake/issues/20119 + cmake_args += ['-DBUILD_WITH_PCH=OFF'] + + ide_revision = common.get_commit_SHA(paths.src) + if ide_revision: + cmake_args += ['-DQTC_PLUGIN_REVISION=' + ide_revision] + with open(os.path.join(paths.result, args.name + '.7z.git_sha'), 'w') as f: + f.write(ide_revision) + + common.check_print_call(cmake_args + [paths.src], paths.build) + common.check_print_call(['cmake', '--build', '.'], paths.build) + common.check_print_call(['cmake', '--install', '.', '--prefix', paths.install, '--strip'], + paths.build) + if args.deploy: + common.check_print_call(['cmake', '--install', '.', '--prefix', paths.install, + '--component', 'Dependencies'], + paths.build) + common.check_print_call(['cmake', '--install', '.', '--prefix', paths.dev_install, + '--component', 'Devel'], + paths.build) + +def package(args, paths): + if not os.path.exists(paths.result): + os.makedirs(paths.result) + common.check_print_call(['7z', 'a', '-mmt2', os.path.join(paths.result, args.name + '.7z'), '*'], + paths.install) + if os.path.exists(paths.dev_install): # some plugins might not provide anything in Devel + common.check_print_call(['7z', 'a', '-mmt2', + os.path.join(paths.result, args.name + '_dev.7z'), '*'], + paths.dev_install) + +def get_paths(args): + Paths = collections.namedtuple('Paths', + ['qt', 'src', 'build', 'qt_creator', + 'install', 'dev_install', 'result']) + build_path = os.path.abspath(args.build) + install_path = os.path.join(build_path, 'install') + result_path = os.path.abspath(args.output_path) if args.output_path else build_path + return Paths(qt=os.path.abspath(args.qt_path), + src=os.path.abspath(args.src), + build=os.path.join(build_path, 'build'), + qt_creator=os.path.abspath(args.qtc_path), + install=os.path.join(install_path, args.name), + dev_install=os.path.join(install_path, args.name + '-dev'), + result=result_path) + +def main(): + args = get_arguments() + paths = get_paths(args) + + build(args, paths) + package(args, paths) + +if __name__ == '__main__': + main()