diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index e89274a061a..ed3602e6d6d 100644 --- a/cmake/QtCreatorAPI.cmake +++ b/cmake/QtCreatorAPI.cmake @@ -602,7 +602,7 @@ function(extend_qtc_test target_name) endfunction() function(add_qtc_executable name) - cmake_parse_arguments(_arg "SKIP_INSTALL;SKIP_TRANSLATION;ALLOW_ASCII_CASTS;SKIP_PCH" + cmake_parse_arguments(_arg "SKIP_INSTALL;SKIP_TRANSLATION;ALLOW_ASCII_CASTS;SKIP_PCH;QTC_RUNNABLE" "DESTINATION;COMPONENT;BUILD_DEFAULT" "CONDITION;DEPENDS;DEFINES;INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;EXTRA_TRANSLATIONS;PROPERTIES" ${ARGN}) @@ -707,6 +707,11 @@ function(add_qtc_executable name) enable_pch(${name}) endif() + if (_arg_QTC_RUNNABLE) + # Used by QtCreator to select the default target in the project + set_target_properties(${name} PROPERTIES FOLDER "qtc_runnable") + endif() + if (NOT _arg_SKIP_INSTALL) unset(COMPONENT_OPTION) if (_arg_COMPONENT) diff --git a/doc/qtcreator/images/qtcreator-bookmarks-view.png b/doc/qtcreator/images/qtcreator-bookmarks-view.png index d8734cfe614..70c3bc2fe3d 100644 Binary files a/doc/qtcreator/images/qtcreator-bookmarks-view.png and b/doc/qtcreator/images/qtcreator-bookmarks-view.png differ diff --git a/doc/qtcreator/images/qtcreator-cmakeexecutable.png b/doc/qtcreator/images/qtcreator-cmakeexecutable.png index 31f162d48b1..7f49186f271 100755 Binary files a/doc/qtcreator/images/qtcreator-cmakeexecutable.png and b/doc/qtcreator/images/qtcreator-cmakeexecutable.png differ diff --git a/doc/qtcreator/images/qtcreator-locator-bookmark-filtering.png b/doc/qtcreator/images/qtcreator-locator-bookmark-filtering.png index 9d19994a5f9..4b7ea3be119 100644 Binary files a/doc/qtcreator/images/qtcreator-locator-bookmark-filtering.png and b/doc/qtcreator/images/qtcreator-locator-bookmark-filtering.png differ diff --git a/doc/qtcreator/images/qtcreator-togglebookmark.png b/doc/qtcreator/images/qtcreator-togglebookmark.png index a09e9ebfd89..63db3e2bb52 100644 Binary files a/doc/qtcreator/images/qtcreator-togglebookmark.png and b/doc/qtcreator/images/qtcreator-togglebookmark.png differ diff --git a/doc/qtcreator/src/cmake/creator-projects-cmake.qdoc b/doc/qtcreator/src/cmake/creator-projects-cmake.qdoc index 572180a1d6a..da691f6f03a 100644 --- a/doc/qtcreator/src/cmake/creator-projects-cmake.qdoc +++ b/doc/qtcreator/src/cmake/creator-projects-cmake.qdoc @@ -92,11 +92,6 @@ to automatically run CMake every time when you save changes to \c {CMakeLists.txt} files. - \li Select the \uicontrol {Auto-create build directories} check box to - initially configure the project in a temporary directory. When you - build the project \QC starts from scratch and configures the - project again using the build directory. - \li Select \uicontrol Apply to save your changes. \endlist diff --git a/doc/qtcreator/src/editors/creator-coding-edit-mode.qdoc b/doc/qtcreator/src/editors/creator-coding-edit-mode.qdoc index 449eba8a259..c7e25fbcd78 100644 --- a/doc/qtcreator/src/editors/creator-coding-edit-mode.qdoc +++ b/doc/qtcreator/src/editors/creator-coding-edit-mode.qdoc @@ -201,9 +201,22 @@ \image qtcreator-togglebookmark.png - To add a note to a bookmark, right-click the bookmark and select - \uicontrol {Edit Bookmark}. To view the note, move the mouse pointer over - the bookmark. + \section2 Adding Notes to Bookmarks + + To add a note to a bookmark: + + \list + \li Select \uicontrol Tools > \uicontrol Bookmarks > + \uicontrol {Edit Bookmark}. + \li Press \key {Ctrl+Shift+M}. + \li Right-click a bookmark and select \uicontrol {Edit Bookmark} + in the context menu. + \endlist + + To view the note, move the mouse pointer over the bookmark or open the + \uicontrol Bookmarks view in the \l{Working with Sidebars}{sidebar}. + + \section2 Navigating Bookmarks To go to the previous bookmark in the current session, select \uicontrol Tools > \uicontrol Bookmarks > \uicontrol {Previous Bookmark} @@ -221,6 +234,8 @@ \image qtcreator-locator-bookmark-filtering.png "Filtering bookmarks in locator" + \section2 Viewing Bookmarks + Bookmarks are listed in the \uicontrol Bookmarks view in the sidebar. To move between bookmarks, select the \uicontrol {Previous Bookmark} or \uicontrol {Next Bookmark} button or use the keyboard shortcuts. diff --git a/doc/qtcreator/src/qtquick/qtquick-library.qdoc b/doc/qtcreator/src/qtquick/qtquick-library.qdoc index 331ea4eb22e..8dc9c3c44a7 100644 --- a/doc/qtcreator/src/qtquick/qtquick-library.qdoc +++ b/doc/qtcreator/src/qtquick/qtquick-library.qdoc @@ -114,7 +114,11 @@ \uicontrol Library > \uicontrol {Assets} displays the images and other files that you add to the project folder by selecting \inlineimage plus.png - . + . To add assets to your UI, drag-and-drop them to \l Navigator or + \l {Form Editor}. + + To add multiple assets to your UI simultaneously, multiselect them first by + holding \key Ctrl and clicking the asset files you wish to select. \image qtquick-assets-tab.png "Library view Assets tab" diff --git a/scripts/deployqtHelper_mac.sh b/scripts/deployqtHelper_mac.sh index a079cb84254..867fa5c6988 100755 --- a/scripts/deployqtHelper_mac.sh +++ b/scripts/deployqtHelper_mac.sh @@ -136,8 +136,6 @@ if [ $LLVM_INSTALL_DIR ]; then install_name_tool -add_rpath "@executable_path/../lib" "$libexec_path/clang/bin/clazy-standalone" || exit 1 fi clangbackendArgument="-executable=$libexec_path/clangbackend" - clangpchmanagerArgument="-executable=$libexec_path/clangpchmanagerbackend" - clangrefactoringArgument="-executable=$libexec_path/clangrefactoringbackend" fi #### macdeployqt @@ -173,6 +171,6 @@ if [ ! -d "$app_path/Contents/Frameworks/QtCore.framework" ]; then "-executable=$libexec_path/cpaster" \ "${qbsArguments[@]}" \ "$qml2puppetArgument" \ - "$clangbackendArgument" "$clangpchmanagerArgument" "$clangrefactoringArgument" || exit 1 + "$clangbackendArgument" || exit 1 fi diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 7888752a239..20c674d0455 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -1358,6 +1358,7 @@ class Dumper(DumperBase): def report(self, stuff): with self.outputLock: sys.stdout.write("@\n" + stuff + "@\n") + sys.stdout.flush() def reportState(self, state): self.report('state="%s"' % state) @@ -1588,6 +1589,7 @@ class Dumper(DumperBase): 'output = d.hexencode(sys.stdout.getvalue())', 'sys.stdout = origout', 'd.report("output={channel=\"stderr\",data=\" + output + \"}")', + 'sys.stdout.flush()', 'if result is False:', ' d.reportState("continueafternextstop")', 'return True' diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationSection.qml index 14fc80c971a..cdbf07307d3 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationSection.qml @@ -91,7 +91,14 @@ Section { StudioControls.InfinityLoopIndicator { id: infinityLoopIndicator - infinite: backendValues.loops.value === -1 ? true : false + property var valueFromBackend: backendValues.loops.value + + onValueFromBackendChanged: { + if (valueFromBackend === -1) + infinityLoopIndicator.infinite = true + else + infinityLoopIndicator.infinite = false + } onInfiniteChanged: { if (infinityLoopIndicator.infinite === true) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/ComboBoxSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/ComboBoxSpecifics.qml index 12c183560ac..debeeeaecf1 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/ComboBoxSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/ComboBoxSpecifics.qml @@ -81,7 +81,7 @@ Column { } PropertyLabel { - text: qsTr("Current") + text: qsTr("Current index") tooltip: qsTr("The index of the current item.") } @@ -90,8 +90,8 @@ Column { implicitWidth: StudioTheme.Values.twoControlColumnWidth + StudioTheme.Values.actionIndicatorWidth width: implicitWidth - maximumValue: 9999999 minimumValue: -9999999 + maximumValue: 9999999 decimals: 0 backendValue: backendValues.currentIndex } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/ItemDelegateSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/ItemDelegateSection.qml index 2ad12fd7de1..ffe81ef7fa4 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/ItemDelegateSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/ItemDelegateSection.qml @@ -49,7 +49,7 @@ Section { SectionLayout { PropertyLabel { - text: qsTr("Highlighted") + text: qsTr("Highlight") tooltip: qsTr("Whether the delegate is highlighted.") } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/PageIndicatorSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/PageIndicatorSpecifics.qml new file mode 100644 index 00000000000..426e35b78f9 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/PageIndicatorSpecifics.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.15 +import QtQuick.Layouts 1.15 +import HelperWidgets 2.0 +import StudioTheme 1.0 as StudioTheme + +Column { + width: parent.width + + Section { + width: parent.width + caption: qsTr("PageIndicator") + + SectionLayout { + PropertyLabel { + text: qsTr("Count") + tooltip: qsTr("The number of pages.") + } + + SecondColumnLayout { + SpinBox { + implicitWidth: StudioTheme.Values.twoControlColumnWidth + + StudioTheme.Values.actionIndicatorWidth + width: implicitWidth + minimumValue: -9999999 + maximumValue: 9999999 + decimals: 0 + backendValue: backendValues.count + } + + ExpandingSpacer {} + } + + PropertyLabel { + text: qsTr("Current") + tooltip: qsTr("The index of the current page.") + } + + SecondColumnLayout { + SpinBox { + implicitWidth: StudioTheme.Values.twoControlColumnWidth + + StudioTheme.Values.actionIndicatorWidth + width: implicitWidth + minimumValue: -9999999 + maximumValue: 9999999 + decimals: 0 + backendValue: backendValues.currentIndex + } + + ExpandingSpacer {} + } + + PropertyLabel { + text: qsTr("Interactive") + tooltip: qsTr("Whether the control is interactive.") + } + + SecondColumnLayout { + CheckBox { + implicitWidth: StudioTheme.Values.twoControlColumnWidth + + StudioTheme.Values.actionIndicatorWidth + text: backendValues.interactive.valueToString + backendValue: backendValues.interactive + } + + ExpandingSpacer {} + } + } + } + + ControlSection {} + + PaddingSection {} +} diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RectangleSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RectangleSpecifics.qml index 2c0bfd95be1..29697376016 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RectangleSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RectangleSpecifics.qml @@ -38,7 +38,7 @@ Column { caption: qsTr("Rectangle") SectionLayout { - PropertyLabel { text: qsTr("Color") } + PropertyLabel { text: qsTr("Fill color") } ColorEditor { backendValue: backendValues.color @@ -57,7 +57,7 @@ Column { } PropertyLabel { - text: qsTr("Border") + text: qsTr("Border width") disabledState: !backendValues.border_width.isAvailable } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextEditSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextEditSpecifics.qml index 4f0d59c4cb5..c73bff2a3b0 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextEditSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextEditSpecifics.qml @@ -47,7 +47,5 @@ Column { showStyle: false } - PaddingSection { - visible: minorQtQuickVersion > 5 - } + PaddingSection {} } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml index 2061081b1f6..18d0c00b326 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml @@ -48,7 +48,5 @@ Column { showStyle: false } - PaddingSection { - visible: minorQtQuickVersion > 5 - } + PaddingSection {} } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextSpecifics.qml index 991b9f8ec4f..2bfe4dc71e5 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextSpecifics.qml @@ -49,7 +49,5 @@ Column { showStyle: true } - PaddingSection { - visible: minorQtQuickVersion > 5 - } + PaddingSection {} } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Button.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Button.qml index 5326edd615a..45ee8e65724 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Button.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Button.qml @@ -80,8 +80,8 @@ T.AbstractButton { when: myButton.hovered && myButton.pressed PropertyChanges { target: buttonBackground - color: StudioTheme.Values.themeControlBackgroundPressed - border.color: StudioTheme.Values.themeInteraction + color: StudioTheme.Values.themeControlBackgroundInteraction + border.color: StudioTheme.Values.themeControlOutlineInteraction } }, State { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/CharacterSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/CharacterSection.qml index 8fea7777345..d88d50fa1a8 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/CharacterSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/CharacterSection.qml @@ -296,7 +296,7 @@ Section { } PropertyLabel { - text: qsTr("Letter space") + text: qsTr("Letter spacing") tooltip: qsTr("Letter spacing for the font.") } @@ -316,7 +316,7 @@ Section { } PropertyLabel { - text: qsTr("Word space") + text: qsTr("Word spacing") tooltip: qsTr("Word spacing for the font.") } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/CheckBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/CheckBox.qml index b9a8055f2c7..5cdedf0dbad 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/CheckBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/CheckBox.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. @@ -23,7 +23,7 @@ ** ****************************************************************************/ -import QtQuick 2.1 +import QtQuick 2.15 import StudioControls 1.0 as StudioControls StudioControls.CheckBox { @@ -43,6 +43,7 @@ StudioControls.CheckBox { actionIndicator.forceVisible: extFuncLogic.menuVisible labelColor: colorLogic.textColor + ColorLogic { id: colorLogic backendValue: checkBox.backendValue diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml index 3a8f431df8f..89d1a35aa04 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml @@ -25,7 +25,6 @@ import QtQuick 2.15 import QtQuick.Layouts 1.15 -import QtGraphicalEffects 1.15 as Effects import QtQuick.Shapes 1.15 import QtQuick.Templates 2.15 as T import QtQuickDesignerTheme 1.0 @@ -88,7 +87,7 @@ SecondColumnLayout { gradientString += "}" - var gradientObject = Qt.createQmlObject(gradientString, gradientThumbnail, "test") + var gradientObject = Qt.createQmlObject(gradientString, gradientThumbnail, "dynamicGradient") for (i = 0; i < gradientLine.model.count; i++) { gradientObject.stops[i].color = gradientLine.model.getColor(i) @@ -123,7 +122,7 @@ SecondColumnLayout { gradientStr += "}" - var gradientObj = Qt.createQmlObject(gradientStr, shapeGradientThumbnail, "test1") + var gradientObj = Qt.createQmlObject(gradientStr, shapeGradientThumbnail, "dynamicShapeGradient") for (j = 0; j < gradientLine.model.count; j++) { gradientObj.stops[j].color = gradientLine.model.getColor(j) @@ -235,7 +234,7 @@ SecondColumnLayout { border.color: StudioTheme.Values.themeControlOutline border.width: StudioTheme.Values.border - Effects.LinearGradient { + Rectangle { id: gradientThumbnail anchors.fill: parent anchors.margins: StudioTheme.Values.border diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontExtrasSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontExtrasSection.qml index 61f209c57f4..913c86952a9 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontExtrasSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontExtrasSection.qml @@ -123,12 +123,10 @@ Section { tooltip: qsTr("Enables or disables the kerning OpenType feature when shaping the text. Disabling this may " + "improve performance when creating or changing the text, at the expense of some cosmetic features.") disabledState: !getBackendValue("kerning").isAvailable - visible: minorQtQuickVersion > 9 } SecondColumnLayout { CheckBox { - visible: minorQtQuickVersion > 9 text: backendValue.valueToString implicitWidth: StudioTheme.Values.twoControlColumnWidth + StudioTheme.Values.actionIndicatorWidth @@ -145,12 +143,10 @@ Section { "In some writing systems, such as Brahmic scripts, this is required in order for the text to be legible, whereas in " + "Latin script,\n it is merely a cosmetic feature. Setting the preferShaping property to false will disable all such features\nwhen they are not required, which will improve performance in most cases.") disabledState: !getBackendValue("preferShaping").isAvailable - visible: minorQtQuickVersion > 9 } SecondColumnLayout { CheckBox { - visible: minorQtQuickVersion > 9 text: backendValue.valueToString implicitWidth: StudioTheme.Values.twoControlColumnWidth + StudioTheme.Values.actionIndicatorWidth diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontSection.qml index a89f88989c5..8e688b84866 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontSection.qml @@ -275,7 +275,7 @@ Section { } PropertyLabel { - text: qsTr("Letter space") + text: qsTr("Letter spacing") tooltip: qsTr("Letter spacing for the font.") } @@ -295,7 +295,7 @@ Section { } PropertyLabel { - text: qsTr("Word space") + text: qsTr("Word spacing") tooltip: qsTr("Word spacing for the font.") } @@ -319,12 +319,10 @@ Section { tooltip: qsTr("Enables or disables the kerning OpenType feature when shaping the text. Disabling this may " + "improve performance when creating or changing the text, at the expense of some cosmetic features.") disabledState: !getBackendValue("kerning").isAvailable - visible: minorQtQuickVersion > 9 } SecondColumnLayout { CheckBox { - visible: minorQtQuickVersion > 9 text: backendValue.valueToString implicitWidth: StudioTheme.Values.twoControlColumnWidth + StudioTheme.Values.actionIndicatorWidth @@ -341,12 +339,10 @@ Section { "In some writing systems, such as Brahmic scripts, this is required in order for the text to be legible, whereas in " + "Latin script,\n it is merely a cosmetic feature. Setting the preferShaping property to false will disable all such features\nwhen they are not required, which will improve performance in most cases.") disabledState: !getBackendValue("preferShaping").isAvailable - visible: minorQtQuickVersion > 9 } SecondColumnLayout { CheckBox { - visible: minorQtQuickVersion > 9 text: backendValue.valueToString implicitWidth: StudioTheme.Values.twoControlColumnWidth + StudioTheme.Values.actionIndicatorWidth diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPresetTabContent.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPresetTabContent.qml index 569b168697c..94e83a905c2 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPresetTabContent.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPresetTabContent.qml @@ -145,7 +145,7 @@ Rectangle { target: backgroundCard color:StudioTheme.Values.themeInteraction border.width: StudioTheme.Values.border - border.color: StudioTheme.Values.themeControlBackgroundPressed + border.color: StudioTheme.Values.themeControlOutlineInteraction } } ] diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginControl.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginControl.qml index cc0b93660a7..7929d2a0538 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginControl.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginControl.qml @@ -52,7 +52,7 @@ Row { if (enumString === "") enumString = root.backendValue.value - root.origin = enumString + root.origin = enumString === undefined ? "Center" : enumString } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginSelector.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginSelector.qml index e5f8cd8372e..e42aff045b4 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginSelector.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OriginSelector.qml @@ -48,7 +48,7 @@ Rectangle { states: [ State { name: "default" - when: !mouseArea.containsMouse && !mouseArea.pressed && myControl.origin !== value + when: !mouseArea.containsMouse && !mouseArea.pressed && myControl.origin !== root.value PropertyChanges { target: root color: StudioTheme.Values.themeTextColorDisabled // TODO @@ -56,7 +56,7 @@ Rectangle { }, State { name: "hover" - when: mouseArea.containsMouse && !mouseArea.pressed && myControl.origin !== value + when: mouseArea.containsMouse && !mouseArea.pressed && myControl.origin !== root.value PropertyChanges { target: root color: StudioTheme.Values.themeControlBackgroundInteraction // TODO @@ -64,7 +64,7 @@ Rectangle { }, State { name: "press" - when: mouseArea.containsPress && myControl.origin !== enumValue + when: mouseArea.containsPress && myControl.origin !== root.value PropertyChanges { target: root color: StudioTheme.Values.themeControlBackgroundInteraction // TODO @@ -73,7 +73,7 @@ Rectangle { }, State { name: "active" - when: myControl.origin === value + when: myControl.origin === root.value PropertyChanges { target: root color: StudioTheme.Values.themeInteraction diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/SpinBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/SpinBox.qml index b0ffe3fe6cb..cd22b7e7f26 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/SpinBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/SpinBox.qml @@ -46,18 +46,18 @@ Item { implicitHeight: spinBox.height onFocusChanged: { - restoreCursor(); - transaction.end(); + restoreCursor() + transaction.end() } Component.onCompleted: { - spinBox.enabled = !isBlocked(backendValue.name); + spinBox.enabled = backendValue === undefined ? false : !isBlocked(backendValue.name) } Connections { target: modelNodeBackend function onSelectionChanged() { - spinBox.enabled = !isBlocked(backendValue.name); + spinBox.enabled = backendValue === undefined ? false : !isBlocked(backendValue.name) } } @@ -65,25 +65,25 @@ Item { id: spinBox onDragStarted: { - hideCursor(); - transaction.start(); + hideCursor() + transaction.start() } onDragEnded: { - restoreCursor(); - transaction.end(); + restoreCursor() + transaction.end() } - onDragging: holdCursorInPlace(); + onDragging: holdCursorInPlace() onRealValueModified: { if (transaction.active()) - commitValue(); + commitValue() } function commitValue() { if (spinBox.backendValue.value !== spinBox.realValue) - spinBox.backendValue.value = spinBox.realValue; + spinBox.backendValue.value = spinBox.realValue } property variant backendValue diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/InfinityLoopIndicator.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/InfinityLoopIndicator.qml index 9a7e7be6b08..1fc438d2f64 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/InfinityLoopIndicator.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/InfinityLoopIndicator.qml @@ -58,9 +58,7 @@ Rectangle { id: mouseArea anchors.fill: parent hoverEnabled: true - onPressed: { - infinityLoopIndicator.infinite = !infinityLoopIndicator.infinite - } + onClicked: infinityLoopIndicator.infinite = !infinityLoopIndicator.infinite } states: [ diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index b08211cf573..43650cab5ad 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -17,6 +17,7 @@ add_qtc_executable(qtcreator MACOSX_BUNDLE ON OUTPUT_NAME "${IDE_APP_TARGET}" DESTINATION "${IDE_APP_PATH}" + QTC_RUNNABLE ) if (NOT TARGET qtcreator) diff --git a/src/libs/sqlite/sqlitebasestatement.h b/src/libs/sqlite/sqlitebasestatement.h index f58f73fdcdd..41d840ecac5 100644 --- a/src/libs/sqlite/sqlitebasestatement.h +++ b/src/libs/sqlite/sqlitebasestatement.h @@ -213,7 +213,7 @@ public: std::enable_if_t, ResultType> value(const QueryTypes &...queryValues) { Resetter resetter{this}; - ResultType resultValue; + ResultType resultValue{}; bindValues(queryValues...); diff --git a/src/libs/tracing/CMakeLists.txt b/src/libs/tracing/CMakeLists.txt index 762fc71c278..8d445df2bff 100644 --- a/src/libs/tracing/CMakeLists.txt +++ b/src/libs/tracing/CMakeLists.txt @@ -1,5 +1,3 @@ -find_package(QT NAMES Qt5 Qt6) - if (WITH_TESTS) set(TEST_SOURCES runscenegraphtest.cpp runscenegraphtest.h @@ -40,7 +38,7 @@ add_qtc_library(Tracing ${TEST_SOURCES} ) -if(${QT_VERSION} VERSION_LESS "6.2.0") +if(${Qt5_VERSION} VERSION_LESS "6.2.0") extend_qtc_library(Tracing SOURCES ${TRACING_CPP_SOURCES} diff --git a/src/plugins/autotest/autotestplugin.cpp b/src/plugins/autotest/autotestplugin.cpp index 277e346fc62..6f26981bef6 100644 --- a/src/plugins/autotest/autotestplugin.cpp +++ b/src/plugins/autotest/autotestplugin.cpp @@ -94,7 +94,7 @@ public: AutotestPluginPrivate(); ~AutotestPluginPrivate() override; - TestNavigationWidgetFactory *m_navigationWidgetFactory = nullptr; + TestNavigationWidgetFactory m_navigationWidgetFactory; TestResultsPane *m_resultsPane = nullptr; QMap m_runconfigCache; @@ -149,7 +149,6 @@ AutotestPluginPrivate::AutotestPluginPrivate() m_frameworkManager.registerTestTool(new CTestTool); m_frameworkManager.synchronizeSettings(ICore::settings()); - m_navigationWidgetFactory = new TestNavigationWidgetFactory; m_resultsPane = TestResultsPane::instance(); auto panelFactory = new ProjectExplorer::ProjectPanelFactory(); @@ -186,7 +185,6 @@ AutotestPluginPrivate::~AutotestPluginPrivate() s_projectSettings.clear(); } - delete m_navigationWidgetFactory; delete m_resultsPane; } @@ -279,9 +277,9 @@ bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorStri dd = new AutotestPluginPrivate; #ifdef WITH_TESTS ExtensionSystem::PluginManager::registerScenario("TestStringTable", - [this]() { return dd->m_loadProjectScenario(); }); + [] { return dd->m_loadProjectScenario(); }); ExtensionSystem::PluginManager::registerScenario("TestModelManagerInterface", - [this]() { return dd->m_loadProjectScenario(); }); + [] { return dd->m_loadProjectScenario(); }); #endif return true; } diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index 94759a860d6..a98fded999e 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -852,12 +852,14 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id) return newDir; if (QDir(oldDir).exists("CMakeCache.txt") && !QDir(newDir).exists("CMakeCache.txt")) { - if (QMessageBox::information(Core::ICore::dialogParent(), - tr("Changing Build Directory"), - tr("Change the build directory and start with a " - "basic CMake configuration?"), - QMessageBox::Ok, - QMessageBox::Cancel) + if (QMessageBox::information( + Core::ICore::dialogParent(), + tr("Changing Build Directory"), + tr("Change the build directory to \"%1\" and start with a " + "basic CMake configuration?") + .arg(newDir), + QMessageBox::Ok, + QMessageBox::Cancel) == QMessageBox::Ok) { return newDir; } diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index c3a20a928c1..688c0f26627 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -1009,6 +1009,7 @@ const QList CMakeBuildSystem::appTargets() const bti.workingDirectory = ct.workingDirectory; bti.buildKey = buildKey; bti.usesTerminal = !ct.linksToQtGui; + bti.isQtcRunnable = ct.qtcRunnable; // Workaround for QTCREATORBUG-19354: bti.runEnvModifier = [this, buildKey](Environment &env, bool enabled) { @@ -1027,7 +1028,7 @@ const QList CMakeBuildSystem::appTargets() const QStringList CMakeBuildSystem::buildTargetTitles() const { - auto nonAutogenTargets = filtered(m_buildTargets, [this](const CMakeBuildTarget &target){ + auto nonAutogenTargets = filtered(m_buildTargets, [](const CMakeBuildTarget &target){ return !CMakeBuildSystem::filteredOutTarget(target); }); return transform(nonAutogenTargets, &CMakeBuildTarget::title); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildtarget.h b/src/plugins/cmakeprojectmanager/cmakebuildtarget.h index c2a51c67fc4..6bc7d41249e 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildtarget.h +++ b/src/plugins/cmakeprojectmanager/cmakebuildtarget.h @@ -54,6 +54,7 @@ public: Utils::FilePath executable; // TODO: rename to output? TargetType targetType = UtilityType; bool linksToQtGui = false; + bool qtcRunnable = true; Utils::FilePath workingDirectory; Utils::FilePath sourceDirectory; Utils::FilePath makeCommand; diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp index 24669a58a53..925c240942c 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp @@ -272,8 +272,19 @@ Tasks CMakeKitAspect::validate(const Kit *k) const void CMakeKitAspect::setup(Kit *k) { CMakeTool *tool = CMakeKitAspect::cmakeTool(k); - if (!tool) - setCMakeTool(k, defaultCMakeToolId()); + if (tool) + return; + + // Look for a suitable auto-detected one: + const QString id = k->autoDetectionSource(); + for (CMakeTool *tool : CMakeToolManager::cmakeTools()) { + if (tool->detectionSource() == id) { + setCMakeTool(k, tool->id()); + return; + } + } + + setCMakeTool(k, defaultCMakeToolId()); } void CMakeKitAspect::fix(Kit *k) diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index fcf52408e5a..10cb64d3e91 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -130,26 +130,28 @@ CMakeManager::CMakeManager() mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); connect(m_buildFileAction, &QAction::triggered, this, [this] { buildFile(); }); - connect(SessionManager::instance(), &SessionManager::startupProjectChanged, - this, &CMakeManager::updateCmakeActions); - connect(BuildManager::instance(), &BuildManager::buildStateChanged, - this, &CMakeManager::updateCmakeActions); + connect(SessionManager::instance(), &SessionManager::startupProjectChanged, this, [this] { + updateCmakeActions(ProjectTree::currentNode()); + }); + connect(BuildManager::instance(), &BuildManager::buildStateChanged, this, [this] { + updateCmakeActions(ProjectTree::currentNode()); + }); connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged, this, &CMakeManager::updateBuildFileAction); connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged, this, &CMakeManager::updateCmakeActions); - updateCmakeActions(); + updateCmakeActions(ProjectTree::currentNode()); } -void CMakeManager::updateCmakeActions() +void CMakeManager::updateCmakeActions(Node *node) { auto project = qobject_cast(SessionManager::startupProject()); const bool visible = project && !BuildManager::isBuilding(project); m_runCMakeAction->setVisible(visible); m_clearCMakeCacheAction->setVisible(visible); m_rescanProjectAction->setVisible(visible); - enableBuildFileMenus(ProjectTree::currentNode()); + enableBuildFileMenus(node); } void CMakeManager::clearCMakeCache(BuildSystem *buildSystem) diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h index db3b10b6e2c..56d3aaffa45 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h @@ -44,7 +44,7 @@ public: CMakeManager(); private: - void updateCmakeActions(); + void updateCmakeActions(ProjectExplorer::Node *node); void clearCMakeCache(ProjectExplorer::BuildSystem *buildSystem); void runCMake(ProjectExplorer::BuildSystem *buildSystem); void rescanProject(ProjectExplorer::BuildSystem *buildSystem); diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp index c1cce18df94..891b89916d8 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp @@ -142,9 +142,9 @@ void CMakeProjectPlugin::extensionsInitialized() CMakeToolManager::restoreCMakeTools(); } -void CMakeProjectPlugin::updateContextActions() +void CMakeProjectPlugin::updateContextActions(Node *node) { - auto targetNode = dynamic_cast(ProjectTree::currentNode()); + auto targetNode = dynamic_cast(node); const QString targetDisplayName = targetNode ? targetNode->displayName() : QString(); // Build Target: diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.h b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.h index 75646ef265d..5daa0edcd7a 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.h @@ -27,6 +27,8 @@ #include +namespace ProjectExplorer { class Node; } + namespace CMakeProjectManager { namespace Internal { @@ -60,7 +62,7 @@ private: bool initialize(const QStringList &arguments, QString *errorMessage) final; void extensionsInitialized() final; - void updateContextActions(); + void updateContextActions(ProjectExplorer::Node *node); class CMakeProjectPluginPrivate *d = nullptr; }; diff --git a/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp b/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp index 0257738d32d..0d6430517bf 100644 --- a/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp +++ b/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp @@ -109,10 +109,10 @@ public: , m_name(item->displayName()) , m_executable(item->filePath()) , m_qchFile(item->qchFilePath()) + , m_versionDisplay(item->versionDisplay()) , m_isAutoRun(item->isAutoRun()) , m_autodetected(item->isAutoDetected()) , m_isSupported(item->hasFileApi()) - , m_versionDisplay(item->versionDisplay()) , m_changed(changed) { updateErrorFlags(); diff --git a/src/plugins/cmakeprojectmanager/cmaketool.h b/src/plugins/cmakeprojectmanager/cmaketool.h index 1414168acb1..62b5c9964ce 100644 --- a/src/plugins/cmakeprojectmanager/cmaketool.h +++ b/src/plugins/cmakeprojectmanager/cmaketool.h @@ -109,6 +109,9 @@ public: static Utils::FilePath searchQchFile(const Utils::FilePath &executable); + QString detectionSource() const { return m_detectionSource; } + void setDetectionSource(const QString &source) { m_detectionSource = source; } + private: void readInformation() const; @@ -126,6 +129,7 @@ private: bool m_isAutoRun = true; bool m_isAutoDetected = false; + QString m_detectionSource; bool m_autoCreateBuildDirectory = false; Utils::optional m_readerType; diff --git a/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp b/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp index a250b1cf4fb..42beff4b932 100644 --- a/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp @@ -177,7 +177,7 @@ void CMakeToolManager::updateDocumentation() Core::HelpManager::registerDocumentation(docs); } -void CMakeToolManager::registerCMakeByPath(const FilePath &cmakePath) +void CMakeToolManager::registerCMakeByPath(const FilePath &cmakePath, const QString &detectionSource) { const Id id = Id::fromString(cmakePath.toUserOutput()); @@ -188,6 +188,7 @@ void CMakeToolManager::registerCMakeByPath(const FilePath &cmakePath) auto newTool = std::make_unique(CMakeTool::ManualDetection, id); newTool->setFilePath(cmakePath); newTool->setDisplayName(cmakePath.toUserOutput()); + newTool->setDetectionSource(detectionSource); registerCMakeTool(std::move(newTool)); } diff --git a/src/plugins/cmakeprojectmanager/cmaketoolmanager.h b/src/plugins/cmakeprojectmanager/cmaketoolmanager.h index a8fb3a24329..2f71ddf34c4 100644 --- a/src/plugins/cmakeprojectmanager/cmaketoolmanager.h +++ b/src/plugins/cmakeprojectmanager/cmaketoolmanager.h @@ -63,7 +63,7 @@ public: static void updateDocumentation(); public slots: - void registerCMakeByPath(const Utils::FilePath &cmakePath); + void registerCMakeByPath(const Utils::FilePath &cmakePath, const QString &detectionSource); signals: void cmakeAdded (const Utils::Id &id); diff --git a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp index 1d96dad7f91..7b38aa0f41f 100644 --- a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp +++ b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp @@ -256,6 +256,8 @@ QList generateBuildTargets(const PreprocessedData &input, || f.fragment.contains("Qt6Gui")); }); + ct.qtcRunnable = t.folderTargetProperty == "qtc_runnable"; + // Extract library directories for executables: for (const FragmentInfo &f : t.link.value().fragments) { if (f.role == "flags") // ignore all flags fragments diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 7c2d8cabca3..928a26f8532 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -3583,8 +3583,10 @@ protected: if (i.type()->isNamedType()) { // check if we have to search recursively const Name *newName = i.type()->asNamedType()->name(); Scope *newScope = i.declaration()->enclosingScope(); - if (newName == name && newScope == scope) + if (Matcher::match(newName, name) + && Matcher::match(newScope->name(), scope->name())) { continue; // we have found the start location of the search + } return isValueType(newName, newScope, isValueType); } return false; diff --git a/src/plugins/debugger/debuggerprotocol.cpp b/src/plugins/debugger/debuggerprotocol.cpp index 6dc856324da..9c671c14144 100644 --- a/src/plugins/debugger/debuggerprotocol.cpp +++ b/src/plugins/debugger/debuggerprotocol.cpp @@ -308,10 +308,10 @@ void GdbMi::parseList(DebuggerOutputParser &parser) } GdbMi child; child.parseResultOrValue(parser); - if (child.isValid()) { - m_children.push_back(child); - parser.skipCommas(); - } + if (!child.isValid()) + break; + m_children.push_back(child); + parser.skipCommas(); } } diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp index b920ffc04b6..5510972443c 100644 --- a/src/plugins/docker/dockerdevice.cpp +++ b/src/plugins/docker/dockerdevice.cpp @@ -491,7 +491,8 @@ void DockerDevicePrivate::autoDetectCMake(QTextBrowser *log) log->append(tr("Found CMake binary: %1").arg(cmake.toUserOutput())); const bool res = QMetaObject::invokeMethod(cmakeManager, "registerCMakeByPath", - Q_ARG(Utils::FilePath, cmake)); + Q_ARG(Utils::FilePath, cmake), + Q_ARG(QString, m_data.id())); QTC_CHECK(res); } } @@ -1139,7 +1140,7 @@ public: QTC_ASSERT(item, return {}); auto device = DockerDevice::create(*item); - device->setupId(IDevice::ManuallyAdded, Utils::Id()); + device->setupId(IDevice::ManuallyAdded, Id::fromString(item->id())); device->setType(Constants::DOCKER_DEVICE_TYPE); device->setMachineType(IDevice::Hardware); diff --git a/src/plugins/mcusupport/mcusupportplugin.cpp b/src/plugins/mcusupport/mcusupportplugin.cpp index 65b588bce8b..a318928f195 100644 --- a/src/plugins/mcusupport/mcusupportplugin.cpp +++ b/src/plugins/mcusupport/mcusupportplugin.cpp @@ -136,7 +136,7 @@ void McuSupportPlugin::askUserAboutMcuSupportKitsUpgrade() static McuSupportOptions::UpgradeOption selectedOption; const QStringList options = { tr("Create new kits"), tr("Replace existing kits") }; selectedOption = McuSupportOptions::UpgradeOption::Keep; - info.setComboInfo(options, [upgradeMcuSupportKits, options](const QString &selected) { + info.setComboInfo(options, [options](const QString &selected) { selectedOption = options.indexOf(selected) == 0 ? McuSupportOptions::UpgradeOption::Keep : McuSupportOptions::UpgradeOption::Replace; diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 241e74a1133..24514e3ff5c 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -403,7 +403,7 @@ class ProjectExplorerPluginPrivate : public QObject public: ProjectExplorerPluginPrivate(); - void updateContextMenuActions(); + void updateContextMenuActions(Node *currentNode); void updateLocationSubMenus(); void executeRunConfiguration(RunConfiguration *, Utils::Id mode); QPair buildSettingsEnabledForSession(); @@ -767,10 +767,12 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er }); ProjectTree *tree = &dd->m_projectTree; - connect(tree, &ProjectTree::currentProjectChanged, - dd, &ProjectExplorerPluginPrivate::updateContextMenuActions); - connect(tree, &ProjectTree::nodeActionsChanged, - dd, &ProjectExplorerPluginPrivate::updateContextMenuActions); + connect(tree, &ProjectTree::currentProjectChanged, dd, [] { + dd->updateContextMenuActions(ProjectTree::currentNode()); + }); + connect(tree, &ProjectTree::nodeActionsChanged, dd, [] { + dd->updateContextMenuActions(ProjectTree::currentNode()); + }); connect(tree, &ProjectTree::currentNodeChanged, dd, &ProjectExplorerPluginPrivate::updateContextMenuActions); connect(tree, &ProjectTree::currentProjectChanged, @@ -1763,8 +1765,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er connect(this, &ProjectExplorerPlugin::settingsChanged, dd, &ProjectExplorerPluginPrivate::updateRunWithoutDeployMenu); - connect(ICore::instance(), &ICore::newItemDialogStateChanged, - dd, &ProjectExplorerPluginPrivate::updateContextMenuActions); + connect(ICore::instance(), &ICore::newItemDialogStateChanged, dd, [] { + dd->updateContextMenuActions(ProjectTree::currentNode()); + }); dd->updateWelcomePage(); @@ -3257,7 +3260,7 @@ void ProjectExplorerPluginPrivate::invalidateProject(Project *project) updateActions(); } -void ProjectExplorerPluginPrivate::updateContextMenuActions() +void ProjectExplorerPluginPrivate::updateContextMenuActions(Node *currentNode) { m_addExistingFilesAction->setEnabled(false); m_addExistingDirectoryAction->setEnabled(false); @@ -3294,8 +3297,6 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions() runMenu->menu()->clear(); runMenu->menu()->menuAction()->setVisible(false); - const Node *currentNode = ProjectTree::currentNode(); - if (currentNode && currentNode->managingProject()) { ProjectNode *pn; if (const ContainerNode *cn = currentNode->asContainerNode()) diff --git a/src/plugins/projectexplorer/projecttree.cpp b/src/plugins/projectexplorer/projecttree.cpp index 30b9af0e9f1..e94dcb602c2 100644 --- a/src/plugins/projectexplorer/projecttree.cpp +++ b/src/plugins/projectexplorer/projecttree.cpp @@ -227,7 +227,7 @@ void ProjectTree::setCurrent(Node *node, Project *project) if (node != m_currentNode) { m_currentNode = node; - emit currentNodeChanged(); + emit currentNodeChanged(node); } if (changedProject) { diff --git a/src/plugins/projectexplorer/projecttree.h b/src/plugins/projectexplorer/projecttree.h index 5fe45416812..060dad22903 100644 --- a/src/plugins/projectexplorer/projecttree.h +++ b/src/plugins/projectexplorer/projecttree.h @@ -104,7 +104,7 @@ public: signals: void currentProjectChanged(ProjectExplorer::Project *project); - void currentNodeChanged(); + void currentNodeChanged(Node *node); void nodeActionsChanged(); // Emitted whenever the model needs to send a update signal. diff --git a/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp b/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp index e32d3abeda5..96527ad3007 100644 --- a/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp +++ b/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp @@ -154,11 +154,6 @@ QString QbsProfileManager::ensureProfileForKit(const ProjectExplorer::Kit *k) return profileNameForKit(k); } -void QbsProfileManager::setProfileForKit(const QString &name, const ProjectExplorer::Kit *k) -{ - runQbsConfig(QbsConfigOp::Set, kitNameKeyInQbsSettings(k), name); -} - void QbsProfileManager::updateProfileIfNecessary(const ProjectExplorer::Kit *kit) { // kit in list <=> profile update is necessary @@ -173,29 +168,11 @@ void QbsProfileManager::updateAllProfiles() addProfileFromKit(kit); } -void QbsProfileManager::addProfile(const QString &name, const QVariantMap &data) -{ - const QString keyPrefix = "profiles." + name + "."; - for (auto it = data.begin(); it != data.end(); ++it) - runQbsConfig(QbsConfigOp::Set, keyPrefix + it.key(), it.value()); - emit qbsProfilesUpdated(); -} - -void QbsProfileManager::addQtProfileFromKit(const QString &profileName, const ProjectExplorer::Kit *k) -{ - if (const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitAspect::qtVersion(k)) { - runQbsConfig(QbsConfigOp::Set, - "profiles." + profileName + ".moduleProviders.Qt.qmakeFilePaths", - qt->qmakeCommand().toString()); - } -} - void QbsProfileManager::addProfileFromKit(const ProjectExplorer::Kit *k) { const QString name = profileNameForKit(k); runQbsConfig(QbsConfigOp::Unset, "profiles." + name); - setProfileForKit(name, k); - addQtProfileFromKit(name, k); + runQbsConfig(QbsConfigOp::Set, kitNameKeyInQbsSettings(k), name); // set up properties: QVariantMap data = m_defaultPropertyProvider->properties(k, QVariantMap()); @@ -203,8 +180,17 @@ void QbsProfileManager::addProfileFromKit(const ProjectExplorer::Kit *k) if (provider->canHandle(k)) data = provider->properties(k, data); } + if (const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitAspect::qtVersion(k)) + data.insert("moduleProviders.Qt.qmakeFilePaths", qt->qmakeCommand().toString()); - addProfile(name, data); + if (QbsSettings::qbsVersion() < QVersionNumber({1, 20})) { + const QString keyPrefix = "profiles." + name + "."; + for (auto it = data.begin(); it != data.end(); ++it) + runQbsConfig(QbsConfigOp::Set, keyPrefix + it.key(), it.value()); + } else { + runQbsConfig(QbsConfigOp::AddProfile, name, data); + } + emit qbsProfilesUpdated(); } void QbsProfileManager::handleKitUpdate(ProjectExplorer::Kit *kit) @@ -246,6 +232,13 @@ QString QbsProfileManager::runQbsConfig(QbsConfigOp op, const QString &key, cons case QbsConfigOp::Unset: args << "--unset" << key; break; + case QbsConfigOp::AddProfile: { + args << "--add-profile" << key; + const QVariantMap props = value.toMap(); + for (auto it = props.begin(); it != props.end(); ++it) + args << it.key() << toJSLiteral(it.value()); + break; + } } const Utils::FilePath qbsExe = QbsSettings::qbsExecutableFilePath(); if (qbsExe.isEmpty() || !qbsExe.exists()) diff --git a/src/plugins/qbsprojectmanager/qbsprofilemanager.h b/src/plugins/qbsprojectmanager/qbsprofilemanager.h index 73f52c3d9f8..745802da8de 100644 --- a/src/plugins/qbsprojectmanager/qbsprofilemanager.h +++ b/src/plugins/qbsprojectmanager/qbsprofilemanager.h @@ -52,15 +52,13 @@ public: static QString ensureProfileForKit(const ProjectExplorer::Kit *k); static QString profileNameForKit(const ProjectExplorer::Kit *kit); static void updateProfileIfNecessary(const ProjectExplorer::Kit *kit); - enum class QbsConfigOp { Get, Set, Unset }; static QString runQbsConfig(QbsConfigOp op, const QString &key, const QVariant &value = {}); + enum class QbsConfigOp { Get, Set, Unset, AddProfile }; + static QString runQbsConfig(QbsConfigOp op, const QString &key, const QVariant &value = {}); signals: void qbsProfilesUpdated(); private: - void setProfileForKit(const QString &name, const ProjectExplorer::Kit *k); - void addProfile(const QString &name, const QVariantMap &data); - void addQtProfileFromKit(const QString &profileName, const ProjectExplorer::Kit *k); void addProfileFromKit(const ProjectExplorer::Kit *k); void updateAllProfiles(); diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp index cf46e0b544d..992047bb1fa 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp @@ -262,7 +262,7 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString * }); // Run initial setup routines - updateContextActions(); + updateContextActions(ProjectTree::currentNode()); updateReparseQbsAction(); updateBuildActions(); @@ -280,10 +280,9 @@ void QbsProjectManagerPlugin::targetWasAdded(Target *target) this, &QbsProjectManagerPlugin::projectChanged); } -void QbsProjectManagerPlugin::updateContextActions() +void QbsProjectManagerPlugin::updateContextActions(Node *node) { auto project = qobject_cast(ProjectTree::currentProject()); - const Node *node = ProjectTree::currentNode(); bool isEnabled = !BuildManager::isBuilding(project) && project && project->activeTarget() && !project->activeTarget()->buildSystem()->isParsing() @@ -369,7 +368,7 @@ void QbsProjectManagerPlugin::projectChanged() updateReparseQbsAction(); if (!project || project == ProjectTree::currentProject()) - updateContextActions(); + updateContextActions(ProjectTree::currentNode()); if (!project || project == currentEditorProject()) updateBuildActions(); diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.h b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.h index 641bf5d01d8..d93869c0ba7 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.h +++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.h @@ -29,7 +29,10 @@ #include #include -namespace ProjectExplorer { class Target; } +namespace ProjectExplorer { +class Target; +class Node; +} // namespace ProjectExplorer namespace QbsProjectManager { namespace Internal { @@ -72,7 +75,7 @@ private: void reparseCurrentProject(); void reparseProject(QbsProject *project); - void updateContextActions(); + void updateContextActions(ProjectExplorer::Node *node); void updateReparseQbsAction(); void updateBuildActions(); diff --git a/src/plugins/qbsprojectmanager/qbssettings.cpp b/src/plugins/qbsprojectmanager/qbssettings.cpp index de6b1ad9dac..0233955175a 100644 --- a/src/plugins/qbsprojectmanager/qbssettings.cpp +++ b/src/plugins/qbsprojectmanager/qbssettings.cpp @@ -49,6 +49,19 @@ const char QBS_EXE_KEY[] = "QbsProjectManager/QbsExecutable"; const char QBS_DEFAULT_INSTALL_DIR_KEY[] = "QbsProjectManager/DefaultInstallDir"; const char USE_CREATOR_SETTINGS_KEY[] = "QbsProjectManager/useCreatorDir"; +static QString getQbsVersion(const FilePath &qbsExe) +{ + if (qbsExe.isEmpty() || !qbsExe.exists()) + return {}; + QProcess qbsProc; + qbsProc.start(qbsExe.toString(), {"--version"}); + if (!qbsProc.waitForStarted(3000) || !qbsProc.waitForFinished(5000) + || qbsProc.exitCode() != 0) { + return {}; + } + return QString::fromLocal8Bit(qbsProc.readAllStandardOutput()).trimmed(); +} + static bool operator==(const QbsSettingsData &s1, const QbsSettingsData &s2) { return s1.qbsExecutableFilePath == s2.qbsExecutableFilePath @@ -88,6 +101,14 @@ QString QbsSettings::qbsSettingsBaseDir() return useCreatorSettingsDirForQbs() ? Core::ICore::userResourcePath().toString() : QString(); } +QVersionNumber QbsSettings::qbsVersion() +{ + if (instance().m_settings.qbsVersion.isNull()) + instance().m_settings.qbsVersion = QVersionNumber::fromString( + getQbsVersion(qbsExecutableFilePath())); + return instance().m_settings.qbsVersion; +} + QbsSettings &QbsSettings::instance() { static QbsSettings theSettings; @@ -140,7 +161,7 @@ public: m_qbsExePathChooser.setExpectedKind(PathChooser::ExistingCommand); m_qbsExePathChooser.setFilePath(QbsSettings::qbsExecutableFilePath()); m_defaultInstallDirLineEdit.setText(QbsSettings::defaultInstallDirTemplate()); - m_versionLabel.setText(getQbsVersion()); + m_versionLabel.setText(getQbsVersionString()); m_settingsDirCheckBox.setText(tr("Use %1 settings directory for Qbs") .arg(Core::Constants::IDE_DISPLAY_NAME)); m_settingsDirCheckBox.setChecked(QbsSettings::useCreatorSettingsDirForQbs()); @@ -150,6 +171,10 @@ public: layout->addRow(tr("Path to qbs executable:"), &m_qbsExePathChooser); layout->addRow(tr("Default installation directory:"), &m_defaultInstallDirLineEdit); layout->addRow(tr("Qbs version:"), &m_versionLabel); + + connect(&m_qbsExePathChooser, &PathChooser::pathChanged, [this] { + m_versionLabel.setText(getQbsVersionString()); + }); } void apply() @@ -159,22 +184,15 @@ public: settings.qbsExecutableFilePath = m_qbsExePathChooser.filePath(); settings.defaultInstallDirTemplate = m_defaultInstallDirLineEdit.text(); settings.useCreatorSettings = m_settingsDirCheckBox.isChecked(); + settings.qbsVersion = {}; QbsSettings::setSettingsData(settings); } private: - static QString getQbsVersion() + QString getQbsVersionString() { - const FilePath qbsExe = QbsSettings::qbsExecutableFilePath(); - if (qbsExe.isEmpty() || !qbsExe.exists()) - return tr("Failed to retrieve version."); - QProcess qbsProc; - qbsProc.start(qbsExe.toString(), {"--version"}); - if (!qbsProc.waitForStarted(3000) || !qbsProc.waitForFinished(5000) - || qbsProc.exitCode() != 0) { - return tr("Failed to retrieve version."); - } - return QString::fromLocal8Bit(qbsProc.readAllStandardOutput()).trimmed(); + const QString version = getQbsVersion(m_qbsExePathChooser.filePath()); + return version.isEmpty() ? tr("Failed to retrieve version.") : version; } PathChooser m_qbsExePathChooser; diff --git a/src/plugins/qbsprojectmanager/qbssettings.h b/src/plugins/qbsprojectmanager/qbssettings.h index 490c9c57433..fef663e2063 100644 --- a/src/plugins/qbsprojectmanager/qbssettings.h +++ b/src/plugins/qbsprojectmanager/qbssettings.h @@ -30,6 +30,7 @@ #include #include +#include namespace QbsProjectManager { namespace Internal { @@ -38,6 +39,7 @@ class QbsSettingsData { public: Utils::FilePath qbsExecutableFilePath; QString defaultInstallDirTemplate; + QVersionNumber qbsVersion; // Ephemeral bool useCreatorSettings = true; }; @@ -52,6 +54,7 @@ public: static QString defaultInstallDirTemplate(); static bool useCreatorSettingsDirForQbs(); static QString qbsSettingsBaseDir(); + static QVersionNumber qbsVersion(); static void setSettingsData(const QbsSettingsData &settings); static QbsSettingsData rawSettingsData(); diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp index bd62251e2de..01da9cad48f 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp @@ -86,7 +86,7 @@ public: void activeTargetChanged(); void updateActions(); void updateRunQMakeAction(); - void updateContextActions(); + void updateContextActions(Node *node); void buildStateChanged(Project *pro); void updateBuildFileAction(); void disableBuildFileMenus(); @@ -496,7 +496,7 @@ void QmakeProjectManagerPluginPrivate::activeTargetChanged() void QmakeProjectManagerPluginPrivate::updateActions() { updateRunQMakeAction(); - updateContextActions(); + updateContextActions(ProjectTree::currentNode()); } void QmakeProjectManagerPluginPrivate::updateRunQMakeAction() @@ -515,9 +515,8 @@ void QmakeProjectManagerPluginPrivate::updateRunQMakeAction() m_runQMakeAction->setEnabled(enable); } -void QmakeProjectManagerPluginPrivate::updateContextActions() +void QmakeProjectManagerPluginPrivate::updateContextActions(Node *node) { - const Node *node = ProjectTree::currentNode(); Project *project = ProjectTree::currentProject(); const ContainerNode *containerNode = node ? node->asContainerNode() : nullptr; @@ -578,7 +577,7 @@ void QmakeProjectManagerPluginPrivate::buildStateChanged(Project *pro) { if (pro == ProjectTree::currentProject()) { updateRunQMakeAction(); - updateContextActions(); + updateContextActions(ProjectTree::currentNode()); updateBuildFileAction(); } } diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationeditordialog.cpp b/src/plugins/qmldesigner/components/annotationeditor/annotationeditordialog.cpp index 48c8c34f189..bf4e3ce74da 100644 --- a/src/plugins/qmldesigner/components/annotationeditor/annotationeditordialog.cpp +++ b/src/plugins/qmldesigner/components/annotationeditor/annotationeditordialog.cpp @@ -43,10 +43,9 @@ AnnotationEditorDialog::AnnotationEditorDialog(QWidget *parent, const QString &targetId, const QString &customId) : QDialog(parent) - , m_defaults(std::make_unique()) - , m_customId(customId) , ui(std::make_unique()) - , m_statusIsActive(false) + , m_customId(customId) + , m_defaults(std::make_unique()) { ui->setupUi(this); setGlobal(m_isGlobal); diff --git a/src/plugins/qmldesigner/components/debugview/debugview.cpp b/src/plugins/qmldesigner/components/debugview/debugview.cpp index a8b0b34f10e..62626b89cd7 100644 --- a/src/plugins/qmldesigner/components/debugview/debugview.cpp +++ b/src/plugins/qmldesigner/components/debugview/debugview.cpp @@ -515,6 +515,7 @@ void DebugView::currentStateChanged(const ModelNode &/*node*/) void DebugView::nodeOrderChanged(const NodeListProperty &listProperty) { + Q_UNUSED(listProperty) if (isDebugViewEnabled()) { QTextStream message; QString string; diff --git a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp index ac9fbab89e3..8200558d182 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp @@ -60,7 +60,6 @@ const int startItemOffset = 96; const qreal labelFontSize = 10; const qreal labelShowThreshold = 0.25; // Everything lower than that will hide all labels -const qreal defaultDpi = 96.0; void drawIcon(QPainter *painter, int x, diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelineview.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineview.cpp index ed35459ded3..cb9ed8f0cd4 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelineview.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelineview.cpp @@ -420,6 +420,8 @@ void TimelineView::customNotification(const AbstractView * /*view*/, const QList &nodeList, const QList &data) { + Q_UNUSED(nodeList) + Q_UNUSED(data) if (identifier == QStringLiteral("reset QmlPuppet")) { QmlTimeline timeline = widget()->graphicsScene()->currentTimeline(); if (timeline.isValid()) diff --git a/src/plugins/qmldesigner/generateresource.cpp b/src/plugins/qmldesigner/generateresource.cpp index 68f159db1d3..182ede79dc1 100644 --- a/src/plugins/qmldesigner/generateresource.cpp +++ b/src/plugins/qmldesigner/generateresource.cpp @@ -63,7 +63,7 @@ namespace QmlDesigner { -QTableWidget* GenerateResource::createFilesTable(const QStringList &fileNames) +QTableWidget* GenerateResource::createFilesTable(const QList &fileNames) { auto table = new QTableWidget(0, 1); table->setSelectionMode(QAbstractItemView::SingleSelection); @@ -74,12 +74,19 @@ QTableWidget* GenerateResource::createFilesTable(const QStringList &fileNames) table->verticalHeader()->hide(); table->setShowGrid(false); - for (const QString &filePath : fileNames) { + QFont font; + font.setBold(true); + + for (ResourceFile resource : fileNames){ + QString filePath = resource.fileName; auto checkboxItem = new QTableWidgetItem(); checkboxItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); checkboxItem->setCheckState(Qt::Checked); checkboxItem->setText(filePath); + if (resource.inProject) + checkboxItem->setFont(font); + int row = table->rowCount(); table->insertRow(row); table->setItem(row, 0, checkboxItem); @@ -88,7 +95,7 @@ QTableWidget* GenerateResource::createFilesTable(const QStringList &fileNames) return table; } -QStringList GenerateResource::getFileList(const QStringList &fileNames) +QStringList GenerateResource::getFileList(const QList &fileNames) { QStringList result; QDialog *dialog = new QDialog(Core::ICore::dialogParent()); @@ -107,21 +114,21 @@ QStringList GenerateResource::getFileList(const QStringList &fileNames) mainLayout->addWidget(buttonBox, 3, 2, 1, 2); - QObject::connect(buttonBox, &QDialogButtonBox::accepted, dialog, [dialog](){ + QObject::connect(buttonBox, &QDialogButtonBox::accepted, dialog, [dialog]() { dialog->accept(); dialog->deleteLater(); }); - QObject::connect(buttonBox, &QDialogButtonBox::rejected, dialog, [dialog](){ + QObject::connect(buttonBox, &QDialogButtonBox::rejected, dialog, [dialog]() { dialog->reject(); dialog->deleteLater(); }); - QObject::connect(dialog, &QDialog::accepted, [&result, &table](){ + QObject::connect(dialog, &QDialog::accepted, [&result, &table]() { QStringList fileList; QString file; - for (int i = 0; i < table->rowCount(); ++i){ + for (int i = 0; i < table->rowCount(); ++i) { if (table->item(i,0)->checkState()){ file = table->item(i,0)->text(); fileList.append(file); @@ -141,19 +148,21 @@ void GenerateResource::generateMenuEntry() Core::ActionContainer *buildMenu = Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT); - const Core::Context projectContext(QmlProjectManager::Constants::QML_PROJECT_ID); // ToDo: move this to QtCreator and add tr to the string then - auto action = new QAction(QCoreApplication::translate("QmlDesigner::GenerateResource", "Generate Resource File")); + auto action = new QAction(QCoreApplication::translate("QmlDesigner::GenerateResource", + "Generate QRC Resource File")); action->setEnabled(ProjectExplorer::SessionManager::startupProject() != nullptr); // todo make it more intelligent when it gets enabled - QObject::connect(ProjectExplorer::SessionManager::instance(), &ProjectExplorer::SessionManager::startupProjectChanged, [action]() { + QObject::connect(ProjectExplorer::SessionManager::instance(), + &ProjectExplorer::SessionManager::startupProjectChanged, [action]() { action->setEnabled(ProjectExplorer::SessionManager::startupProject()); }); Core::Command *cmd = Core::ActionManager::registerAction(action, "QmlProject.CreateResource"); QObject::connect(action, &QAction::triggered, [] () { auto currentProject = ProjectExplorer::SessionManager::startupProject(); + QTC_ASSERT(currentProject, return); auto projectPath = currentProject->projectFilePath().parentDir().toString(); static QMap lastUsedPathes; @@ -163,21 +172,13 @@ void GenerateResource::generateMenuEntry() saveLastUsedPath(lastUsedPathes.value(currentProject->displayName(), currentProject->projectFilePath().parentDir().parentDir().toString())); - auto resourceFileName = Core:: DocumentManager::getSaveFileName( - QCoreApplication::translate("QmlDesigner::GenerateResource", "Save Project as Resource"), - lastUsedPathes.value(currentProject->displayName()) + "/" + currentProject->displayName() + ".qmlrc", - QCoreApplication::translate("QmlDesigner::GenerateResource", "QML Resource File (*.qmlrc)")); - if (resourceFileName.isEmpty()) - return; - - Core::MessageManager::writeSilently( - QCoreApplication::translate("QmlDesigner::GenerateResource", - "Generate a resource file out of project %1 to %2") - .arg(currentProject->displayName(), QDir::toNativeSeparators(resourceFileName))); - + QString projectFileName = currentProject->displayName() + ".qrc"; QTemporaryFile temp(projectPath + "/XXXXXXX.create.resource.qrc"); + QFile persistentFile(projectPath + "/" + projectFileName); + if (!temp.open()) return; + temp.close(); QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion( @@ -196,7 +197,7 @@ void GenerateResource::generateMenuEntry() Core::MessageManager::writeDisrupting( QCoreApplication::translate("QmlDesigner::GenerateResource", "Unable to generate resource file: %1") - .arg(resourceFileName)); + .arg(temp.fileName())); return; } QByteArray stdOut; @@ -208,10 +209,11 @@ void GenerateResource::generateMenuEntry() "A timeout occurred running \"%1\"") .arg(rccBinary + " " + arguments.join(" "))); return; + } - if (!stdOut.trimmed().isEmpty()) { + if (!stdOut.trimmed().isEmpty()) Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdOut)); - } + if (!stdErr.trimmed().isEmpty()) Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdErr)); @@ -229,14 +231,13 @@ void GenerateResource::generateMenuEntry() .arg(rccProcess.exitCode())); return; } - } if (!temp.open()) return; QXmlStreamReader reader(&temp); - QStringList fileList = {}; + QList fileList = {}; QByteArray firstLine = temp.readLine(); while (!reader.atEnd()) { @@ -247,12 +248,244 @@ void GenerateResource::generateMenuEntry() if (reader.name() == QLatin1String("file")) { QString fileName = reader.readElementText().trimmed(); - if ((!fileName.startsWith("./.")) && (!fileName.startsWith("./XXXXXXX"))) - fileList.append(fileName); + + if ((!fileName.startsWith("./.")) && (!fileName.startsWith("./XXXXXXX")) + && !fileName.endsWith(".qmlproject") && !fileName.endsWith(".pri") + && !fileName.endsWith(".pro") && !fileName.endsWith(".user") + && !fileName.endsWith(".qrc")) { + ResourceFile file; + file.fileName = fileName; + file.inProject = false; + fileList.append(file); + } + } + } + + QDir dir; + dir.setCurrent(projectPath); + + Utils::FilePaths paths = currentProject->files(ProjectExplorer::Project::AllFiles); + QStringList projectFiles = {}; + + for (const Utils::FilePath &path : paths) { + QString relativepath = dir.relativeFilePath(path.toString()); + + if (!relativepath.endsWith(".qmlproject") && !relativepath.endsWith(".pri") + && !relativepath.endsWith(".pro") && !relativepath.endsWith(".user") + && !relativepath.endsWith(".qrc")) { + projectFiles.append(relativepath); + + bool found = false; + QString compareString = "./" + relativepath.trimmed(); + for (int i = 0; i < fileList.count(); ++i) + if (fileList.at(i).fileName == compareString) { + fileList[i].inProject = true; + found = true; + break; + } + + if (!found) { + ResourceFile res; + res.fileName = "./" + relativepath.trimmed(); + res.inProject = true; + fileList.append(res); + } } } temp.close(); + + QStringList modifiedList = getFileList(fileList); + + if (!persistentFile.open(QIODevice::ReadWrite | QIODevice::Truncate)) + return; + + QXmlStreamWriter writer(&persistentFile); + writer.setAutoFormatting(true); + writer.setAutoFormattingIndent(0); + + persistentFile.write(firstLine.trimmed()); + writer.writeStartElement("qresource"); + + for (QString file : modifiedList) + writer.writeTextElement("file", file.trimmed()); + + writer.writeEndElement(); + persistentFile.write("\n\n"); + persistentFile.close(); + + saveLastUsedPath(Utils::FilePath::fromString(projectFileName).parentDir().toString()); + }); + + // ToDo: move this to QtCreator and add tr to the string then + auto rccAction = new QAction(QCoreApplication::translate("QmlDesigner::GenerateResource", + "Generate RCC Resource File")); + rccAction->setEnabled(ProjectExplorer::SessionManager::startupProject() != nullptr); + QObject::connect(ProjectExplorer::SessionManager::instance(), + &ProjectExplorer::SessionManager::startupProjectChanged, [rccAction]() { + rccAction->setEnabled(ProjectExplorer::SessionManager::startupProject()); + }); + + Core::Command *cmd2 = Core::ActionManager::registerAction(rccAction, + "QmlProject.CreateRCCResource"); + QObject::connect(rccAction, &QAction::triggered, [] () { + auto currentProject = ProjectExplorer::SessionManager::startupProject(); + QTC_ASSERT(currentProject, return); + auto projectPath = currentProject->projectFilePath().parentDir().toString(); + + static QMap lastUsedPathes; + auto saveLastUsedPath = [currentProject] (const QString &lastUsedPath) { + lastUsedPathes.insert(currentProject->displayName(), lastUsedPath); + }; + saveLastUsedPath(lastUsedPathes.value(currentProject->displayName(), + currentProject->projectFilePath().parentDir().parentDir().toString())); + + auto resourceFileName = Core:: DocumentManager::getSaveFileName( + QCoreApplication::translate("QmlDesigner::GenerateResource", + "Save Project as Resource"), lastUsedPathes.value(currentProject->displayName()) + + "/" + currentProject->displayName() + ".qmlrc", + QCoreApplication::translate("QmlDesigner::GenerateResource", + "QML Resource File (*.qmlrc);;Resource File (*.rcc)")); + if (resourceFileName.isEmpty()) + return; + + Core::MessageManager::writeSilently( + QCoreApplication::translate("QmlDesigner::GenerateResource", + "Generate a resource file out of project %1 to %2") + .arg(currentProject->displayName(), QDir::toNativeSeparators(resourceFileName))); + + QString projectFileName = currentProject->displayName() + ".qrc"; + QFile persistentFile(projectPath + "/" + projectFileName); + QTemporaryFile temp(projectPath + "/XXXXXXX.create.resource.qrc"); + + QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion( + currentProject->activeTarget()->kit()); + QString rccBinary = qtVersion->rccCommand(); + + Utils::QtcProcess rccProcess; + rccProcess.setWorkingDirectory(projectPath); + + QXmlStreamReader reader; + QByteArray firstLine; + + if (!QFileInfo(persistentFile).exists()) { + if (!temp.open()) + return; + temp.close(); + + const QStringList arguments1 = {"--project", "--output", temp.fileName()}; + + for (const auto &arguments : {arguments1}) { + rccProcess.setCommand({rccBinary, arguments}); + rccProcess.start(); + if (!rccProcess.waitForStarted()) { + Core::MessageManager::writeDisrupting( + QCoreApplication::translate("QmlDesigner::GenerateResource", + "Unable to generate resource file: %1") + .arg(resourceFileName)); + return; + } + QByteArray stdOut; + QByteArray stdErr; + if (!rccProcess.readDataFromProcess(30, &stdOut, &stdErr, true)) { + rccProcess.stopProcess(); + Core::MessageManager::writeDisrupting( + QCoreApplication::translate("QmlDesigner::GenerateResource", + "A timeout occurred running \"%1\"") + .arg(rccBinary + " " + arguments.join(" "))); + return; + } + if (!stdOut.trimmed().isEmpty()) + Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdOut)); + + if (!stdErr.trimmed().isEmpty()) + Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdErr)); + + if (rccProcess.exitStatus() != QProcess::NormalExit) { + Core::MessageManager::writeDisrupting( + QCoreApplication::translate("QmlDesigner::GenerateResource", "\"%1\" crashed.") + .arg(rccBinary + " " + arguments.join(" "))); + return; + } + if (rccProcess.exitCode() != 0) { + Core::MessageManager::writeDisrupting( + QCoreApplication::translate("QmlDesigner::GenerateResource", + "\"%1\" failed (exit code %2).") + .arg(rccBinary + " " + arguments.join(" ")) + .arg(rccProcess.exitCode())); + return; + } + } + + reader.setDevice(&temp); + + if (!temp.open()) + return; + firstLine = temp.readLine(); + + } else { + reader.setDevice(&persistentFile); + if (!persistentFile.open(QIODevice::ReadWrite)) + return; + + firstLine = persistentFile.readLine(); + } + + QList fileList = {}; + + while (!reader.atEnd()) { + const auto token = reader.readNext(); + + if (token != QXmlStreamReader::StartElement) + continue; + + if (reader.name() == QLatin1String("file")) { + QString fileName = reader.readElementText().trimmed(); + if ((!fileName.startsWith("./.")) && (!fileName.startsWith("./XXXXXXX")) + && !fileName.endsWith(".qmlproject") && !fileName.endsWith(".pri") + && !fileName.endsWith(".pro") && !fileName.endsWith(".user") + && !fileName.endsWith(".qrc")) { + ResourceFile file; + file.fileName = fileName; + file.inProject = false; + fileList.append(file); + } + } + } + + QDir dir; + dir.setCurrent(projectPath); + + Utils::FilePaths paths = currentProject->files(ProjectExplorer::Project::AllFiles); + QStringList projectFiles = {}; + + for (const Utils::FilePath &path : paths) { + QString relativepath = dir.relativeFilePath(path.toString()); + + if (!relativepath.endsWith(".qmlproject") && !relativepath.endsWith(".pri") + && !relativepath.endsWith(".pro") && !relativepath.endsWith(".user") + && !relativepath.endsWith(".qrc")) { + projectFiles.append(relativepath); + + bool found = false; + QString compareString = "./" + relativepath.trimmed(); + for (int i = 0; i < fileList.count(); ++i) + if (fileList.at(i).fileName == compareString) { + fileList[i].inProject = true; + found = true; + } + + if (!found) { + ResourceFile res; + res.fileName = "./" + relativepath.trimmed(); + res.inProject = true; + fileList.append(res); + } + } + } + + temp.close(); + persistentFile.close(); QStringList modifiedList = getFileList(fileList); QTemporaryFile tempFile(projectPath + "/XXXXXXX.create.modifiedresource.qrc"); @@ -266,14 +499,15 @@ void GenerateResource::generateMenuEntry() tempFile.write(firstLine.trimmed()); writer.writeStartElement("qresource"); - for (int i = 0; i < modifiedList.count(); ++i) - writer.writeTextElement("file", modifiedList.at(i).trimmed()); + for (QString file : modifiedList) + writer.writeTextElement("file", file.trimmed()); writer.writeEndElement(); tempFile.write("\n\n"); tempFile.close(); - const QStringList arguments2 = {"--binary", "--output", resourceFileName, tempFile.fileName()}; + const QStringList arguments2 = {"--binary", "--output", resourceFileName, + tempFile.fileName()}; for (const auto &arguments : {arguments2}) { rccProcess.setCommand({rccBinary, arguments}); @@ -293,12 +527,12 @@ void GenerateResource::generateMenuEntry() QCoreApplication::translate("QmlDesigner::GenerateResource", "A timeout occurred running \"%1\"") .arg(rccBinary + " " + arguments.join(" "))); - return ; + return; } - if (!stdOut.trimmed().isEmpty()) { + if (!stdOut.trimmed().isEmpty()) Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdOut)); - } + if (!stdErr.trimmed().isEmpty()) Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdErr)); @@ -322,6 +556,7 @@ void GenerateResource::generateMenuEntry() saveLastUsedPath(Utils::FilePath::fromString(resourceFileName).parentDir().toString()); }); buildMenu->addAction(cmd, ProjectExplorer::Constants::G_BUILD_RUN); + buildMenu->addAction(cmd2, ProjectExplorer::Constants::G_BUILD_RUN); } } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/generateresource.h b/src/plugins/qmldesigner/generateresource.h index f6030e1c0c4..42d96c2d513 100644 --- a/src/plugins/qmldesigner/generateresource.h +++ b/src/plugins/qmldesigner/generateresource.h @@ -28,8 +28,13 @@ namespace QmlDesigner { namespace GenerateResource { +struct ResourceFile +{ + QString fileName; + bool inProject; +}; void generateMenuEntry(); - QStringList getFileList(const QStringList &); - QTableWidget* createFilesTable(const QStringList &); + QStringList getFileList(const QList &); + QTableWidget* createFilesTable(const QList &); } } // namespace QmlDesigner diff --git a/src/plugins/qmlpreview/qmlpreviewplugin.cpp b/src/plugins/qmlpreview/qmlpreviewplugin.cpp index cf22d7d5c64..b10725ebb7e 100644 --- a/src/plugins/qmlpreview/qmlpreviewplugin.cpp +++ b/src/plugins/qmlpreview/qmlpreviewplugin.cpp @@ -236,8 +236,7 @@ QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent) Core::ActionManager::registerAction(action, "QmlPreview.PreviewFile", Core::Context(Constants::C_PROJECT_TREE)), Constants::G_FILE_OTHER); action->setVisible(false); - connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged, action, [action]() { - const Node *node = ProjectTree::currentNode(); + connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged, action, [action](Node *node) { const FileNode *fileNode = node ? node->asFileNode() : nullptr; action->setVisible(fileNode ? fileNode->fileType() == FileType::QML : false); }); diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 7d5e4bd2a5b..7e4ff317084 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -516,9 +516,11 @@ Tasks BaseQtVersion::validateKit(const Kit *k) return result; const Id dt = DeviceTypeKitAspect::deviceTypeId(k); - const QSet tdt = targetDeviceTypes(); - if (!tdt.isEmpty() && !tdt.contains(dt)) - result << BuildSystemTask(Task::Warning, tr("Device type is not supported by Qt version.")); + if (dt != "DockerDeviceType") { + const QSet tdt = targetDeviceTypes(); + if (!tdt.isEmpty() && !tdt.contains(dt)) + result << BuildSystemTask(Task::Warning, tr("Device type is not supported by Qt version.")); + } if (ToolChain *tc = ToolChainKitAspect::cxxToolChain(k)) { Abi targetAbi = tc->targetAbi(); diff --git a/src/plugins/resourceeditor/resourceeditorplugin.cpp b/src/plugins/resourceeditor/resourceeditorplugin.cpp index 25c29e2cdcd..19fa120d585 100644 --- a/src/plugins/resourceeditor/resourceeditorplugin.cpp +++ b/src/plugins/resourceeditor/resourceeditorplugin.cpp @@ -132,7 +132,7 @@ public: void copyPathContextMenu(); void copyUrlContextMenu(); - void updateContextActions(); + void updateContextActions(Node *node); ResourceEditorW * currentEditor() const; @@ -368,9 +368,8 @@ void ResourceEditorPluginPrivate::renamePrefixContextMenu() node->renamePrefix(prefix, dialog.lang()); } -void ResourceEditorPluginPrivate::updateContextActions() +void ResourceEditorPluginPrivate::updateContextActions(Node *node) { - const Node *node = ProjectTree::currentNode(); const bool isResourceNode = dynamic_cast(node); m_addPrefix->setEnabled(isResourceNode); m_addPrefix->setVisible(isResourceNode); diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp index 39660b5235f..118962fec68 100644 --- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp +++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp @@ -195,7 +195,7 @@ public: connect(checkout, &ExampleCheckout::finishedSucessfully, this, - [checkout, this, formFile, example]() { + [checkout, formFile, example]() { const QString projectFile = checkout->extractionFolder() + "/" + example + "/" + example + ".qmlproject"; diff --git a/src/shared/proparser/ioutils.cpp b/src/shared/proparser/ioutils.cpp index 10d75817650..8b0aef01ed2 100644 --- a/src/shared/proparser/ioutils.cpp +++ b/src/shared/proparser/ioutils.cpp @@ -48,6 +48,18 @@ using namespace QMakeInternal; IoUtils::FileType IoUtils::fileType(const QString &fileName) { + // FIXME: + if (fileName.startsWith("docker:/")) { + if (!fileName.startsWith("docker://")) + qWarning("File name not canonical"); + int pos = fileName.indexOf('/', 10); + if (pos == 0) { + qWarning("File name not canonical"); + return FileNotFound; + } + return fileType(fileName.mid(pos)); + } + Q_ASSERT(fileName.isEmpty() || isAbsolutePath(fileName)); #ifdef Q_OS_WIN DWORD attr = GetFileAttributesW((WCHAR*)fileName.utf16()); diff --git a/tests/unit/unittest/sqlitestatement-test.cpp b/tests/unit/unittest/sqlitestatement-test.cpp index 873ba1d5e30..ea37b502221 100644 --- a/tests/unit/unittest/sqlitestatement-test.cpp +++ b/tests/unit/unittest/sqlitestatement-test.cpp @@ -1482,7 +1482,6 @@ TEST_F(SqliteStatement, ReadStatementOptionalValueWithTransactions) TEST_F(SqliteStatement, ReadStatementReadCallbackWithTransactions) { - using Tuple = std::tuple; MockFunction callbackMock; ReadStatement<3> statement("SELECT name, number, value FROM test WHERE name=? AND number=?", database); @@ -1549,7 +1548,6 @@ TEST_F(SqliteStatement, ReadWriteStatementOptionalValueWithTransactions) TEST_F(SqliteStatement, ReadWriteStatementReadCallbackWithTransactions) { - using Tuple = std::tuple; MockFunction callbackMock; ReadWriteStatement<3> statement( "SELECT name, number, value FROM test WHERE name=? AND number=?", database);