Merge "Merge remote-tracking branch 'origin/5.0'"

This commit is contained in:
The Qt Project
2021-06-28 09:41:13 +00:00
72 changed files with 634 additions and 224 deletions

View File

@@ -602,7 +602,7 @@ function(extend_qtc_test target_name)
endfunction() endfunction()
function(add_qtc_executable name) 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" "DESTINATION;COMPONENT;BUILD_DEFAULT"
"CONDITION;DEPENDS;DEFINES;INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;EXTRA_TRANSLATIONS;PROPERTIES" ${ARGN}) "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}) enable_pch(${name})
endif() 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) if (NOT _arg_SKIP_INSTALL)
unset(COMPONENT_OPTION) unset(COMPONENT_OPTION)
if (_arg_COMPONENT) if (_arg_COMPONENT)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -92,11 +92,6 @@
to automatically run CMake every time when you save changes to to automatically run CMake every time when you save changes to
\c {CMakeLists.txt} files. \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. \li Select \uicontrol Apply to save your changes.
\endlist \endlist

View File

@@ -201,9 +201,22 @@
\image qtcreator-togglebookmark.png \image qtcreator-togglebookmark.png
To add a note to a bookmark, right-click the bookmark and select \section2 Adding Notes to Bookmarks
\uicontrol {Edit Bookmark}. To view the note, move the mouse pointer over
the bookmark. 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 To go to the previous bookmark in the current session, select
\uicontrol Tools > \uicontrol Bookmarks > \uicontrol {Previous Bookmark} \uicontrol Tools > \uicontrol Bookmarks > \uicontrol {Previous Bookmark}
@@ -221,6 +234,8 @@
\image qtcreator-locator-bookmark-filtering.png "Filtering bookmarks in locator" \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 Bookmarks are listed in the \uicontrol Bookmarks view in the sidebar. To
move between bookmarks, select the \uicontrol {Previous Bookmark} or move between bookmarks, select the \uicontrol {Previous Bookmark} or
\uicontrol {Next Bookmark} button or use the keyboard shortcuts. \uicontrol {Next Bookmark} button or use the keyboard shortcuts.

View File

@@ -114,7 +114,11 @@
\uicontrol Library > \uicontrol {Assets} displays the images and other files \uicontrol Library > \uicontrol {Assets} displays the images and other files
that you add to the project folder by selecting \inlineimage plus.png 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" \image qtquick-assets-tab.png "Library view Assets tab"

View File

@@ -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 install_name_tool -add_rpath "@executable_path/../lib" "$libexec_path/clang/bin/clazy-standalone" || exit 1
fi fi
clangbackendArgument="-executable=$libexec_path/clangbackend" clangbackendArgument="-executable=$libexec_path/clangbackend"
clangpchmanagerArgument="-executable=$libexec_path/clangpchmanagerbackend"
clangrefactoringArgument="-executable=$libexec_path/clangrefactoringbackend"
fi fi
#### macdeployqt #### macdeployqt
@@ -173,6 +171,6 @@ if [ ! -d "$app_path/Contents/Frameworks/QtCore.framework" ]; then
"-executable=$libexec_path/cpaster" \ "-executable=$libexec_path/cpaster" \
"${qbsArguments[@]}" \ "${qbsArguments[@]}" \
"$qml2puppetArgument" \ "$qml2puppetArgument" \
"$clangbackendArgument" "$clangpchmanagerArgument" "$clangrefactoringArgument" || exit 1 "$clangbackendArgument" || exit 1
fi fi

View File

@@ -1358,6 +1358,7 @@ class Dumper(DumperBase):
def report(self, stuff): def report(self, stuff):
with self.outputLock: with self.outputLock:
sys.stdout.write("@\n" + stuff + "@\n") sys.stdout.write("@\n" + stuff + "@\n")
sys.stdout.flush()
def reportState(self, state): def reportState(self, state):
self.report('state="%s"' % state) self.report('state="%s"' % state)
@@ -1588,6 +1589,7 @@ class Dumper(DumperBase):
'output = d.hexencode(sys.stdout.getvalue())', 'output = d.hexencode(sys.stdout.getvalue())',
'sys.stdout = origout', 'sys.stdout = origout',
'd.report("output={channel=\"stderr\",data=\" + output + \"}")', 'd.report("output={channel=\"stderr\",data=\" + output + \"}")',
'sys.stdout.flush()',
'if result is False:', 'if result is False:',
' d.reportState("continueafternextstop")', ' d.reportState("continueafternextstop")',
'return True' 'return True'

View File

@@ -91,7 +91,14 @@ Section {
StudioControls.InfinityLoopIndicator { StudioControls.InfinityLoopIndicator {
id: 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: { onInfiniteChanged: {
if (infinityLoopIndicator.infinite === true) if (infinityLoopIndicator.infinite === true)

View File

@@ -81,7 +81,7 @@ Column {
} }
PropertyLabel { PropertyLabel {
text: qsTr("Current") text: qsTr("Current index")
tooltip: qsTr("The index of the current item.") tooltip: qsTr("The index of the current item.")
} }
@@ -90,8 +90,8 @@ Column {
implicitWidth: StudioTheme.Values.twoControlColumnWidth implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth + StudioTheme.Values.actionIndicatorWidth
width: implicitWidth width: implicitWidth
maximumValue: 9999999
minimumValue: -9999999 minimumValue: -9999999
maximumValue: 9999999
decimals: 0 decimals: 0
backendValue: backendValues.currentIndex backendValue: backendValues.currentIndex
} }

View File

@@ -49,7 +49,7 @@ Section {
SectionLayout { SectionLayout {
PropertyLabel { PropertyLabel {
text: qsTr("Highlighted") text: qsTr("Highlight")
tooltip: qsTr("Whether the delegate is highlighted.") tooltip: qsTr("Whether the delegate is highlighted.")
} }

View File

@@ -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 {}
}

View File

@@ -38,7 +38,7 @@ Column {
caption: qsTr("Rectangle") caption: qsTr("Rectangle")
SectionLayout { SectionLayout {
PropertyLabel { text: qsTr("Color") } PropertyLabel { text: qsTr("Fill color") }
ColorEditor { ColorEditor {
backendValue: backendValues.color backendValue: backendValues.color
@@ -57,7 +57,7 @@ Column {
} }
PropertyLabel { PropertyLabel {
text: qsTr("Border") text: qsTr("Border width")
disabledState: !backendValues.border_width.isAvailable disabledState: !backendValues.border_width.isAvailable
} }

View File

@@ -47,7 +47,5 @@ Column {
showStyle: false showStyle: false
} }
PaddingSection { PaddingSection {}
visible: minorQtQuickVersion > 5
}
} }

View File

@@ -48,7 +48,5 @@ Column {
showStyle: false showStyle: false
} }
PaddingSection { PaddingSection {}
visible: minorQtQuickVersion > 5
}
} }

View File

@@ -49,7 +49,5 @@ Column {
showStyle: true showStyle: true
} }
PaddingSection { PaddingSection {}
visible: minorQtQuickVersion > 5
}
} }

View File

@@ -80,8 +80,8 @@ T.AbstractButton {
when: myButton.hovered && myButton.pressed when: myButton.hovered && myButton.pressed
PropertyChanges { PropertyChanges {
target: buttonBackground target: buttonBackground
color: StudioTheme.Values.themeControlBackgroundPressed color: StudioTheme.Values.themeControlBackgroundInteraction
border.color: StudioTheme.Values.themeInteraction border.color: StudioTheme.Values.themeControlOutlineInteraction
} }
}, },
State { State {

View File

@@ -296,7 +296,7 @@ Section {
} }
PropertyLabel { PropertyLabel {
text: qsTr("Letter space") text: qsTr("Letter spacing")
tooltip: qsTr("Letter spacing for the font.") tooltip: qsTr("Letter spacing for the font.")
} }
@@ -316,7 +316,7 @@ Section {
} }
PropertyLabel { PropertyLabel {
text: qsTr("Word space") text: qsTr("Word spacing")
tooltip: qsTr("Word spacing for the font.") tooltip: qsTr("Word spacing for the font.")
} }

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Creator. ** 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 import StudioControls 1.0 as StudioControls
StudioControls.CheckBox { StudioControls.CheckBox {
@@ -43,6 +43,7 @@ StudioControls.CheckBox {
actionIndicator.forceVisible: extFuncLogic.menuVisible actionIndicator.forceVisible: extFuncLogic.menuVisible
labelColor: colorLogic.textColor labelColor: colorLogic.textColor
ColorLogic { ColorLogic {
id: colorLogic id: colorLogic
backendValue: checkBox.backendValue backendValue: checkBox.backendValue

View File

@@ -25,7 +25,6 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import QtGraphicalEffects 1.15 as Effects
import QtQuick.Shapes 1.15 import QtQuick.Shapes 1.15
import QtQuick.Templates 2.15 as T import QtQuick.Templates 2.15 as T
import QtQuickDesignerTheme 1.0 import QtQuickDesignerTheme 1.0
@@ -88,7 +87,7 @@ SecondColumnLayout {
gradientString += "}" gradientString += "}"
var gradientObject = Qt.createQmlObject(gradientString, gradientThumbnail, "test") var gradientObject = Qt.createQmlObject(gradientString, gradientThumbnail, "dynamicGradient")
for (i = 0; i < gradientLine.model.count; i++) { for (i = 0; i < gradientLine.model.count; i++) {
gradientObject.stops[i].color = gradientLine.model.getColor(i) gradientObject.stops[i].color = gradientLine.model.getColor(i)
@@ -123,7 +122,7 @@ SecondColumnLayout {
gradientStr += "}" gradientStr += "}"
var gradientObj = Qt.createQmlObject(gradientStr, shapeGradientThumbnail, "test1") var gradientObj = Qt.createQmlObject(gradientStr, shapeGradientThumbnail, "dynamicShapeGradient")
for (j = 0; j < gradientLine.model.count; j++) { for (j = 0; j < gradientLine.model.count; j++) {
gradientObj.stops[j].color = gradientLine.model.getColor(j) gradientObj.stops[j].color = gradientLine.model.getColor(j)
@@ -235,7 +234,7 @@ SecondColumnLayout {
border.color: StudioTheme.Values.themeControlOutline border.color: StudioTheme.Values.themeControlOutline
border.width: StudioTheme.Values.border border.width: StudioTheme.Values.border
Effects.LinearGradient { Rectangle {
id: gradientThumbnail id: gradientThumbnail
anchors.fill: parent anchors.fill: parent
anchors.margins: StudioTheme.Values.border anchors.margins: StudioTheme.Values.border

View File

@@ -123,12 +123,10 @@ Section {
tooltip: qsTr("Enables or disables the kerning OpenType feature when shaping the text. Disabling this may " + 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.") "improve performance when creating or changing the text, at the expense of some cosmetic features.")
disabledState: !getBackendValue("kerning").isAvailable disabledState: !getBackendValue("kerning").isAvailable
visible: minorQtQuickVersion > 9
} }
SecondColumnLayout { SecondColumnLayout {
CheckBox { CheckBox {
visible: minorQtQuickVersion > 9
text: backendValue.valueToString text: backendValue.valueToString
implicitWidth: StudioTheme.Values.twoControlColumnWidth implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth + 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 " + "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.") "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 disabledState: !getBackendValue("preferShaping").isAvailable
visible: minorQtQuickVersion > 9
} }
SecondColumnLayout { SecondColumnLayout {
CheckBox { CheckBox {
visible: minorQtQuickVersion > 9
text: backendValue.valueToString text: backendValue.valueToString
implicitWidth: StudioTheme.Values.twoControlColumnWidth implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth + StudioTheme.Values.actionIndicatorWidth

View File

@@ -275,7 +275,7 @@ Section {
} }
PropertyLabel { PropertyLabel {
text: qsTr("Letter space") text: qsTr("Letter spacing")
tooltip: qsTr("Letter spacing for the font.") tooltip: qsTr("Letter spacing for the font.")
} }
@@ -295,7 +295,7 @@ Section {
} }
PropertyLabel { PropertyLabel {
text: qsTr("Word space") text: qsTr("Word spacing")
tooltip: qsTr("Word spacing for the font.") 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 " + 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.") "improve performance when creating or changing the text, at the expense of some cosmetic features.")
disabledState: !getBackendValue("kerning").isAvailable disabledState: !getBackendValue("kerning").isAvailable
visible: minorQtQuickVersion > 9
} }
SecondColumnLayout { SecondColumnLayout {
CheckBox { CheckBox {
visible: minorQtQuickVersion > 9
text: backendValue.valueToString text: backendValue.valueToString
implicitWidth: StudioTheme.Values.twoControlColumnWidth implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth + 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 " + "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.") "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 disabledState: !getBackendValue("preferShaping").isAvailable
visible: minorQtQuickVersion > 9
} }
SecondColumnLayout { SecondColumnLayout {
CheckBox { CheckBox {
visible: minorQtQuickVersion > 9
text: backendValue.valueToString text: backendValue.valueToString
implicitWidth: StudioTheme.Values.twoControlColumnWidth implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth + StudioTheme.Values.actionIndicatorWidth

View File

@@ -145,7 +145,7 @@ Rectangle {
target: backgroundCard target: backgroundCard
color:StudioTheme.Values.themeInteraction color:StudioTheme.Values.themeInteraction
border.width: StudioTheme.Values.border border.width: StudioTheme.Values.border
border.color: StudioTheme.Values.themeControlBackgroundPressed border.color: StudioTheme.Values.themeControlOutlineInteraction
} }
} }
] ]

View File

@@ -52,7 +52,7 @@ Row {
if (enumString === "") if (enumString === "")
enumString = root.backendValue.value enumString = root.backendValue.value
root.origin = enumString root.origin = enumString === undefined ? "Center" : enumString
} }
} }

View File

@@ -48,7 +48,7 @@ Rectangle {
states: [ states: [
State { State {
name: "default" name: "default"
when: !mouseArea.containsMouse && !mouseArea.pressed && myControl.origin !== value when: !mouseArea.containsMouse && !mouseArea.pressed && myControl.origin !== root.value
PropertyChanges { PropertyChanges {
target: root target: root
color: StudioTheme.Values.themeTextColorDisabled // TODO color: StudioTheme.Values.themeTextColorDisabled // TODO
@@ -56,7 +56,7 @@ Rectangle {
}, },
State { State {
name: "hover" name: "hover"
when: mouseArea.containsMouse && !mouseArea.pressed && myControl.origin !== value when: mouseArea.containsMouse && !mouseArea.pressed && myControl.origin !== root.value
PropertyChanges { PropertyChanges {
target: root target: root
color: StudioTheme.Values.themeControlBackgroundInteraction // TODO color: StudioTheme.Values.themeControlBackgroundInteraction // TODO
@@ -64,7 +64,7 @@ Rectangle {
}, },
State { State {
name: "press" name: "press"
when: mouseArea.containsPress && myControl.origin !== enumValue when: mouseArea.containsPress && myControl.origin !== root.value
PropertyChanges { PropertyChanges {
target: root target: root
color: StudioTheme.Values.themeControlBackgroundInteraction // TODO color: StudioTheme.Values.themeControlBackgroundInteraction // TODO
@@ -73,7 +73,7 @@ Rectangle {
}, },
State { State {
name: "active" name: "active"
when: myControl.origin === value when: myControl.origin === root.value
PropertyChanges { PropertyChanges {
target: root target: root
color: StudioTheme.Values.themeInteraction color: StudioTheme.Values.themeInteraction

View File

@@ -46,18 +46,18 @@ Item {
implicitHeight: spinBox.height implicitHeight: spinBox.height
onFocusChanged: { onFocusChanged: {
restoreCursor(); restoreCursor()
transaction.end(); transaction.end()
} }
Component.onCompleted: { Component.onCompleted: {
spinBox.enabled = !isBlocked(backendValue.name); spinBox.enabled = backendValue === undefined ? false : !isBlocked(backendValue.name)
} }
Connections { Connections {
target: modelNodeBackend target: modelNodeBackend
function onSelectionChanged() { function onSelectionChanged() {
spinBox.enabled = !isBlocked(backendValue.name); spinBox.enabled = backendValue === undefined ? false : !isBlocked(backendValue.name)
} }
} }
@@ -65,25 +65,25 @@ Item {
id: spinBox id: spinBox
onDragStarted: { onDragStarted: {
hideCursor(); hideCursor()
transaction.start(); transaction.start()
} }
onDragEnded: { onDragEnded: {
restoreCursor(); restoreCursor()
transaction.end(); transaction.end()
} }
onDragging: holdCursorInPlace(); onDragging: holdCursorInPlace()
onRealValueModified: { onRealValueModified: {
if (transaction.active()) if (transaction.active())
commitValue(); commitValue()
} }
function commitValue() { function commitValue() {
if (spinBox.backendValue.value !== spinBox.realValue) if (spinBox.backendValue.value !== spinBox.realValue)
spinBox.backendValue.value = spinBox.realValue; spinBox.backendValue.value = spinBox.realValue
} }
property variant backendValue property variant backendValue

View File

@@ -58,9 +58,7 @@ Rectangle {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onPressed: { onClicked: infinityLoopIndicator.infinite = !infinityLoopIndicator.infinite
infinityLoopIndicator.infinite = !infinityLoopIndicator.infinite
}
} }
states: [ states: [

View File

@@ -17,6 +17,7 @@ add_qtc_executable(qtcreator
MACOSX_BUNDLE ON MACOSX_BUNDLE ON
OUTPUT_NAME "${IDE_APP_TARGET}" OUTPUT_NAME "${IDE_APP_TARGET}"
DESTINATION "${IDE_APP_PATH}" DESTINATION "${IDE_APP_PATH}"
QTC_RUNNABLE
) )
if (NOT TARGET qtcreator) if (NOT TARGET qtcreator)

View File

@@ -213,7 +213,7 @@ public:
std::enable_if_t<!std::is_function_v<ResultType>, ResultType> value(const QueryTypes &...queryValues) std::enable_if_t<!std::is_function_v<ResultType>, ResultType> value(const QueryTypes &...queryValues)
{ {
Resetter resetter{this}; Resetter resetter{this};
ResultType resultValue; ResultType resultValue{};
bindValues(queryValues...); bindValues(queryValues...);

View File

@@ -1,5 +1,3 @@
find_package(QT NAMES Qt5 Qt6)
if (WITH_TESTS) if (WITH_TESTS)
set(TEST_SOURCES set(TEST_SOURCES
runscenegraphtest.cpp runscenegraphtest.h runscenegraphtest.cpp runscenegraphtest.h
@@ -40,7 +38,7 @@ add_qtc_library(Tracing
${TEST_SOURCES} ${TEST_SOURCES}
) )
if(${QT_VERSION} VERSION_LESS "6.2.0") if(${Qt5_VERSION} VERSION_LESS "6.2.0")
extend_qtc_library(Tracing extend_qtc_library(Tracing
SOURCES SOURCES
${TRACING_CPP_SOURCES} ${TRACING_CPP_SOURCES}

View File

@@ -94,7 +94,7 @@ public:
AutotestPluginPrivate(); AutotestPluginPrivate();
~AutotestPluginPrivate() override; ~AutotestPluginPrivate() override;
TestNavigationWidgetFactory *m_navigationWidgetFactory = nullptr; TestNavigationWidgetFactory m_navigationWidgetFactory;
TestResultsPane *m_resultsPane = nullptr; TestResultsPane *m_resultsPane = nullptr;
QMap<QString, ChoicePair> m_runconfigCache; QMap<QString, ChoicePair> m_runconfigCache;
@@ -149,7 +149,6 @@ AutotestPluginPrivate::AutotestPluginPrivate()
m_frameworkManager.registerTestTool(new CTestTool); m_frameworkManager.registerTestTool(new CTestTool);
m_frameworkManager.synchronizeSettings(ICore::settings()); m_frameworkManager.synchronizeSettings(ICore::settings());
m_navigationWidgetFactory = new TestNavigationWidgetFactory;
m_resultsPane = TestResultsPane::instance(); m_resultsPane = TestResultsPane::instance();
auto panelFactory = new ProjectExplorer::ProjectPanelFactory(); auto panelFactory = new ProjectExplorer::ProjectPanelFactory();
@@ -186,7 +185,6 @@ AutotestPluginPrivate::~AutotestPluginPrivate()
s_projectSettings.clear(); s_projectSettings.clear();
} }
delete m_navigationWidgetFactory;
delete m_resultsPane; delete m_resultsPane;
} }
@@ -279,9 +277,9 @@ bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorStri
dd = new AutotestPluginPrivate; dd = new AutotestPluginPrivate;
#ifdef WITH_TESTS #ifdef WITH_TESTS
ExtensionSystem::PluginManager::registerScenario("TestStringTable", ExtensionSystem::PluginManager::registerScenario("TestStringTable",
[this]() { return dd->m_loadProjectScenario(); }); [] { return dd->m_loadProjectScenario(); });
ExtensionSystem::PluginManager::registerScenario("TestModelManagerInterface", ExtensionSystem::PluginManager::registerScenario("TestModelManagerInterface",
[this]() { return dd->m_loadProjectScenario(); }); [] { return dd->m_loadProjectScenario(); });
#endif #endif
return true; return true;
} }

View File

@@ -852,10 +852,12 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
return newDir; return newDir;
if (QDir(oldDir).exists("CMakeCache.txt") && !QDir(newDir).exists("CMakeCache.txt")) { if (QDir(oldDir).exists("CMakeCache.txt") && !QDir(newDir).exists("CMakeCache.txt")) {
if (QMessageBox::information(Core::ICore::dialogParent(), if (QMessageBox::information(
Core::ICore::dialogParent(),
tr("Changing Build Directory"), tr("Changing Build Directory"),
tr("Change the build directory and start with a " tr("Change the build directory to \"%1\" and start with a "
"basic CMake configuration?"), "basic CMake configuration?")
.arg(newDir),
QMessageBox::Ok, QMessageBox::Ok,
QMessageBox::Cancel) QMessageBox::Cancel)
== QMessageBox::Ok) { == QMessageBox::Ok) {

View File

@@ -1009,6 +1009,7 @@ const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
bti.workingDirectory = ct.workingDirectory; bti.workingDirectory = ct.workingDirectory;
bti.buildKey = buildKey; bti.buildKey = buildKey;
bti.usesTerminal = !ct.linksToQtGui; bti.usesTerminal = !ct.linksToQtGui;
bti.isQtcRunnable = ct.qtcRunnable;
// Workaround for QTCREATORBUG-19354: // Workaround for QTCREATORBUG-19354:
bti.runEnvModifier = [this, buildKey](Environment &env, bool enabled) { bti.runEnvModifier = [this, buildKey](Environment &env, bool enabled) {
@@ -1027,7 +1028,7 @@ const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
QStringList CMakeBuildSystem::buildTargetTitles() 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 !CMakeBuildSystem::filteredOutTarget(target);
}); });
return transform(nonAutogenTargets, &CMakeBuildTarget::title); return transform(nonAutogenTargets, &CMakeBuildTarget::title);

View File

@@ -54,6 +54,7 @@ public:
Utils::FilePath executable; // TODO: rename to output? Utils::FilePath executable; // TODO: rename to output?
TargetType targetType = UtilityType; TargetType targetType = UtilityType;
bool linksToQtGui = false; bool linksToQtGui = false;
bool qtcRunnable = true;
Utils::FilePath workingDirectory; Utils::FilePath workingDirectory;
Utils::FilePath sourceDirectory; Utils::FilePath sourceDirectory;
Utils::FilePath makeCommand; Utils::FilePath makeCommand;

View File

@@ -272,7 +272,18 @@ Tasks CMakeKitAspect::validate(const Kit *k) const
void CMakeKitAspect::setup(Kit *k) void CMakeKitAspect::setup(Kit *k)
{ {
CMakeTool *tool = CMakeKitAspect::cmakeTool(k); CMakeTool *tool = CMakeKitAspect::cmakeTool(k);
if (!tool) 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()); setCMakeTool(k, defaultCMakeToolId());
} }

View File

@@ -130,26 +130,28 @@ CMakeManager::CMakeManager()
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
connect(m_buildFileAction, &QAction::triggered, this, [this] { buildFile(); }); connect(m_buildFileAction, &QAction::triggered, this, [this] { buildFile(); });
connect(SessionManager::instance(), &SessionManager::startupProjectChanged, connect(SessionManager::instance(), &SessionManager::startupProjectChanged, this, [this] {
this, &CMakeManager::updateCmakeActions); updateCmakeActions(ProjectTree::currentNode());
connect(BuildManager::instance(), &BuildManager::buildStateChanged, });
this, &CMakeManager::updateCmakeActions); connect(BuildManager::instance(), &BuildManager::buildStateChanged, this, [this] {
updateCmakeActions(ProjectTree::currentNode());
});
connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged, connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged,
this, &CMakeManager::updateBuildFileAction); this, &CMakeManager::updateBuildFileAction);
connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged, connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged,
this, &CMakeManager::updateCmakeActions); this, &CMakeManager::updateCmakeActions);
updateCmakeActions(); updateCmakeActions(ProjectTree::currentNode());
} }
void CMakeManager::updateCmakeActions() void CMakeManager::updateCmakeActions(Node *node)
{ {
auto project = qobject_cast<CMakeProject *>(SessionManager::startupProject()); auto project = qobject_cast<CMakeProject *>(SessionManager::startupProject());
const bool visible = project && !BuildManager::isBuilding(project); const bool visible = project && !BuildManager::isBuilding(project);
m_runCMakeAction->setVisible(visible); m_runCMakeAction->setVisible(visible);
m_clearCMakeCacheAction->setVisible(visible); m_clearCMakeCacheAction->setVisible(visible);
m_rescanProjectAction->setVisible(visible); m_rescanProjectAction->setVisible(visible);
enableBuildFileMenus(ProjectTree::currentNode()); enableBuildFileMenus(node);
} }
void CMakeManager::clearCMakeCache(BuildSystem *buildSystem) void CMakeManager::clearCMakeCache(BuildSystem *buildSystem)

View File

@@ -44,7 +44,7 @@ public:
CMakeManager(); CMakeManager();
private: private:
void updateCmakeActions(); void updateCmakeActions(ProjectExplorer::Node *node);
void clearCMakeCache(ProjectExplorer::BuildSystem *buildSystem); void clearCMakeCache(ProjectExplorer::BuildSystem *buildSystem);
void runCMake(ProjectExplorer::BuildSystem *buildSystem); void runCMake(ProjectExplorer::BuildSystem *buildSystem);
void rescanProject(ProjectExplorer::BuildSystem *buildSystem); void rescanProject(ProjectExplorer::BuildSystem *buildSystem);

View File

@@ -142,9 +142,9 @@ void CMakeProjectPlugin::extensionsInitialized()
CMakeToolManager::restoreCMakeTools(); CMakeToolManager::restoreCMakeTools();
} }
void CMakeProjectPlugin::updateContextActions() void CMakeProjectPlugin::updateContextActions(Node *node)
{ {
auto targetNode = dynamic_cast<const CMakeTargetNode *>(ProjectTree::currentNode()); auto targetNode = dynamic_cast<const CMakeTargetNode *>(node);
const QString targetDisplayName = targetNode ? targetNode->displayName() : QString(); const QString targetDisplayName = targetNode ? targetNode->displayName() : QString();
// Build Target: // Build Target:

View File

@@ -27,6 +27,8 @@
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
namespace ProjectExplorer { class Node; }
namespace CMakeProjectManager { namespace CMakeProjectManager {
namespace Internal { namespace Internal {
@@ -60,7 +62,7 @@ private:
bool initialize(const QStringList &arguments, QString *errorMessage) final; bool initialize(const QStringList &arguments, QString *errorMessage) final;
void extensionsInitialized() final; void extensionsInitialized() final;
void updateContextActions(); void updateContextActions(ProjectExplorer::Node *node);
class CMakeProjectPluginPrivate *d = nullptr; class CMakeProjectPluginPrivate *d = nullptr;
}; };

View File

@@ -109,10 +109,10 @@ public:
, m_name(item->displayName()) , m_name(item->displayName())
, m_executable(item->filePath()) , m_executable(item->filePath())
, m_qchFile(item->qchFilePath()) , m_qchFile(item->qchFilePath())
, m_versionDisplay(item->versionDisplay())
, m_isAutoRun(item->isAutoRun()) , m_isAutoRun(item->isAutoRun())
, m_autodetected(item->isAutoDetected()) , m_autodetected(item->isAutoDetected())
, m_isSupported(item->hasFileApi()) , m_isSupported(item->hasFileApi())
, m_versionDisplay(item->versionDisplay())
, m_changed(changed) , m_changed(changed)
{ {
updateErrorFlags(); updateErrorFlags();

View File

@@ -109,6 +109,9 @@ public:
static Utils::FilePath searchQchFile(const Utils::FilePath &executable); static Utils::FilePath searchQchFile(const Utils::FilePath &executable);
QString detectionSource() const { return m_detectionSource; }
void setDetectionSource(const QString &source) { m_detectionSource = source; }
private: private:
void readInformation() const; void readInformation() const;
@@ -126,6 +129,7 @@ private:
bool m_isAutoRun = true; bool m_isAutoRun = true;
bool m_isAutoDetected = false; bool m_isAutoDetected = false;
QString m_detectionSource;
bool m_autoCreateBuildDirectory = false; bool m_autoCreateBuildDirectory = false;
Utils::optional<ReaderType> m_readerType; Utils::optional<ReaderType> m_readerType;

View File

@@ -177,7 +177,7 @@ void CMakeToolManager::updateDocumentation()
Core::HelpManager::registerDocumentation(docs); 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()); const Id id = Id::fromString(cmakePath.toUserOutput());
@@ -188,6 +188,7 @@ void CMakeToolManager::registerCMakeByPath(const FilePath &cmakePath)
auto newTool = std::make_unique<CMakeTool>(CMakeTool::ManualDetection, id); auto newTool = std::make_unique<CMakeTool>(CMakeTool::ManualDetection, id);
newTool->setFilePath(cmakePath); newTool->setFilePath(cmakePath);
newTool->setDisplayName(cmakePath.toUserOutput()); newTool->setDisplayName(cmakePath.toUserOutput());
newTool->setDetectionSource(detectionSource);
registerCMakeTool(std::move(newTool)); registerCMakeTool(std::move(newTool));
} }

View File

@@ -63,7 +63,7 @@ public:
static void updateDocumentation(); static void updateDocumentation();
public slots: public slots:
void registerCMakeByPath(const Utils::FilePath &cmakePath); void registerCMakeByPath(const Utils::FilePath &cmakePath, const QString &detectionSource);
signals: signals:
void cmakeAdded (const Utils::Id &id); void cmakeAdded (const Utils::Id &id);

View File

@@ -256,6 +256,8 @@ QList<CMakeBuildTarget> generateBuildTargets(const PreprocessedData &input,
|| f.fragment.contains("Qt6Gui")); || f.fragment.contains("Qt6Gui"));
}); });
ct.qtcRunnable = t.folderTargetProperty == "qtc_runnable";
// Extract library directories for executables: // Extract library directories for executables:
for (const FragmentInfo &f : t.link.value().fragments) { for (const FragmentInfo &f : t.link.value().fragments) {
if (f.role == "flags") // ignore all flags fragments if (f.role == "flags") // ignore all flags fragments

View File

@@ -3583,8 +3583,10 @@ protected:
if (i.type()->isNamedType()) { // check if we have to search recursively if (i.type()->isNamedType()) { // check if we have to search recursively
const Name *newName = i.type()->asNamedType()->name(); const Name *newName = i.type()->asNamedType()->name();
Scope *newScope = i.declaration()->enclosingScope(); 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 continue; // we have found the start location of the search
}
return isValueType(newName, newScope, isValueType); return isValueType(newName, newScope, isValueType);
} }
return false; return false;

View File

@@ -308,12 +308,12 @@ void GdbMi::parseList(DebuggerOutputParser &parser)
} }
GdbMi child; GdbMi child;
child.parseResultOrValue(parser); child.parseResultOrValue(parser);
if (child.isValid()) { if (!child.isValid())
break;
m_children.push_back(child); m_children.push_back(child);
parser.skipCommas(); parser.skipCommas();
} }
} }
}
static QString ind(int indent) static QString ind(int indent)
{ {

View File

@@ -491,7 +491,8 @@ void DockerDevicePrivate::autoDetectCMake(QTextBrowser *log)
log->append(tr("Found CMake binary: %1").arg(cmake.toUserOutput())); log->append(tr("Found CMake binary: %1").arg(cmake.toUserOutput()));
const bool res = QMetaObject::invokeMethod(cmakeManager, const bool res = QMetaObject::invokeMethod(cmakeManager,
"registerCMakeByPath", "registerCMakeByPath",
Q_ARG(Utils::FilePath, cmake)); Q_ARG(Utils::FilePath, cmake),
Q_ARG(QString, m_data.id()));
QTC_CHECK(res); QTC_CHECK(res);
} }
} }
@@ -1139,7 +1140,7 @@ public:
QTC_ASSERT(item, return {}); QTC_ASSERT(item, return {});
auto device = DockerDevice::create(*item); 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->setType(Constants::DOCKER_DEVICE_TYPE);
device->setMachineType(IDevice::Hardware); device->setMachineType(IDevice::Hardware);

View File

@@ -136,7 +136,7 @@ void McuSupportPlugin::askUserAboutMcuSupportKitsUpgrade()
static McuSupportOptions::UpgradeOption selectedOption; static McuSupportOptions::UpgradeOption selectedOption;
const QStringList options = { tr("Create new kits"), tr("Replace existing kits") }; const QStringList options = { tr("Create new kits"), tr("Replace existing kits") };
selectedOption = McuSupportOptions::UpgradeOption::Keep; selectedOption = McuSupportOptions::UpgradeOption::Keep;
info.setComboInfo(options, [upgradeMcuSupportKits, options](const QString &selected) { info.setComboInfo(options, [options](const QString &selected) {
selectedOption = options.indexOf(selected) == 0 ? selectedOption = options.indexOf(selected) == 0 ?
McuSupportOptions::UpgradeOption::Keep : McuSupportOptions::UpgradeOption::Keep :
McuSupportOptions::UpgradeOption::Replace; McuSupportOptions::UpgradeOption::Replace;

View File

@@ -403,7 +403,7 @@ class ProjectExplorerPluginPrivate : public QObject
public: public:
ProjectExplorerPluginPrivate(); ProjectExplorerPluginPrivate();
void updateContextMenuActions(); void updateContextMenuActions(Node *currentNode);
void updateLocationSubMenus(); void updateLocationSubMenus();
void executeRunConfiguration(RunConfiguration *, Utils::Id mode); void executeRunConfiguration(RunConfiguration *, Utils::Id mode);
QPair<bool, QString> buildSettingsEnabledForSession(); QPair<bool, QString> buildSettingsEnabledForSession();
@@ -767,10 +767,12 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
}); });
ProjectTree *tree = &dd->m_projectTree; ProjectTree *tree = &dd->m_projectTree;
connect(tree, &ProjectTree::currentProjectChanged, connect(tree, &ProjectTree::currentProjectChanged, dd, [] {
dd, &ProjectExplorerPluginPrivate::updateContextMenuActions); dd->updateContextMenuActions(ProjectTree::currentNode());
connect(tree, &ProjectTree::nodeActionsChanged, });
dd, &ProjectExplorerPluginPrivate::updateContextMenuActions); connect(tree, &ProjectTree::nodeActionsChanged, dd, [] {
dd->updateContextMenuActions(ProjectTree::currentNode());
});
connect(tree, &ProjectTree::currentNodeChanged, connect(tree, &ProjectTree::currentNodeChanged,
dd, &ProjectExplorerPluginPrivate::updateContextMenuActions); dd, &ProjectExplorerPluginPrivate::updateContextMenuActions);
connect(tree, &ProjectTree::currentProjectChanged, connect(tree, &ProjectTree::currentProjectChanged,
@@ -1763,8 +1765,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(this, &ProjectExplorerPlugin::settingsChanged, connect(this, &ProjectExplorerPlugin::settingsChanged,
dd, &ProjectExplorerPluginPrivate::updateRunWithoutDeployMenu); dd, &ProjectExplorerPluginPrivate::updateRunWithoutDeployMenu);
connect(ICore::instance(), &ICore::newItemDialogStateChanged, connect(ICore::instance(), &ICore::newItemDialogStateChanged, dd, [] {
dd, &ProjectExplorerPluginPrivate::updateContextMenuActions); dd->updateContextMenuActions(ProjectTree::currentNode());
});
dd->updateWelcomePage(); dd->updateWelcomePage();
@@ -3257,7 +3260,7 @@ void ProjectExplorerPluginPrivate::invalidateProject(Project *project)
updateActions(); updateActions();
} }
void ProjectExplorerPluginPrivate::updateContextMenuActions() void ProjectExplorerPluginPrivate::updateContextMenuActions(Node *currentNode)
{ {
m_addExistingFilesAction->setEnabled(false); m_addExistingFilesAction->setEnabled(false);
m_addExistingDirectoryAction->setEnabled(false); m_addExistingDirectoryAction->setEnabled(false);
@@ -3294,8 +3297,6 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions()
runMenu->menu()->clear(); runMenu->menu()->clear();
runMenu->menu()->menuAction()->setVisible(false); runMenu->menu()->menuAction()->setVisible(false);
const Node *currentNode = ProjectTree::currentNode();
if (currentNode && currentNode->managingProject()) { if (currentNode && currentNode->managingProject()) {
ProjectNode *pn; ProjectNode *pn;
if (const ContainerNode *cn = currentNode->asContainerNode()) if (const ContainerNode *cn = currentNode->asContainerNode())

View File

@@ -227,7 +227,7 @@ void ProjectTree::setCurrent(Node *node, Project *project)
if (node != m_currentNode) { if (node != m_currentNode) {
m_currentNode = node; m_currentNode = node;
emit currentNodeChanged(); emit currentNodeChanged(node);
} }
if (changedProject) { if (changedProject) {

View File

@@ -104,7 +104,7 @@ public:
signals: signals:
void currentProjectChanged(ProjectExplorer::Project *project); void currentProjectChanged(ProjectExplorer::Project *project);
void currentNodeChanged(); void currentNodeChanged(Node *node);
void nodeActionsChanged(); void nodeActionsChanged();
// Emitted whenever the model needs to send a update signal. // Emitted whenever the model needs to send a update signal.

View File

@@ -154,11 +154,6 @@ QString QbsProfileManager::ensureProfileForKit(const ProjectExplorer::Kit *k)
return profileNameForKit(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) void QbsProfileManager::updateProfileIfNecessary(const ProjectExplorer::Kit *kit)
{ {
// kit in list <=> profile update is necessary // kit in list <=> profile update is necessary
@@ -173,29 +168,11 @@ void QbsProfileManager::updateAllProfiles()
addProfileFromKit(kit); 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) void QbsProfileManager::addProfileFromKit(const ProjectExplorer::Kit *k)
{ {
const QString name = profileNameForKit(k); const QString name = profileNameForKit(k);
runQbsConfig(QbsConfigOp::Unset, "profiles." + name); runQbsConfig(QbsConfigOp::Unset, "profiles." + name);
setProfileForKit(name, k); runQbsConfig(QbsConfigOp::Set, kitNameKeyInQbsSettings(k), name);
addQtProfileFromKit(name, k);
// set up properties: // set up properties:
QVariantMap data = m_defaultPropertyProvider->properties(k, QVariantMap()); QVariantMap data = m_defaultPropertyProvider->properties(k, QVariantMap());
@@ -203,8 +180,17 @@ void QbsProfileManager::addProfileFromKit(const ProjectExplorer::Kit *k)
if (provider->canHandle(k)) if (provider->canHandle(k))
data = provider->properties(k, data); 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) void QbsProfileManager::handleKitUpdate(ProjectExplorer::Kit *kit)
@@ -246,6 +232,13 @@ QString QbsProfileManager::runQbsConfig(QbsConfigOp op, const QString &key, cons
case QbsConfigOp::Unset: case QbsConfigOp::Unset:
args << "--unset" << key; args << "--unset" << key;
break; 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(); const Utils::FilePath qbsExe = QbsSettings::qbsExecutableFilePath();
if (qbsExe.isEmpty() || !qbsExe.exists()) if (qbsExe.isEmpty() || !qbsExe.exists())

View File

@@ -52,15 +52,13 @@ public:
static QString ensureProfileForKit(const ProjectExplorer::Kit *k); static QString ensureProfileForKit(const ProjectExplorer::Kit *k);
static QString profileNameForKit(const ProjectExplorer::Kit *kit); static QString profileNameForKit(const ProjectExplorer::Kit *kit);
static void updateProfileIfNecessary(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: signals:
void qbsProfilesUpdated(); void qbsProfilesUpdated();
private: 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 addProfileFromKit(const ProjectExplorer::Kit *k);
void updateAllProfiles(); void updateAllProfiles();

View File

@@ -262,7 +262,7 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString *
}); });
// Run initial setup routines // Run initial setup routines
updateContextActions(); updateContextActions(ProjectTree::currentNode());
updateReparseQbsAction(); updateReparseQbsAction();
updateBuildActions(); updateBuildActions();
@@ -280,10 +280,9 @@ void QbsProjectManagerPlugin::targetWasAdded(Target *target)
this, &QbsProjectManagerPlugin::projectChanged); this, &QbsProjectManagerPlugin::projectChanged);
} }
void QbsProjectManagerPlugin::updateContextActions() void QbsProjectManagerPlugin::updateContextActions(Node *node)
{ {
auto project = qobject_cast<Internal::QbsProject *>(ProjectTree::currentProject()); auto project = qobject_cast<Internal::QbsProject *>(ProjectTree::currentProject());
const Node *node = ProjectTree::currentNode();
bool isEnabled = !BuildManager::isBuilding(project) bool isEnabled = !BuildManager::isBuilding(project)
&& project && project->activeTarget() && project && project->activeTarget()
&& !project->activeTarget()->buildSystem()->isParsing() && !project->activeTarget()->buildSystem()->isParsing()
@@ -369,7 +368,7 @@ void QbsProjectManagerPlugin::projectChanged()
updateReparseQbsAction(); updateReparseQbsAction();
if (!project || project == ProjectTree::currentProject()) if (!project || project == ProjectTree::currentProject())
updateContextActions(); updateContextActions(ProjectTree::currentNode());
if (!project || project == currentEditorProject()) if (!project || project == currentEditorProject())
updateBuildActions(); updateBuildActions();

View File

@@ -29,7 +29,10 @@
#include <utils/id.h> #include <utils/id.h>
#include <utils/parameteraction.h> #include <utils/parameteraction.h>
namespace ProjectExplorer { class Target; } namespace ProjectExplorer {
class Target;
class Node;
} // namespace ProjectExplorer
namespace QbsProjectManager { namespace QbsProjectManager {
namespace Internal { namespace Internal {
@@ -72,7 +75,7 @@ private:
void reparseCurrentProject(); void reparseCurrentProject();
void reparseProject(QbsProject *project); void reparseProject(QbsProject *project);
void updateContextActions(); void updateContextActions(ProjectExplorer::Node *node);
void updateReparseQbsAction(); void updateReparseQbsAction();
void updateBuildActions(); void updateBuildActions();

View File

@@ -49,6 +49,19 @@ const char QBS_EXE_KEY[] = "QbsProjectManager/QbsExecutable";
const char QBS_DEFAULT_INSTALL_DIR_KEY[] = "QbsProjectManager/DefaultInstallDir"; const char QBS_DEFAULT_INSTALL_DIR_KEY[] = "QbsProjectManager/DefaultInstallDir";
const char USE_CREATOR_SETTINGS_KEY[] = "QbsProjectManager/useCreatorDir"; 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) static bool operator==(const QbsSettingsData &s1, const QbsSettingsData &s2)
{ {
return s1.qbsExecutableFilePath == s2.qbsExecutableFilePath return s1.qbsExecutableFilePath == s2.qbsExecutableFilePath
@@ -88,6 +101,14 @@ QString QbsSettings::qbsSettingsBaseDir()
return useCreatorSettingsDirForQbs() ? Core::ICore::userResourcePath().toString() : QString(); 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() QbsSettings &QbsSettings::instance()
{ {
static QbsSettings theSettings; static QbsSettings theSettings;
@@ -140,7 +161,7 @@ public:
m_qbsExePathChooser.setExpectedKind(PathChooser::ExistingCommand); m_qbsExePathChooser.setExpectedKind(PathChooser::ExistingCommand);
m_qbsExePathChooser.setFilePath(QbsSettings::qbsExecutableFilePath()); m_qbsExePathChooser.setFilePath(QbsSettings::qbsExecutableFilePath());
m_defaultInstallDirLineEdit.setText(QbsSettings::defaultInstallDirTemplate()); m_defaultInstallDirLineEdit.setText(QbsSettings::defaultInstallDirTemplate());
m_versionLabel.setText(getQbsVersion()); m_versionLabel.setText(getQbsVersionString());
m_settingsDirCheckBox.setText(tr("Use %1 settings directory for Qbs") m_settingsDirCheckBox.setText(tr("Use %1 settings directory for Qbs")
.arg(Core::Constants::IDE_DISPLAY_NAME)); .arg(Core::Constants::IDE_DISPLAY_NAME));
m_settingsDirCheckBox.setChecked(QbsSettings::useCreatorSettingsDirForQbs()); m_settingsDirCheckBox.setChecked(QbsSettings::useCreatorSettingsDirForQbs());
@@ -150,6 +171,10 @@ public:
layout->addRow(tr("Path to qbs executable:"), &m_qbsExePathChooser); layout->addRow(tr("Path to qbs executable:"), &m_qbsExePathChooser);
layout->addRow(tr("Default installation directory:"), &m_defaultInstallDirLineEdit); layout->addRow(tr("Default installation directory:"), &m_defaultInstallDirLineEdit);
layout->addRow(tr("Qbs version:"), &m_versionLabel); layout->addRow(tr("Qbs version:"), &m_versionLabel);
connect(&m_qbsExePathChooser, &PathChooser::pathChanged, [this] {
m_versionLabel.setText(getQbsVersionString());
});
} }
void apply() void apply()
@@ -159,22 +184,15 @@ public:
settings.qbsExecutableFilePath = m_qbsExePathChooser.filePath(); settings.qbsExecutableFilePath = m_qbsExePathChooser.filePath();
settings.defaultInstallDirTemplate = m_defaultInstallDirLineEdit.text(); settings.defaultInstallDirTemplate = m_defaultInstallDirLineEdit.text();
settings.useCreatorSettings = m_settingsDirCheckBox.isChecked(); settings.useCreatorSettings = m_settingsDirCheckBox.isChecked();
settings.qbsVersion = {};
QbsSettings::setSettingsData(settings); QbsSettings::setSettingsData(settings);
} }
private: private:
static QString getQbsVersion() QString getQbsVersionString()
{ {
const FilePath qbsExe = QbsSettings::qbsExecutableFilePath(); const QString version = getQbsVersion(m_qbsExePathChooser.filePath());
if (qbsExe.isEmpty() || !qbsExe.exists()) return version.isEmpty() ? tr("Failed to retrieve version.") : version;
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();
} }
PathChooser m_qbsExePathChooser; PathChooser m_qbsExePathChooser;

View File

@@ -30,6 +30,7 @@
#include <QObject> #include <QObject>
#include <QPointer> #include <QPointer>
#include <QVersionNumber>
namespace QbsProjectManager { namespace QbsProjectManager {
namespace Internal { namespace Internal {
@@ -38,6 +39,7 @@ class QbsSettingsData {
public: public:
Utils::FilePath qbsExecutableFilePath; Utils::FilePath qbsExecutableFilePath;
QString defaultInstallDirTemplate; QString defaultInstallDirTemplate;
QVersionNumber qbsVersion; // Ephemeral
bool useCreatorSettings = true; bool useCreatorSettings = true;
}; };
@@ -52,6 +54,7 @@ public:
static QString defaultInstallDirTemplate(); static QString defaultInstallDirTemplate();
static bool useCreatorSettingsDirForQbs(); static bool useCreatorSettingsDirForQbs();
static QString qbsSettingsBaseDir(); static QString qbsSettingsBaseDir();
static QVersionNumber qbsVersion();
static void setSettingsData(const QbsSettingsData &settings); static void setSettingsData(const QbsSettingsData &settings);
static QbsSettingsData rawSettingsData(); static QbsSettingsData rawSettingsData();

View File

@@ -86,7 +86,7 @@ public:
void activeTargetChanged(); void activeTargetChanged();
void updateActions(); void updateActions();
void updateRunQMakeAction(); void updateRunQMakeAction();
void updateContextActions(); void updateContextActions(Node *node);
void buildStateChanged(Project *pro); void buildStateChanged(Project *pro);
void updateBuildFileAction(); void updateBuildFileAction();
void disableBuildFileMenus(); void disableBuildFileMenus();
@@ -496,7 +496,7 @@ void QmakeProjectManagerPluginPrivate::activeTargetChanged()
void QmakeProjectManagerPluginPrivate::updateActions() void QmakeProjectManagerPluginPrivate::updateActions()
{ {
updateRunQMakeAction(); updateRunQMakeAction();
updateContextActions(); updateContextActions(ProjectTree::currentNode());
} }
void QmakeProjectManagerPluginPrivate::updateRunQMakeAction() void QmakeProjectManagerPluginPrivate::updateRunQMakeAction()
@@ -515,9 +515,8 @@ void QmakeProjectManagerPluginPrivate::updateRunQMakeAction()
m_runQMakeAction->setEnabled(enable); m_runQMakeAction->setEnabled(enable);
} }
void QmakeProjectManagerPluginPrivate::updateContextActions() void QmakeProjectManagerPluginPrivate::updateContextActions(Node *node)
{ {
const Node *node = ProjectTree::currentNode();
Project *project = ProjectTree::currentProject(); Project *project = ProjectTree::currentProject();
const ContainerNode *containerNode = node ? node->asContainerNode() : nullptr; const ContainerNode *containerNode = node ? node->asContainerNode() : nullptr;
@@ -578,7 +577,7 @@ void QmakeProjectManagerPluginPrivate::buildStateChanged(Project *pro)
{ {
if (pro == ProjectTree::currentProject()) { if (pro == ProjectTree::currentProject()) {
updateRunQMakeAction(); updateRunQMakeAction();
updateContextActions(); updateContextActions(ProjectTree::currentNode());
updateBuildFileAction(); updateBuildFileAction();
} }
} }

View File

@@ -43,10 +43,9 @@ AnnotationEditorDialog::AnnotationEditorDialog(QWidget *parent,
const QString &targetId, const QString &targetId,
const QString &customId) const QString &customId)
: QDialog(parent) : QDialog(parent)
, m_defaults(std::make_unique<DefaultAnnotationsModel>())
, m_customId(customId)
, ui(std::make_unique<Ui::AnnotationEditorDialog>()) , ui(std::make_unique<Ui::AnnotationEditorDialog>())
, m_statusIsActive(false) , m_customId(customId)
, m_defaults(std::make_unique<DefaultAnnotationsModel>())
{ {
ui->setupUi(this); ui->setupUi(this);
setGlobal(m_isGlobal); setGlobal(m_isGlobal);

View File

@@ -515,6 +515,7 @@ void DebugView::currentStateChanged(const ModelNode &/*node*/)
void DebugView::nodeOrderChanged(const NodeListProperty &listProperty) void DebugView::nodeOrderChanged(const NodeListProperty &listProperty)
{ {
Q_UNUSED(listProperty)
if (isDebugViewEnabled()) { if (isDebugViewEnabled()) {
QTextStream message; QTextStream message;
QString string; QString string;

View File

@@ -60,7 +60,6 @@ const int startItemOffset = 96;
const qreal labelFontSize = 10; const qreal labelFontSize = 10;
const qreal labelShowThreshold = 0.25; // Everything lower than that will hide all labels const qreal labelShowThreshold = 0.25; // Everything lower than that will hide all labels
const qreal defaultDpi = 96.0;
void drawIcon(QPainter *painter, void drawIcon(QPainter *painter,
int x, int x,

View File

@@ -420,6 +420,8 @@ void TimelineView::customNotification(const AbstractView * /*view*/,
const QList<ModelNode> &nodeList, const QList<ModelNode> &nodeList,
const QList<QVariant> &data) const QList<QVariant> &data)
{ {
Q_UNUSED(nodeList)
Q_UNUSED(data)
if (identifier == QStringLiteral("reset QmlPuppet")) { if (identifier == QStringLiteral("reset QmlPuppet")) {
QmlTimeline timeline = widget()->graphicsScene()->currentTimeline(); QmlTimeline timeline = widget()->graphicsScene()->currentTimeline();
if (timeline.isValid()) if (timeline.isValid())

View File

@@ -63,7 +63,7 @@
namespace QmlDesigner { namespace QmlDesigner {
QTableWidget* GenerateResource::createFilesTable(const QStringList &fileNames) QTableWidget* GenerateResource::createFilesTable(const QList<ResourceFile> &fileNames)
{ {
auto table = new QTableWidget(0, 1); auto table = new QTableWidget(0, 1);
table->setSelectionMode(QAbstractItemView::SingleSelection); table->setSelectionMode(QAbstractItemView::SingleSelection);
@@ -74,12 +74,19 @@ QTableWidget* GenerateResource::createFilesTable(const QStringList &fileNames)
table->verticalHeader()->hide(); table->verticalHeader()->hide();
table->setShowGrid(false); 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(); auto checkboxItem = new QTableWidgetItem();
checkboxItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); checkboxItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
checkboxItem->setCheckState(Qt::Checked); checkboxItem->setCheckState(Qt::Checked);
checkboxItem->setText(filePath); checkboxItem->setText(filePath);
if (resource.inProject)
checkboxItem->setFont(font);
int row = table->rowCount(); int row = table->rowCount();
table->insertRow(row); table->insertRow(row);
table->setItem(row, 0, checkboxItem); table->setItem(row, 0, checkboxItem);
@@ -88,7 +95,7 @@ QTableWidget* GenerateResource::createFilesTable(const QStringList &fileNames)
return table; return table;
} }
QStringList GenerateResource::getFileList(const QStringList &fileNames) QStringList GenerateResource::getFileList(const QList<ResourceFile> &fileNames)
{ {
QStringList result; QStringList result;
QDialog *dialog = new QDialog(Core::ICore::dialogParent()); QDialog *dialog = new QDialog(Core::ICore::dialogParent());
@@ -141,19 +148,189 @@ void GenerateResource::generateMenuEntry()
Core::ActionContainer *buildMenu = Core::ActionContainer *buildMenu =
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT); Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT);
const Core::Context projectContext(QmlProjectManager::Constants::QML_PROJECT_ID); const Core::Context projectContext(QmlProjectManager::Constants::QML_PROJECT_ID);
// ToDo: move this to QtCreator and add tr to the string then // 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); action->setEnabled(ProjectExplorer::SessionManager::startupProject() != nullptr);
// todo make it more intelligent when it gets enabled // 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()); action->setEnabled(ProjectExplorer::SessionManager::startupProject());
}); });
Core::Command *cmd = Core::ActionManager::registerAction(action, "QmlProject.CreateResource"); Core::Command *cmd = Core::ActionManager::registerAction(action, "QmlProject.CreateResource");
QObject::connect(action, &QAction::triggered, [] () { QObject::connect(action, &QAction::triggered, [] () {
auto currentProject = ProjectExplorer::SessionManager::startupProject(); auto currentProject = ProjectExplorer::SessionManager::startupProject();
QTC_ASSERT(currentProject, return);
auto projectPath = currentProject->projectFilePath().parentDir().toString();
static QMap<QString, QString> lastUsedPathes;
auto saveLastUsedPath = [currentProject] (const QString &lastUsedPath) {
lastUsedPathes.insert(currentProject->displayName(), lastUsedPath);
};
saveLastUsedPath(lastUsedPathes.value(currentProject->displayName(),
currentProject->projectFilePath().parentDir().parentDir().toString()));
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(
currentProject->activeTarget()->kit());
QString rccBinary = qtVersion->rccCommand();
Utils::QtcProcess rccProcess;
rccProcess.setWorkingDirectory(projectPath);
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(temp.fileName()));
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;
}
}
if (!temp.open())
return;
QXmlStreamReader reader(&temp);
QList<ResourceFile> fileList = {};
QByteArray firstLine = temp.readLine();
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;
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</RCC>\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(); auto projectPath = currentProject->projectFilePath().parentDir().toString();
static QMap<QString, QString> lastUsedPathes; static QMap<QString, QString> lastUsedPathes;
@@ -164,9 +341,11 @@ void GenerateResource::generateMenuEntry()
currentProject->projectFilePath().parentDir().parentDir().toString())); currentProject->projectFilePath().parentDir().parentDir().toString()));
auto resourceFileName = Core:: DocumentManager::getSaveFileName( auto resourceFileName = Core:: DocumentManager::getSaveFileName(
QCoreApplication::translate("QmlDesigner::GenerateResource", "Save Project as Resource"), QCoreApplication::translate("QmlDesigner::GenerateResource",
lastUsedPathes.value(currentProject->displayName()) + "/" + currentProject->displayName() + ".qmlrc", "Save Project as Resource"), lastUsedPathes.value(currentProject->displayName())
QCoreApplication::translate("QmlDesigner::GenerateResource", "QML Resource File (*.qmlrc)")); + "/" + currentProject->displayName() + ".qmlrc",
QCoreApplication::translate("QmlDesigner::GenerateResource",
"QML Resource File (*.qmlrc);;Resource File (*.rcc)"));
if (resourceFileName.isEmpty()) if (resourceFileName.isEmpty())
return; return;
@@ -175,10 +354,9 @@ void GenerateResource::generateMenuEntry()
"Generate a resource file out of project %1 to %2") "Generate a resource file out of project %1 to %2")
.arg(currentProject->displayName(), QDir::toNativeSeparators(resourceFileName))); .arg(currentProject->displayName(), QDir::toNativeSeparators(resourceFileName)));
QString projectFileName = currentProject->displayName() + ".qrc";
QFile persistentFile(projectPath + "/" + projectFileName);
QTemporaryFile temp(projectPath + "/XXXXXXX.create.resource.qrc"); QTemporaryFile temp(projectPath + "/XXXXXXX.create.resource.qrc");
if (!temp.open())
return;
temp.close();
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion( QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion(
currentProject->activeTarget()->kit()); currentProject->activeTarget()->kit());
@@ -187,6 +365,14 @@ void GenerateResource::generateMenuEntry()
Utils::QtcProcess rccProcess; Utils::QtcProcess rccProcess;
rccProcess.setWorkingDirectory(projectPath); rccProcess.setWorkingDirectory(projectPath);
QXmlStreamReader reader;
QByteArray firstLine;
if (!QFileInfo(persistentFile).exists()) {
if (!temp.open())
return;
temp.close();
const QStringList arguments1 = {"--project", "--output", temp.fileName()}; const QStringList arguments1 = {"--project", "--output", temp.fileName()};
for (const auto &arguments : {arguments1}) { for (const auto &arguments : {arguments1}) {
@@ -209,9 +395,9 @@ void GenerateResource::generateMenuEntry()
.arg(rccBinary + " " + arguments.join(" "))); .arg(rccBinary + " " + arguments.join(" ")));
return; return;
} }
if (!stdOut.trimmed().isEmpty()) { if (!stdOut.trimmed().isEmpty())
Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdOut)); Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdOut));
}
if (!stdErr.trimmed().isEmpty()) if (!stdErr.trimmed().isEmpty())
Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdErr)); Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdErr));
@@ -229,15 +415,23 @@ void GenerateResource::generateMenuEntry()
.arg(rccProcess.exitCode())); .arg(rccProcess.exitCode()));
return; return;
} }
} }
reader.setDevice(&temp);
if (!temp.open()) if (!temp.open())
return; return;
firstLine = temp.readLine();
QXmlStreamReader reader(&temp); } else {
QStringList fileList = {}; reader.setDevice(&persistentFile);
QByteArray firstLine = temp.readLine(); if (!persistentFile.open(QIODevice::ReadWrite))
return;
firstLine = persistentFile.readLine();
}
QList<ResourceFile> fileList = {};
while (!reader.atEnd()) { while (!reader.atEnd()) {
const auto token = reader.readNext(); const auto token = reader.readNext();
@@ -247,12 +441,51 @@ void GenerateResource::generateMenuEntry()
if (reader.name() == QLatin1String("file")) { if (reader.name() == QLatin1String("file")) {
QString fileName = reader.readElementText().trimmed(); QString fileName = reader.readElementText().trimmed();
if ((!fileName.startsWith("./.")) && (!fileName.startsWith("./XXXXXXX"))) if ((!fileName.startsWith("./.")) && (!fileName.startsWith("./XXXXXXX"))
fileList.append(fileName); && !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(); temp.close();
persistentFile.close();
QStringList modifiedList = getFileList(fileList); QStringList modifiedList = getFileList(fileList);
QTemporaryFile tempFile(projectPath + "/XXXXXXX.create.modifiedresource.qrc"); QTemporaryFile tempFile(projectPath + "/XXXXXXX.create.modifiedresource.qrc");
@@ -266,14 +499,15 @@ void GenerateResource::generateMenuEntry()
tempFile.write(firstLine.trimmed()); tempFile.write(firstLine.trimmed());
writer.writeStartElement("qresource"); writer.writeStartElement("qresource");
for (int i = 0; i < modifiedList.count(); ++i) for (QString file : modifiedList)
writer.writeTextElement("file", modifiedList.at(i).trimmed()); writer.writeTextElement("file", file.trimmed());
writer.writeEndElement(); writer.writeEndElement();
tempFile.write("\n</RCC>\n"); tempFile.write("\n</RCC>\n");
tempFile.close(); tempFile.close();
const QStringList arguments2 = {"--binary", "--output", resourceFileName, tempFile.fileName()}; const QStringList arguments2 = {"--binary", "--output", resourceFileName,
tempFile.fileName()};
for (const auto &arguments : {arguments2}) { for (const auto &arguments : {arguments2}) {
rccProcess.setCommand({rccBinary, arguments}); rccProcess.setCommand({rccBinary, arguments});
@@ -296,9 +530,9 @@ void GenerateResource::generateMenuEntry()
return; return;
} }
if (!stdOut.trimmed().isEmpty()) { if (!stdOut.trimmed().isEmpty())
Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdOut)); Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdOut));
}
if (!stdErr.trimmed().isEmpty()) if (!stdErr.trimmed().isEmpty())
Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdErr)); Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdErr));
@@ -322,6 +556,7 @@ void GenerateResource::generateMenuEntry()
saveLastUsedPath(Utils::FilePath::fromString(resourceFileName).parentDir().toString()); saveLastUsedPath(Utils::FilePath::fromString(resourceFileName).parentDir().toString());
}); });
buildMenu->addAction(cmd, ProjectExplorer::Constants::G_BUILD_RUN); buildMenu->addAction(cmd, ProjectExplorer::Constants::G_BUILD_RUN);
buildMenu->addAction(cmd2, ProjectExplorer::Constants::G_BUILD_RUN);
} }
} // namespace QmlDesigner } // namespace QmlDesigner

View File

@@ -28,8 +28,13 @@
namespace QmlDesigner { namespace QmlDesigner {
namespace GenerateResource { namespace GenerateResource {
struct ResourceFile
{
QString fileName;
bool inProject;
};
void generateMenuEntry(); void generateMenuEntry();
QStringList getFileList(const QStringList &); QStringList getFileList(const QList<ResourceFile> &);
QTableWidget* createFilesTable(const QStringList &); QTableWidget* createFilesTable(const QList<ResourceFile> &);
} }
} // namespace QmlDesigner } // namespace QmlDesigner

View File

@@ -236,8 +236,7 @@ QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent)
Core::ActionManager::registerAction(action, "QmlPreview.PreviewFile", Core::Context(Constants::C_PROJECT_TREE)), Core::ActionManager::registerAction(action, "QmlPreview.PreviewFile", Core::Context(Constants::C_PROJECT_TREE)),
Constants::G_FILE_OTHER); Constants::G_FILE_OTHER);
action->setVisible(false); action->setVisible(false);
connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged, action, [action]() { connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged, action, [action](Node *node) {
const Node *node = ProjectTree::currentNode();
const FileNode *fileNode = node ? node->asFileNode() : nullptr; const FileNode *fileNode = node ? node->asFileNode() : nullptr;
action->setVisible(fileNode ? fileNode->fileType() == FileType::QML : false); action->setVisible(fileNode ? fileNode->fileType() == FileType::QML : false);
}); });

View File

@@ -516,9 +516,11 @@ Tasks BaseQtVersion::validateKit(const Kit *k)
return result; return result;
const Id dt = DeviceTypeKitAspect::deviceTypeId(k); const Id dt = DeviceTypeKitAspect::deviceTypeId(k);
if (dt != "DockerDeviceType") {
const QSet<Id> tdt = targetDeviceTypes(); const QSet<Id> tdt = targetDeviceTypes();
if (!tdt.isEmpty() && !tdt.contains(dt)) if (!tdt.isEmpty() && !tdt.contains(dt))
result << BuildSystemTask(Task::Warning, tr("Device type is not supported by Qt version.")); result << BuildSystemTask(Task::Warning, tr("Device type is not supported by Qt version."));
}
if (ToolChain *tc = ToolChainKitAspect::cxxToolChain(k)) { if (ToolChain *tc = ToolChainKitAspect::cxxToolChain(k)) {
Abi targetAbi = tc->targetAbi(); Abi targetAbi = tc->targetAbi();

View File

@@ -132,7 +132,7 @@ public:
void copyPathContextMenu(); void copyPathContextMenu();
void copyUrlContextMenu(); void copyUrlContextMenu();
void updateContextActions(); void updateContextActions(Node *node);
ResourceEditorW * currentEditor() const; ResourceEditorW * currentEditor() const;
@@ -368,9 +368,8 @@ void ResourceEditorPluginPrivate::renamePrefixContextMenu()
node->renamePrefix(prefix, dialog.lang()); node->renamePrefix(prefix, dialog.lang());
} }
void ResourceEditorPluginPrivate::updateContextActions() void ResourceEditorPluginPrivate::updateContextActions(Node *node)
{ {
const Node *node = ProjectTree::currentNode();
const bool isResourceNode = dynamic_cast<const ResourceTopLevelNode *>(node); const bool isResourceNode = dynamic_cast<const ResourceTopLevelNode *>(node);
m_addPrefix->setEnabled(isResourceNode); m_addPrefix->setEnabled(isResourceNode);
m_addPrefix->setVisible(isResourceNode); m_addPrefix->setVisible(isResourceNode);

View File

@@ -195,7 +195,7 @@ public:
connect(checkout, connect(checkout,
&ExampleCheckout::finishedSucessfully, &ExampleCheckout::finishedSucessfully,
this, this,
[checkout, this, formFile, example]() { [checkout, formFile, example]() {
const QString projectFile = checkout->extractionFolder() + "/" + example const QString projectFile = checkout->extractionFolder() + "/" + example
+ "/" + example + ".qmlproject"; + "/" + example + ".qmlproject";

View File

@@ -48,6 +48,18 @@ using namespace QMakeInternal;
IoUtils::FileType IoUtils::fileType(const QString &fileName) 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)); Q_ASSERT(fileName.isEmpty() || isAbsolutePath(fileName));
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
DWORD attr = GetFileAttributesW((WCHAR*)fileName.utf16()); DWORD attr = GetFileAttributesW((WCHAR*)fileName.utf16());

View File

@@ -1482,7 +1482,6 @@ TEST_F(SqliteStatement, ReadStatementOptionalValueWithTransactions)
TEST_F(SqliteStatement, ReadStatementReadCallbackWithTransactions) TEST_F(SqliteStatement, ReadStatementReadCallbackWithTransactions)
{ {
using Tuple = std::tuple<Utils::SmallString, Utils::SmallString, long long>;
MockFunction<Sqlite::CallbackControl(Utils::SmallStringView, Utils::SmallStringView, long long)> callbackMock; MockFunction<Sqlite::CallbackControl(Utils::SmallStringView, Utils::SmallStringView, long long)> callbackMock;
ReadStatement<3> statement("SELECT name, number, value FROM test WHERE name=? AND number=?", ReadStatement<3> statement("SELECT name, number, value FROM test WHERE name=? AND number=?",
database); database);
@@ -1549,7 +1548,6 @@ TEST_F(SqliteStatement, ReadWriteStatementOptionalValueWithTransactions)
TEST_F(SqliteStatement, ReadWriteStatementReadCallbackWithTransactions) TEST_F(SqliteStatement, ReadWriteStatementReadCallbackWithTransactions)
{ {
using Tuple = std::tuple<Utils::SmallString, Utils::SmallString, long long>;
MockFunction<Sqlite::CallbackControl(Utils::SmallStringView, Utils::SmallStringView, long long)> callbackMock; MockFunction<Sqlite::CallbackControl(Utils::SmallStringView, Utils::SmallStringView, long long)> callbackMock;
ReadWriteStatement<3> statement( ReadWriteStatement<3> statement(
"SELECT name, number, value FROM test WHERE name=? AND number=?", database); "SELECT name, number, value FROM test WHERE name=? AND number=?", database);