Merge remote-tracking branch 'origin/5.0'

Change-Id: I4ea793c0b2d1980e5ed79bcc985c0f26a4de7aa4
This commit is contained in:
Orgad Shaneh
2021-07-29 14:15:21 +03:00
59 changed files with 656 additions and 397 deletions

View File

@@ -144,6 +144,12 @@ class PlainDumper():
self.typeCache = {} self.typeCache = {}
def __call__(self, d, value): def __call__(self, d, value):
if value.nativeValue is None:
# warn('PlainDumper(gdb): value.nativeValue is missing (%s)'%value)
nativeType = theDumper.lookupNativeType(value.type.name)
nativeTypePointer = nativeType.pointer()
nativePointer = gdb.Value(value.laddress)
value.nativeValue = nativePointer.cast(nativeTypePointer).dereference()
try: try:
printer = self.printer.gen_printer(value.nativeValue) printer = self.printer.gen_printer(value.nativeValue)
except: except:

View File

@@ -729,11 +729,18 @@ void NodeInstanceServer::setupMockupTypes(const QVector<MockupTypeContainer> &co
for (const MockupTypeContainer &mockupType : container) { for (const MockupTypeContainer &mockupType : container) {
if (!isTypeAvailable(mockupType, engine())) if (!isTypeAvailable(mockupType, engine()))
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
if (mockupType.majorVersion() == -1 && mockupType.minorVersion() == -1) {
QQuickDesignerSupportMetaInfo::registerMockupObject(mockupType.importUri().toUtf8(),
1,
0,
mockupType.typeName());
} else {
QQuickDesignerSupportMetaInfo::registerMockupObject(mockupType.importUri().toUtf8(), QQuickDesignerSupportMetaInfo::registerMockupObject(mockupType.importUri().toUtf8(),
mockupType.majorVersion(), mockupType.majorVersion(),
mockupType.minorVersion(), mockupType.minorVersion(),
mockupType.typeName()); mockupType.typeName());
}
#else #else
qmlRegisterType(QUrl("qrc:/qtquickplugin/mockfiles/GenericBackend.qml"), qmlRegisterType(QUrl("qrc:/qtquickplugin/mockfiles/GenericBackend.qml"),
mockupType.importUri().toUtf8(), mockupType.importUri().toUtf8(),

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.

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 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.
@@ -24,12 +24,9 @@
****************************************************************************/ ****************************************************************************/
import QtQuick 2.15 import QtQuick 2.15
import HelperWidgets 2.0
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import HelperWidgets 2.0
Column { import StudioTheme 1.0 as StudioTheme
anchors.left: parent.left
anchors.right: parent.right
Section { Section {
anchors.left: parent.left anchors.left: parent.left
@@ -37,46 +34,53 @@ Column {
caption: qsTr("Connections") caption: qsTr("Connections")
SectionLayout { SectionLayout {
Label { PropertyLabel {
text: qsTr("Enabled") text: qsTr("Enabled")
tooltip: qsTr("Sets whether the component accepts change events.") tooltip: qsTr("Sets whether the component accepts change events.")
} }
SecondColumnLayout { SecondColumnLayout {
CheckBox { CheckBox {
text: backendValues.enabled.valueToString text: backendValues.enabled.valueToString
backendValue: backendValues.enabled backendValue: backendValues.enabled
implicitWidth: 180 implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
} }
ExpandingSpacer {} ExpandingSpacer {}
} }
Label { PropertyLabel {
text: qsTr("Ignore unknown signals") text: qsTr("Ignore unknown signals")
tooltip: qsTr("Ignores runtime errors produced by connections to non-existent signals.") tooltip: qsTr("Ignores runtime errors produced by connections to non-existent signals.")
} }
SecondColumnLayout { SecondColumnLayout {
CheckBox { CheckBox {
text: backendValues.ignoreUnknownSignals.valueToString text: backendValues.ignoreUnknownSignals.valueToString
backendValue: backendValues.ignoreUnknownSignals backendValue: backendValues.ignoreUnknownSignals
implicitWidth: 180 implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
} }
ExpandingSpacer {} ExpandingSpacer {}
} }
Label { PropertyLabel {
text: qsTr("Target") text: qsTr("Target")
tooltip: qsTr("Sets the component that sends the signal.") tooltip: qsTr("Sets the component that sends the signal.")
} }
SecondColumnLayout { SecondColumnLayout {
ItemFilterComboBox { ItemFilterComboBox {
typeFilter: "QtQuick.Item" typeFilter: "QtQuick.Item"
validator: RegExpValidator { regExp: /(^$|^[a-z_]\w*)/ } validator: RegExpValidator { regExp: /(^$|^[a-z_]\w*)/ }
backendValue: backendValues.target backendValue: backendValues.target
Layout.fillWidth: true implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
} }
ExpandingSpacer {} ExpandingSpacer {}
} }
} }
}
} }

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.
@@ -22,9 +22,11 @@
** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1
import QtQuick 2.15
import HelperWidgets 2.0 import HelperWidgets 2.0
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.15
import StudioTheme 1.0 as StudioTheme
Column { Column {
anchors.left: parent.left anchors.left: parent.left
@@ -41,18 +43,17 @@ Column {
caption: qsTr("Dialog") caption: qsTr("Dialog")
SectionLayout { SectionLayout {
Label { PropertyLabel { text: qsTr("Title") }
text: qsTr("Title")
}
SecondColumnLayout { SecondColumnLayout {
LineEdit { LineEdit {
backendValue: backendValues.title backendValue: backendValues.title
Layout.fillWidth: true implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
} }
ExpandingSpacer { ExpandingSpacer {}
}
} }
} }
} }
@@ -67,6 +68,5 @@ Column {
anchors.right: parent.right anchors.right: parent.right
} }
FontSection { FontSection {}
}
} }

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.
@@ -22,9 +22,11 @@
** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1
import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0 import HelperWidgets 2.0
import QtQuick.Layouts 1.0 import StudioTheme 1.0 as StudioTheme
Column { Column {
anchors.left: parent.left anchors.left: parent.left
@@ -41,36 +43,41 @@ Column {
caption: qsTr("Drawer") caption: qsTr("Drawer")
SectionLayout { SectionLayout {
Label { PropertyLabel {
text: qsTr("Edge") text: qsTr("Edge")
tooltip: qsTr("Defines the edge of the window the drawer will open from.") tooltip: qsTr("Defines the edge of the window the drawer will open from.")
} }
SecondColumnLayout { SecondColumnLayout {
ComboBox { ComboBox {
Layout.fillWidth: true
backendValue: backendValues.edge backendValue: backendValues.edge
scope: "Qt" scope: "Qt"
model: ["TopEdge", "LeftEdge", "RightEdge", "BottomEdge"] model: ["TopEdge", "LeftEdge", "RightEdge", "BottomEdge"]
} implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
} }
Label { ExpandingSpacer {}
text: qsTr("Drag Margin") }
PropertyLabel {
text: qsTr("Drag margin")
tooltip: qsTr("Defines the distance from the screen edge within which drag actions will open the drawer.") tooltip: qsTr("Defines the distance from the screen edge within which drag actions will open the drawer.")
} }
SecondColumnLayout { SecondColumnLayout {
SpinBox { SpinBox {
backendValue: backendValues.dragMargin backendValue: backendValues.dragMargin
hasSlider: true hasSlider: true
Layout.preferredWidth: 80
minimumValue: 0 minimumValue: 0
maximumValue: 400 maximumValue: 400
stepSize: 1 stepSize: 1
decimals: 0 decimals: 0
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
} }
ExpandingSpacer {
} ExpandingSpacer {}
} }
} }
} }
@@ -85,6 +92,5 @@ Column {
anchors.right: parent.right anchors.right: parent.right
} }
FontSection { FontSection {}
}
} }

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2017 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/ ** Contact: http://www.qt.io/licensing/
** **
** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. ** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.

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.
@@ -22,148 +22,154 @@
** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1
import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0 import HelperWidgets 2.0
import QtQuick.Layouts 1.0 import StudioTheme 1.0 as StudioTheme
Section { Section {
anchors.left: parent.left
anchors.right: parent.right
caption: qsTr("Popup") caption: qsTr("Popup")
SectionLayout { SectionLayout {
Label { PropertyLabel { text: qsTr("Size") }
text: qsTr("Size")
}
SecondColumnLayout { SecondColumnLayout {
Label {
text: "W"
width: 12
}
SpinBox { SpinBox {
backendValue: backendValues.width backendValue: backendValues.width
minimumValue: 0 minimumValue: 0
maximumValue: 10000 maximumValue: 10000
decimals: 0 decimals: 0
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
} }
Label { Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }
text: "H"
width: 12 ControlLabel {
//: The width of the object
text: qsTr("W", "width")
} }
Spacer { implicitWidth: StudioTheme.Values.controlGap }
SpinBox { SpinBox {
backendValue: backendValues.height backendValue: backendValues.height
minimumValue: 0 minimumValue: 0
maximumValue: 10000 maximumValue: 10000
decimals: 0 decimals: 0
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
} }
ExpandingSpacer { Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }
}
ControlLabel {
//: The height of the object
text: qsTr("H", "height")
} }
Label { ExpandingSpacer {}
text: qsTr("Visibility")
} }
PropertyLabel { text: qsTr("Visibility") }
SecondColumnLayout { SecondColumnLayout {
CheckBox { CheckBox {
text: qsTr("Is visible") text: qsTr("Visible")
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
backendValue: backendValues.visible backendValue: backendValues.visible
Layout.preferredWidth: 100
} }
Item { Spacer { implicitWidth: StudioTheme.Values.twoControlColumnGap }
width: 10
height: 10
}
CheckBox { CheckBox {
text: qsTr("Clip") text: qsTr("Clip")
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
backendValue: backendValues.clip backendValue: backendValues.clip
} }
Item {
Layout.fillWidth: true ExpandingSpacer {}
}
} }
Label { PropertyLabel { text: qsTr("Behavior") }
text: qsTr("Behavior")
}
SecondColumnLayout { SecondColumnLayout {
CheckBox { CheckBox {
text: qsTr("Modal") text: qsTr("Modal")
backendValue: backendValues.modal
tooltip: qsTr("Defines the modality of the popup.") tooltip: qsTr("Defines the modality of the popup.")
backendValue: backendValues.modal
Layout.preferredWidth: 100 implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
} }
Item { Spacer { implicitWidth: StudioTheme.Values.twoControlColumnGap }
width: 10
height: 10
}
CheckBox { CheckBox {
text: qsTr("Dim") text: qsTr("Dim")
tooltip: qsTr("Defines whether the popup dims the background.") tooltip: qsTr("Defines whether the popup dims the background.")
backendValue: backendValues.dim backendValue: backendValues.dim
} implicitWidth: StudioTheme.Values.twoControlColumnWidth
Item { + StudioTheme.Values.actionIndicatorWidth
Layout.fillWidth: true
}
} }
Label { ExpandingSpacer {}
text: qsTr("Opacity")
} }
PropertyLabel { text: qsTr("Opacity") }
SecondColumnLayout { SecondColumnLayout {
SpinBox { SpinBox {
backendValue: backendValues.opacity backendValue: backendValues.opacity
hasSlider: true hasSlider: true
Layout.preferredWidth: 80
minimumValue: 0 minimumValue: 0
maximumValue: 1 maximumValue: 1
stepSize: 0.1 stepSize: 0.1
decimals: 2 decimals: 2
} implicitWidth: StudioTheme.Values.twoControlColumnWidth
ExpandingSpacer { + StudioTheme.Values.actionIndicatorWidth
}
} }
Label { ExpandingSpacer {}
text: qsTr("Scale")
} }
PropertyLabel { text: qsTr("Scale") }
SecondColumnLayout { SecondColumnLayout {
SpinBox { SpinBox {
backendValue: backendValues.scale backendValue: backendValues.scale
hasSlider: true hasSlider: true
Layout.preferredWidth: 80
minimumValue: 0 minimumValue: 0
maximumValue: 1 maximumValue: 1
stepSize: 0.1 stepSize: 0.1
decimals: 2 decimals: 2
} implicitWidth: StudioTheme.Values.twoControlColumnWidth
ExpandingSpacer { + StudioTheme.Values.actionIndicatorWidth
}
} }
Label { ExpandingSpacer {}
}
PropertyLabel {
text: qsTr("Spacing") text: qsTr("Spacing")
tooltip: qsTr("Spacing between internal elements of the control.") tooltip: qsTr("Spacing between internal elements of the control.")
} }
SecondColumnLayout { SecondColumnLayout {
SpinBox { SpinBox {
minimumValue: -4000 minimumValue: -4000
maximumValue: 4000 maximumValue: 4000
decimals: 0 decimals: 0
backendValue: backendValues.spacing backendValue: backendValues.spacing
Layout.fillWidth: true implicitWidth: StudioTheme.Values.twoControlColumnWidth
} + StudioTheme.Values.actionIndicatorWidth
}
ExpandingSpacer {}
} }
} }
} }

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.
@@ -22,9 +22,10 @@
** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1
import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0 import HelperWidgets 2.0
import QtQuick.Layouts 1.0
Column { Column {
anchors.left: parent.left anchors.left: parent.left
@@ -45,6 +46,5 @@ Column {
anchors.right: parent.right anchors.right: parent.right
} }
FontSection { FontSection {}
}
} }

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,9 +23,9 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0 import HelperWidgets 2.0
import QtQuick.Layouts 1.0
Column { Column {
anchors.left: parent.left anchors.left: parent.left

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.

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.
@@ -26,8 +26,8 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import QtQuickDesignerTheme 1.0
import QtQuick.Templates 2.15 as T import QtQuick.Templates 2.15 as T
import QtQuickDesignerTheme 1.0
import HelperWidgets 2.0 import HelperWidgets 2.0
import StudioControls 1.0 as StudioControls import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme import StudioTheme 1.0 as StudioTheme

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 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,9 +23,10 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0 import HelperWidgets 2.0
import QtQuick 2.1
import QtQuick.Layouts 1.1
Column { Column {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@@ -34,4 +35,3 @@ Column {
showDuration: false showDuration: false
} }
} }

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 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,9 +23,10 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0 import HelperWidgets 2.0
import QtQuick 2.1
import QtQuick.Layouts 1.1
Column { Column {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@@ -34,4 +35,3 @@ Column {
showDuration: false showDuration: false
} }
} }

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 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.
@@ -24,8 +24,9 @@
****************************************************************************/ ****************************************************************************/
import QtQuick 2.15 import QtQuick 2.15
import HelperWidgets 2.0
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import HelperWidgets 2.0
import StudioTheme 1.0 as StudioTheme
Column { Column {
anchors.left: parent.left anchors.left: parent.left
@@ -37,42 +38,53 @@ Column {
caption: qsTr("State") caption: qsTr("State")
SectionLayout { SectionLayout {
Label { PropertyLabel {
text: qsTr("When") text: qsTr("When")
tooltip: qsTr("Sets when the state should be applied.") tooltip: qsTr("Sets when the state should be applied.")
} }
SecondColumnLayout { SecondColumnLayout {
CheckBox { CheckBox {
text: backendValues.when.valueToString text: backendValues.when.valueToString
backendValue: backendValues.when backendValue: backendValues.when
implicitWidth: 180 implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
} }
ExpandingSpacer {} ExpandingSpacer {}
} }
Label { PropertyLabel {
text: qsTr("Name") text: qsTr("Name")
tooltip: qsTr("The name of the state.") tooltip: qsTr("The name of the state.")
} }
SecondColumnLayout { SecondColumnLayout {
LineEdit { LineEdit {
backendValue: backendValues.name backendValue: backendValues.name
Layout.fillWidth: true
showTranslateCheckBox: false showTranslateCheckBox: false
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
} }
ExpandingSpacer {} ExpandingSpacer {}
} }
Label { PropertyLabel {
text: qsTr("Extend") text: qsTr("Extend")
tooltip: qsTr("The state that this state extends.") tooltip: qsTr("The state that this state extends.")
} }
SecondColumnLayout { SecondColumnLayout {
LineEdit { LineEdit {
backendValue: backendValues.extend backendValue: backendValues.extend
Layout.fillWidth: true
showTranslateCheckBox: false showTranslateCheckBox: false
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
} }
ExpandingSpacer {} ExpandingSpacer {}
} }
} }

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.

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,13 +23,10 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0 import HelperWidgets 2.0
import QtQuick.Layouts 1.0 import StudioTheme 1.0 as StudioTheme
Column {
anchors.left: parent.left
anchors.right: parent.right
Section { Section {
anchors.left: parent.left anchors.left: parent.left
@@ -37,107 +34,93 @@ Column {
caption: qsTr("Window") caption: qsTr("Window")
SectionLayout { SectionLayout {
Label { PropertyLabel { text: qsTr("Title") }
text: qsTr("Title")
}
SecondColumnLayout { SecondColumnLayout {
LineEdit { LineEdit {
backendValue: backendValues.title backendValue: backendValues.title
Layout.fillWidth: true implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
} }
ExpandingSpacer { ExpandingSpacer {}
}
} }
Label { PropertyLabel { text: qsTr("Size") }
text: qsTr("Size")
}
SecondColumnLayout { SecondColumnLayout {
Label {
text: "W"
width: 12
}
SpinBox { SpinBox {
backendValue: backendValues.width backendValue: backendValues.width
minimumValue: 0 minimumValue: 0
maximumValue: 10000 maximumValue: 10000
decimals: 0 decimals: 0
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
} }
Label { Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }
text: "H"
width: 12 ControlLabel {
//: The width of the object
text: qsTr("W", "width")
} }
Spacer { implicitWidth: StudioTheme.Values.controlGap }
SpinBox { SpinBox {
backendValue: backendValues.height backendValue: backendValues.height
minimumValue: 0 minimumValue: 0
maximumValue: 10000 maximumValue: 10000
decimals: 0 decimals: 0
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
} }
ExpandingSpacer { Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }
} ControlLabel {
//: The height of the object
text: qsTr("H", "height")
} }
} ExpandingSpacer {}
} }
Section { PropertyLabel { text: qsTr("Color") }
anchors.left: parent.left
anchors.right: parent.right
caption: qsTr("Color")
ColorEditor { ColorEditor {
caption: qsTr("Color")
backendValue: backendValues.color backendValue: backendValues.color
supportGradient: false supportGradient: false
} }
} PropertyLabel { text: qsTr("Visible") }
Section {
anchors.left: parent.left
anchors.right: parent.right
caption: "Rectangle"
SectionLayout {
rows: 2
Label {
text: qsTr("Visible")
}
SecondColumnLayout { SecondColumnLayout {
CheckBox { CheckBox {
backendValue: backendValues.visible backendValue: backendValues.visible
Layout.preferredWidth: 80 implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
} }
ExpandingSpacer {
ExpandingSpacer {}
} }
}
Label { PropertyLabel { text: qsTr("Opacity") }
text: qsTr("Opacity")
}
SecondColumnLayout { SecondColumnLayout {
SpinBox { SpinBox {
backendValue: backendValues.opacity backendValue: backendValues.opacity
hasSlider: true hasSlider: true
Layout.preferredWidth: 80
minimumValue: 0 minimumValue: 0
maximumValue: 1 maximumValue: 1
stepSize: 0.1 stepSize: 0.1
decimals: 2 decimals: 2
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
} }
ExpandingSpacer {
} ExpandingSpacer {}
}
} }
} }
} }

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.

View File

@@ -139,22 +139,22 @@ SecondColumnLayout {
ceMode.items.append({ ceMode.items.append({
value: "Solid", value: "Solid",
text: qsTr("Solid"), text: qsTr("Solid"),
test: true enabled: true
}) })
ceMode.items.append({ ceMode.items.append({
value: "LinearGradient", value: "LinearGradient",
text: qsTr("Linear"), text: qsTr("Linear"),
test: colorEditor.supportGradient enabled: colorEditor.supportGradient
}) })
ceMode.items.append({ ceMode.items.append({
value: "RadialGradient", value: "RadialGradient",
text: qsTr("Radial"), text: qsTr("Radial"),
test: colorEditor.supportGradient && colorEditor.shapeGradients enabled: colorEditor.supportGradient && colorEditor.shapeGradients
}) })
ceMode.items.append({ ceMode.items.append({
value: "ConicalGradient", value: "ConicalGradient",
text: qsTr("Conical"), text: qsTr("Conical"),
test: colorEditor.supportGradient && colorEditor.shapeGradients enabled: colorEditor.supportGradient && colorEditor.shapeGradients
}) })
} }

View File

@@ -284,7 +284,7 @@ Section {
PropertyLabel { PropertyLabel {
text: qsTr("Letter spacing") text: qsTr("Letter spacing")
tooltip: qsTr("Letter spacing for the font.") tooltip: qsTr("Letter spacing for the font.")
blockedByTemplate: getBackendValue("letterSpacing").isAvailable blockedByTemplate: !getBackendValue("letterSpacing").isAvailable
} }
SecondColumnLayout { SecondColumnLayout {

View File

@@ -56,7 +56,7 @@ HelperWidgets.ComboBox {
comboBox.setCurrentText(comboBox.textValue) comboBox.setCurrentText(comboBox.textValue)
} }
onModelChanged: comboBox.setCurrentText(comboBox.textValue) onModelChanged: comboBox.setCurrentText(comboBox.textValue)
onCompressedActivated: comboBox.handleActivate(index) onCompressedActivated: function(index, reason) { comboBox.handleActivate(index) }
Component.onCompleted: comboBox.setCurrentText(comboBox.textValue) Component.onCompleted: comboBox.setCurrentText(comboBox.textValue)
onEditTextChanged: comboBox.dirty = true onEditTextChanged: comboBox.dirty = true

View File

@@ -134,7 +134,7 @@ T.ComboBox {
+ 2 : 0) // TODO Magic number + 2 : 0) // TODO Magic number
height: StudioTheme.Values.height - 2 * StudioTheme.Values.border height: StudioTheme.Values.height - 2 * StudioTheme.Values.border
padding: 0 padding: 0
enabled: model.test === "undefined" ? true : model.test // TODO modelData enabled: model.enabled === undefined ? true : model.enabled
contentItem: Text { contentItem: Text {
leftPadding: itemDelegateIconArea.width leftPadding: itemDelegateIconArea.width

View File

@@ -51,7 +51,9 @@ T.SpinBox {
property bool edit: spinBoxInput.activeFocus property bool edit: spinBoxInput.activeFocus
// This property is used to indicate the global hover state // This property is used to indicate the global hover state
property bool hover: (mySpinBox.hovered || actionIndicator.hover) && mySpinBox.enabled property bool hover: (spinBoxInput.hover || actionIndicator.hover || spinBoxIndicatorUp.hover
|| spinBoxIndicatorDown.hover || sliderIndicator.hover)
&& mySpinBox.enabled
property bool drag: false property bool drag: false
property bool sliderDrag: sliderPopup.drag property bool sliderDrag: sliderPopup.drag

View File

@@ -910,7 +910,7 @@ bool ResolveExpression::visit(CallAST *ast)
if (Symbol *declaration = templateTy->declaration()) { if (Symbol *declaration = templateTy->declaration()) {
if (Function *funTy = declaration->asFunction()) { if (Function *funTy = declaration->asFunction()) {
if (maybeValidPrototype(funTy, actualArgumentCount)) if (maybeValidPrototype(funTy, actualArgumentCount))
addResult(funTy->returnType().simplified(), scope); addResult(funTy->returnType().simplified(), _scope);
} }
} }
} }

View File

@@ -389,11 +389,14 @@ void TypePrettyPrinter::visit(Function *type)
for (Scope *s = type->enclosingScope(); s && i >= 0; s = s->enclosingScope()) { for (Scope *s = type->enclosingScope(); s && i >= 0; s = s->enclosingScope()) {
if (Template *templ = s->asTemplate()) { if (Template *templ = s->asTemplate()) {
QString &n = nameParts[i]; QString &n = nameParts[i];
const int paramCount = templ->templateParameterCount();
if (paramCount > 0) {
n += '<'; n += '<';
for (int index = 0; index < templ->templateParameterCount(); ++index) { for (int index = 0; index < paramCount; ++index) {
if (index) if (index)
n += QLatin1String(", "); n += QLatin1String(", ");
QString arg = _overview->prettyName(templ->templateParameterAt(index)->name()); QString arg = _overview->prettyName(
templ->templateParameterAt(index)->name());
if (arg.isEmpty()) { if (arg.isEmpty()) {
arg += 'T'; arg += 'T';
arg += QString::number(index + 1); arg += QString::number(index + 1);
@@ -402,6 +405,7 @@ void TypePrettyPrinter::visit(Function *type)
} }
n += '>'; n += '>';
} }
}
if (s->identifier()) if (s->identifier())
--i; --i;
} }
@@ -435,7 +439,8 @@ void TypePrettyPrinter::visit(Function *type)
if (_overview->showEnclosingTemplate) { if (_overview->showEnclosingTemplate) {
if (Template *templ = type->enclosingTemplate()) { if (Template *templ = type->enclosingTemplate()) {
QString templateScope = "template<"; QString templateScope = "template<";
for (int i = 0, total = templ->templateParameterCount(); i < total; ++i) { const int paramCount = templ->templateParameterCount();
for (int i = 0; i < paramCount; ++i) {
if (Symbol *param = templ->templateParameterAt(i)) { if (Symbol *param = templ->templateParameterAt(i)) {
if (i > 0) if (i > 0)
templateScope.append(", "); templateScope.append(", ");
@@ -452,6 +457,7 @@ void TypePrettyPrinter::visit(Function *type)
} }
} }
} }
if (paramCount > 0)
_text.prepend(templateScope + ">\n"); _text.prepend(templateScope + ">\n");
} }
} }

View File

@@ -27,6 +27,7 @@
#include "clangdiagnosticmanager.h" #include "clangdiagnosticmanager.h"
#include "clangtextmark.h" #include "clangtextmark.h"
#include "clangutils.h"
#include <clangsupport/sourcelocationscontainer.h> #include <clangsupport/sourcelocationscontainer.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
@@ -35,6 +36,7 @@
#include <cplusplus/FindUsages.h> #include <cplusplus/FindUsages.h>
#include <cpptools/cppeditorwidgetinterface.h> #include <cpptools/cppeditorwidgetinterface.h>
#include <cpptools/cppfindreferences.h> #include <cpptools/cppfindreferences.h>
#include <cpptools/cppmodelmanager.h>
#include <cpptools/cpptoolsreuse.h> #include <cpptools/cpptoolsreuse.h>
#include <cpptools/cppvirtualfunctionassistprovider.h> #include <cpptools/cppvirtualfunctionassistprovider.h>
#include <cpptools/cppvirtualfunctionproposalitem.h> #include <cpptools/cppvirtualfunctionproposalitem.h>
@@ -729,6 +731,13 @@ ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir)
"text/x-c++hdr", "text/x-c++src", "text/x-objc++src", "text/x-objcsrc"}; "text/x-c++hdr", "text/x-c++src", "text/x-objc++src", "text/x-objcsrc"};
setSupportedLanguage(langFilter); setSupportedLanguage(langFilter);
setActivateDocumentAutomatically(true); setActivateDocumentAutomatically(true);
if (!project) {
QJsonObject initOptions;
const auto clangOptions = createClangOptions(
*CppTools::CppModelManager::instance()->fallbackProjectPart(), {});
initOptions.insert("fallbackFlags", QJsonArray::fromStringList(clangOptions.second));
setInitializationOptions(initOptions);
}
ClientCapabilities caps = Client::defaultClientCapabilities(); ClientCapabilities caps = Client::defaultClientCapabilities();
Utils::optional<TextDocumentClientCapabilities> textCaps = caps.textDocument(); Utils::optional<TextDocumentClientCapabilities> textCaps = caps.textDocument();
if (textCaps) { if (textCaps) {

View File

@@ -81,6 +81,23 @@ static CppTools::CppModelManager *cppModelManager()
return CppTools::CppModelManager::instance(); return CppTools::CppModelManager::instance();
} }
static const QList<TextEditor::BaseTextEditor *> allCppEditors()
{
QList<TextEditor::BaseTextEditor *> cppEditors;
for (const Core::DocumentModel::Entry * const entry : Core::DocumentModel::entries()) {
const auto textDocument = qobject_cast<TextEditor::TextDocument *>(entry->document);
if (!textDocument)
continue;
if (const auto cppEditor = qobject_cast<TextEditor::BaseTextEditor *>(Utils::findOrDefault(
Core::DocumentModel::editorsForDocument(textDocument), [](Core::IEditor *editor) {
return CppTools::CppModelManager::isCppEditor(editor);
}))) {
cppEditors << cppEditor;
}
}
return cppEditors;
}
ClangModelManagerSupport::ClangModelManagerSupport() ClangModelManagerSupport::ClangModelManagerSupport()
: m_completionAssistProvider(m_communicator, CompletionType::Other) : m_completionAssistProvider(m_communicator, CompletionType::Other)
, m_functionHintAssistProvider(m_communicator, CompletionType::FunctionHint) , m_functionHintAssistProvider(m_communicator, CompletionType::FunctionHint)
@@ -119,6 +136,11 @@ ClangModelManagerSupport::ClangModelManagerSupport()
this, &ClangModelManagerSupport::onProjectAdded); this, &ClangModelManagerSupport::onProjectAdded);
connect(sessionManager, &ProjectExplorer::SessionManager::aboutToRemoveProject, connect(sessionManager, &ProjectExplorer::SessionManager::aboutToRemoveProject,
this, &ClangModelManagerSupport::onAboutToRemoveProject); this, &ClangModelManagerSupport::onAboutToRemoveProject);
connect(sessionManager, &ProjectExplorer::SessionManager::projectRemoved,
this, [this] {
if (ClangdClient * const fallbackClient = clientForProject(nullptr))
claimNonProjectSources(fallbackClient);
});
CppTools::ClangdSettings::setDefaultClangdPath(Utils::FilePath::fromString( CppTools::ClangdSettings::setDefaultClangdPath(Utils::FilePath::fromString(
Core::ICore::clangdExecutable(CLANG_BINDIR))); Core::ICore::clangdExecutable(CLANG_BINDIR)));
@@ -128,8 +150,9 @@ ClangModelManagerSupport::ClangModelManagerSupport()
connect(settings, &CppTools::CppCodeModelSettings::clangDiagnosticConfigsInvalidated, connect(settings, &CppTools::CppCodeModelSettings::clangDiagnosticConfigsInvalidated,
this, &ClangModelManagerSupport::onDiagnosticConfigsInvalidated); this, &ClangModelManagerSupport::onDiagnosticConfigsInvalidated);
// TODO: Enable this once we do document-level stuff with clangd (highlighting etc) if (CppTools::ClangdSettings::instance().useClangd())
// createClient(nullptr, {}); createClient(nullptr, {});
m_generatorSynchronizer.setCancelOnWait(true); m_generatorSynchronizer.setCancelOnWait(true);
new ClangdQuickFixFactory(); // memory managed by CppEditor::g_cppQuickFixFactories new ClangdQuickFixFactory(); // memory managed by CppEditor::g_cppQuickFixFactories
} }
@@ -291,7 +314,7 @@ void ClangModelManagerSupport::updateLanguageClient(ProjectExplorer::Project *pr
if (Client * const oldClient = clientForProject(project)) if (Client * const oldClient = clientForProject(project))
LanguageClientManager::shutdownClient(oldClient); LanguageClientManager::shutdownClient(oldClient);
ClangdClient * const client = createClient(project, jsonDbDir); ClangdClient * const client = createClient(project, jsonDbDir);
connect(client, &Client::initialized, this, [client, project, projectInfo, jsonDbDir] { connect(client, &Client::initialized, this, [this, client, project, projectInfo, jsonDbDir] {
using namespace ProjectExplorer; using namespace ProjectExplorer;
if (!SessionManager::hasProject(project)) if (!SessionManager::hasProject(project))
return; return;
@@ -301,22 +324,15 @@ void ClangModelManagerSupport::updateLanguageClient(ProjectExplorer::Project *pr
return; return;
// Acquaint the client with all open C++ documents for this project. // Acquaint the client with all open C++ documents for this project.
ClangdClient * const fallbackClient = clientForProject(nullptr);
bool hasDocuments = false; bool hasDocuments = false;
for (const Core::DocumentModel::Entry * const entry : Core::DocumentModel::entries()) { for (TextEditor::BaseTextEditor * const editor : allCppEditors()) {
const auto textDocument = qobject_cast<TextEditor::TextDocument *>(entry->document); if (!project->isKnownFile(editor->textDocument()->filePath()))
if (!textDocument)
continue; continue;
const bool isCppDocument = Utils::contains( if (fallbackClient && fallbackClient->documentOpen(editor->textDocument()))
Core::DocumentModel::editorsForDocument(textDocument), fallbackClient->closeDocument(editor->textDocument());
[](Core::IEditor *editor) { client->openDocument(editor->textDocument());
return CppTools::CppModelManager::isCppEditor(editor); ClangEditorDocumentProcessor::clearTextMarks(editor->textDocument()->filePath());
});
if (!isCppDocument)
continue;
if (!project->isKnownFile(entry->fileName()))
continue;
client->openDocument(textDocument);
ClangEditorDocumentProcessor::clearTextMarks(textDocument->filePath());
hasDocuments = true; hasDocuments = true;
} }
@@ -376,6 +392,18 @@ ClangdClient *ClangModelManagerSupport::createClient(ProjectExplorer::Project *p
return client; return client;
} }
void ClangModelManagerSupport::claimNonProjectSources(ClangdClient *fallbackClient)
{
for (TextEditor::BaseTextEditor * const editor : allCppEditors()) {
if (ProjectExplorer::SessionManager::projectForFile(editor->textDocument()->filePath()))
continue;
if (!fallbackClient->documentOpen(editor->textDocument())) {
ClangEditorDocumentProcessor::clearTextMarks(editor->textDocument()->filePath());
fallbackClient->openDocument(editor->textDocument());
}
}
}
void ClangModelManagerSupport::onEditorOpened(Core::IEditor *editor) void ClangModelManagerSupport::onEditorOpened(Core::IEditor *editor)
{ {
QTC_ASSERT(editor, return); QTC_ASSERT(editor, return);
@@ -389,6 +417,10 @@ void ClangModelManagerSupport::onEditorOpened(Core::IEditor *editor)
// TODO: Ensure that not fully loaded documents are updated? // TODO: Ensure that not fully loaded documents are updated?
// TODO: If the file does not belong to any project and it is a header file,
// it might make sense to check whether the file is included by any file
// that does belong to a project, and if so, use the respective client
// instead. Is this feasible?
ProjectExplorer::Project * const project ProjectExplorer::Project * const project
= ProjectExplorer::SessionManager::projectForFile(document->filePath()); = ProjectExplorer::SessionManager::projectForFile(document->filePath());
if (Client * const client = clientForProject(project)) if (Client * const client = clientForProject(project))
@@ -597,7 +629,6 @@ void ClangModelManagerSupport::onProjectPartsRemoved(const QStringList &projectP
void ClangModelManagerSupport::onClangdSettingsChanged() void ClangModelManagerSupport::onClangdSettingsChanged()
{ {
// TODO: Handle also project-less client
for (ProjectExplorer::Project * const project : ProjectExplorer::SessionManager::projects()) { for (ProjectExplorer::Project * const project : ProjectExplorer::SessionManager::projects()) {
const CppTools::ClangdSettings settings( const CppTools::ClangdSettings settings(
CppTools::ClangdProjectSettings(project).settings()); CppTools::ClangdProjectSettings(project).settings());
@@ -614,6 +645,25 @@ void ClangModelManagerSupport::onClangdSettingsChanged()
if (client->settingsData() != settings.data()) if (client->settingsData() != settings.data())
updateLanguageClient(project, cppModelManager()->projectInfo(project)); updateLanguageClient(project, cppModelManager()->projectInfo(project));
} }
ClangdClient * const fallbackClient = clientForProject(nullptr);
const CppTools::ClangdSettings &settings = CppTools::ClangdSettings::instance();
const auto startNewFallbackClient = [this] {
claimNonProjectSources(createClient(nullptr, {}));
};
if (!fallbackClient) {
if (settings.useClangd())
startNewFallbackClient();
return;
}
if (!settings.useClangd()) {
LanguageClientManager::shutdownClient(fallbackClient);
return;
}
if (fallbackClient->settingsData() != settings.data()) {
LanguageClientManager::shutdownClient(fallbackClient);
startNewFallbackClient();
}
} }
static ClangEditorDocumentProcessors clangProcessorsWithDiagnosticConfig( static ClangEditorDocumentProcessors clangProcessorsWithDiagnosticConfig(

View File

@@ -131,6 +131,7 @@ private:
void updateLanguageClient(ProjectExplorer::Project *project, void updateLanguageClient(ProjectExplorer::Project *project,
const CppTools::ProjectInfo &projectInfo); const CppTools::ProjectInfo &projectInfo);
ClangdClient *createClient(ProjectExplorer::Project *project, const Utils::FilePath &jsonDbDir); ClangdClient *createClient(ProjectExplorer::Project *project, const Utils::FilePath &jsonDbDir);
void claimNonProjectSources(ClangdClient *fallbackClient);
private: private:
UiHeaderOnDiskManager m_uiHeaderOnDiskManager; UiHeaderOnDiskManager m_uiHeaderOnDiskManager;

View File

@@ -522,7 +522,9 @@ private:
void addLanguageOptions() void addLanguageOptions()
{ {
// Determine file kind with respect to ambiguous headers. // Determine file kind with respect to ambiguous headers.
CppTools::ProjectFile::Kind fileKind = CppTools::ProjectFile::classify(m_filePath); CppTools::ProjectFile::Kind fileKind = CppTools::ProjectFile::Unclassified;
if (!m_filePath.isEmpty())
fileKind = CppTools::ProjectFile::classify(m_filePath);
if (fileKind == CppTools::ProjectFile::AmbiguousHeader) { if (fileKind == CppTools::ProjectFile::AmbiguousHeader) {
fileKind = m_projectPart.languageVersion <= ::Utils::LanguageVersion::LatestC fileKind = m_projectPart.languageVersion <= ::Utils::LanguageVersion::LatestC
? CppTools::ProjectFile::CHeader ? CppTools::ProjectFile::CHeader

View File

@@ -227,8 +227,7 @@ QVersionNumber ClangToolsSettings::clangTidyVersion()
QVersionNumber ClangToolsSettings::clazyVersion() QVersionNumber ClangToolsSettings::clazyVersion()
{ {
return getVersionNumber(instance()->m_clazyVersion, return ClazyStandaloneInfo(ClangTools::Internal::clazyStandaloneExecutable()).version;
ClangTools::Internal::clazyStandaloneExecutable());
} }
} // namespace Internal } // namespace Internal

View File

@@ -304,7 +304,7 @@ QString documentationUrl(const QString &checkName)
const QString clangStaticAnalyzerPrefix = "clang-analyzer-core."; const QString clangStaticAnalyzerPrefix = "clang-analyzer-core.";
if (name.startsWith(clazyPrefix)) { if (name.startsWith(clazyPrefix)) {
name = checkName.mid(clazyPrefix.length()); name = checkName.mid(clazyPrefix.length());
url = QString(CppTools::Constants::CLAZY_DOCUMENTATION_URL_TEMPLATE).arg(name); url = clazyDocUrl(name);
} else if (name.startsWith(clangStaticAnalyzerPrefix)) { } else if (name.startsWith(clangStaticAnalyzerPrefix)) {
url = CppTools::Constants::CLANG_STATIC_ANALYZER_DOCUMENTATION_URL; url = CppTools::Constants::CLANG_STATIC_ANALYZER_DOCUMENTATION_URL;
} else { } else {
@@ -362,5 +362,16 @@ QString clangTidyDocUrl(const QString &check)
return QString::fromLatin1(urlTemplate).arg(version.toString(), check); return QString::fromLatin1(urlTemplate).arg(version.toString(), check);
} }
QString clazyDocUrl(const QString &check)
{
QVersionNumber version = ClangToolsSettings::clazyVersion();
if (!version.isNull())
version = QVersionNumber(version.majorVersion(), version.minorVersion(), 0);
const QString versionString = version.isNull() ? "master" : version.toString();
static const char urlTemplate[]
= "https://github.com/KDE/clazy/blob/%1/docs/checks/README-%2.md";
return QString::fromLatin1(urlTemplate).arg(versionString, check);
}
} // namespace Internal } // namespace Internal
} // namespace ClangTools } // namespace ClangTools

View File

@@ -43,6 +43,7 @@ namespace ClangTools {
namespace Internal { namespace Internal {
QString clangTidyDocUrl(const QString &check); QString clangTidyDocUrl(const QString &check);
QString clazyDocUrl(const QString &check);
class Diagnostic; class Diagnostic;

View File

@@ -629,8 +629,7 @@ private:
if (role == LinkRole || role == Qt::ToolTipRole) { if (role == LinkRole || role == Qt::ToolTipRole) {
if (node->check.name.isEmpty()) if (node->check.name.isEmpty())
return QVariant(); return QVariant();
return QString::fromUtf8(CppTools::Constants::CLAZY_DOCUMENTATION_URL_TEMPLATE) return clazyDocUrl(node->name);
.arg(node->name);
} }
if (role == Qt::DisplayRole && node->kind != ClazyChecksTree::CheckNode) if (role == Qt::DisplayRole && node->kind != ClazyChecksTree::CheckNode)
return QVariant(); return QVariant();

View File

@@ -166,7 +166,23 @@ ClangTidyInfo::ClangTidyInfo(const QString &executablePath)
ClazyStandaloneInfo::ClazyStandaloneInfo(const QString &executablePath) ClazyStandaloneInfo::ClazyStandaloneInfo(const QString &executablePath)
: defaultChecks(queryClangTidyChecks(executablePath, {})) // Yup, behaves as clang-tidy. : defaultChecks(queryClangTidyChecks(executablePath, {})) // Yup, behaves as clang-tidy.
, supportedChecks(querySupportedClazyChecks(executablePath)) , supportedChecks(querySupportedClazyChecks(executablePath))
{} {
QString output = runExecutable(CommandLine(executablePath, {"--version"}),
QueryFailMode::Silent);
QTextStream stream(&output);
while (!stream.atEnd()) {
// It's just "clazy version " right now, but let's be prepared for someone adding a colon
// later on.
static const QStringList versionPrefixes{"clazy version ", "clazy version: "};
const QString line = stream.readLine().simplified();
for (const QString &prefix : versionPrefixes) {
if (line.startsWith(prefix)) {
version = QVersionNumber::fromString(line.mid(prefix.length()));
break;
}
}
}
}
static FilePath queryResourceDir(const FilePath &clangToolPath) static FilePath queryResourceDir(const FilePath &clangToolPath)
{ {

View File

@@ -30,6 +30,7 @@
#include <QPair> #include <QPair>
#include <QStringList> #include <QStringList>
#include <QVector> #include <QVector>
#include <QVersionNumber>
namespace ClangTools { namespace ClangTools {
namespace Internal { namespace Internal {
@@ -60,6 +61,8 @@ class ClazyStandaloneInfo
{ {
public: public:
ClazyStandaloneInfo(const QString &executablePath); ClazyStandaloneInfo(const QString &executablePath);
QVersionNumber version;
QStringList defaultChecks; QStringList defaultChecks;
ClazyChecks supportedChecks; ClazyChecks supportedChecks;
}; };

View File

@@ -203,6 +203,7 @@ private slots:
void test_quickfix_MoveFuncDefOutside_respectWsInOperatorNames2(); void test_quickfix_MoveFuncDefOutside_respectWsInOperatorNames2();
void test_quickfix_MoveFuncDefOutside_macroUses(); void test_quickfix_MoveFuncDefOutside_macroUses();
void test_quickfix_MoveFuncDefOutside_template(); void test_quickfix_MoveFuncDefOutside_template();
void test_quickfix_MoveFuncDefOutside_template_specializedClass();
void test_quickfix_MoveFuncDefOutside_unnamedTemplate(); void test_quickfix_MoveFuncDefOutside_unnamedTemplate();
void test_quickfix_MoveFuncDefOutside_MemberFuncToCpp_Static(); void test_quickfix_MoveFuncDefOutside_MemberFuncToCpp_Static();
void test_quickfix_MoveFuncDefOutside_MemberFuncToCpp_WithInlinePartOfName(); void test_quickfix_MoveFuncDefOutside_MemberFuncToCpp_WithInlinePartOfName();

View File

@@ -907,6 +907,34 @@ void CppEditorPlugin::test_quickfix_data()
"}\n" "}\n"
); );
// Checks: Complete switch statement where enum is return type of a template function
// which is outside the scope of the return value.
// TODO: Type minimization.
QTest::newRow("CompleteSwitchCaseStatement_QTCREATORBUG-25998")
<< CppQuickFixFactoryPtr(new CompleteSwitchCaseStatement) << _(
"template <typename T> T enumCast(int value) { return static_cast<T>(value); }\n"
"class Test {\n"
" enum class E { V1, V2 };"
" void func(int i) {\n"
" @switch (enumCast<E>(i)) {\n"
" }\n"
" }\n"
"};\n"
) << _(
"template <typename T> T enumCast(int value) { return static_cast<T>(value); }\n"
"class Test {\n"
" enum class E { V1, V2 };"
" void func(int i) {\n"
" switch (enumCast<E>(i)) {\n"
" case Test::E::V1:\n"
" break;\n"
" case Test::E::V2:\n"
" break;\n"
" }\n"
" }\n"
"};\n"
);
// Checks: No special treatment for reference to non const. // Checks: No special treatment for reference to non const.
// Check: Quick fix is not triggered on a member function. // Check: Quick fix is not triggered on a member function.
@@ -6521,6 +6549,33 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_template()
QuickFixOperationTest(singleDocument(original, expected), &factory); QuickFixOperationTest(singleDocument(original, expected), &factory);
} }
void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_template_specializedClass()
{
QByteArray original = R"(
template<typename T> class base {};
template<>
class base<int>
{
public:
void @bar() {}
};
)";
QByteArray expected = R"(
template<typename T> class base {};
template<>
class base<int>
{
public:
void bar();
};
void base<int>::bar() {}
)";
MoveFuncDefOutside factory;
QuickFixOperationTest(singleDocument(original, expected), &factory);
}
void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_unnamedTemplate() void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_unnamedTemplate()
{ {
QByteArray original = QByteArray original =

View File

@@ -98,12 +98,5 @@ const char SYMBOLS_FIND_FILTER_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("CppTools", "C
constexpr const char CLANG_STATIC_ANALYZER_DOCUMENTATION_URL[] constexpr const char CLANG_STATIC_ANALYZER_DOCUMENTATION_URL[]
= "https://clang-analyzer.llvm.org/available_checks.html"; = "https://clang-analyzer.llvm.org/available_checks.html";
// CLANG-UPGRADE-CHECK: Checks/update URLs.
//
// Once it gets dedicated documentation pages for released versions,
// use them instead of pointing to master, as checks might vanish.
constexpr const char CLAZY_DOCUMENTATION_URL_TEMPLATE[]
= "https://github.com/KDE/clazy/blob/master/docs/checks/README-%1.md";
} // namespace Constants } // namespace Constants
} // namespace CppTools } // namespace CppTools

View File

@@ -146,7 +146,9 @@ TypeHierarchy TypeHierarchyBuilder::buildDerivedTypeHierarchy(QFutureInterfaceBa
return hierarchy; return hierarchy;
} }
LookupItem TypeHierarchyBuilder::followTypedef(const LookupContext &context, const Name *symbolName, Scope *enclosingScope) LookupItem TypeHierarchyBuilder::followTypedef(const LookupContext &context, const Name *symbolName,
Scope *enclosingScope,
std::set<const Symbol *> typedefs)
{ {
QList<LookupItem> items = context.lookup(symbolName, enclosingScope); QList<LookupItem> items = context.lookup(symbolName, enclosingScope);
@@ -159,6 +161,8 @@ LookupItem TypeHierarchyBuilder::followTypedef(const LookupContext &context, con
continue; continue;
if (!s->isClass() && !s->isTemplate() && !s->isTypedef()) if (!s->isClass() && !s->isTemplate() && !s->isTypedef())
continue; continue;
if (!typedefs.insert(s).second)
continue;
actualBaseSymbol = s; actualBaseSymbol = s;
matchingItem = item; matchingItem = item;
break; break;
@@ -173,7 +177,8 @@ LookupItem TypeHierarchyBuilder::followTypedef(const LookupContext &context, con
// Anonymous aggregate such as: typedef struct {} Empty; // Anonymous aggregate such as: typedef struct {} Empty;
return LookupItem(); return LookupItem();
} }
return followTypedef(context, namedType->name(), actualBaseSymbol->enclosingScope()); return followTypedef(context, namedType->name(), actualBaseSymbol->enclosingScope(),
typedefs);
} }
return matchingItem; return matchingItem;

View File

@@ -34,6 +34,8 @@
#include <QList> #include <QList>
#include <QSet> #include <QSet>
#include <set>
namespace CPlusPlus { namespace CPlusPlus {
class LookupContext; class LookupContext;
class LookupItem; class LookupItem;
@@ -72,7 +74,8 @@ public:
const CPlusPlus::Snapshot &snapshot); const CPlusPlus::Snapshot &snapshot);
static CPlusPlus::LookupItem followTypedef(const CPlusPlus::LookupContext &context, static CPlusPlus::LookupItem followTypedef(const CPlusPlus::LookupContext &context,
const CPlusPlus::Name *symbolName, const CPlusPlus::Name *symbolName,
CPlusPlus::Scope *enclosingScope); CPlusPlus::Scope *enclosingScope,
std::set<const CPlusPlus::Symbol *> typedefs = {});
private: private:
TypeHierarchyBuilder() = default; TypeHierarchyBuilder() = default;
void buildDerived(QFutureInterfaceBase &futureInterface, TypeHierarchy *typeHierarchy, void buildDerived(QFutureInterfaceBase &futureInterface, TypeHierarchy *typeHierarchy,

View File

@@ -314,6 +314,7 @@ public:
void tryCreateLocalFileAccess(); void tryCreateLocalFileAccess();
void startContainer();
void stopCurrentContainer(); void stopCurrentContainer();
void fetchSystemEnviroment(); void fetchSystemEnviroment();
@@ -778,11 +779,8 @@ void DockerDevicePrivate::stopCurrentContainer()
proc.runBlocking(); proc.runBlocking();
} }
void DockerDevicePrivate::tryCreateLocalFileAccess() void DockerDevicePrivate::startContainer()
{ {
if (!m_container.isEmpty() || m_accessible == NoDaemon)
return;
QString tempFileName; QString tempFileName;
{ {
@@ -811,6 +809,7 @@ void DockerDevicePrivate::tryCreateLocalFileAccess()
dockerRun.addArg("/bin/sh"); dockerRun.addArg("/bin/sh");
LOG("RUNNING: " << dockerRun.toUserOutput()); LOG("RUNNING: " << dockerRun.toUserOutput());
QTC_ASSERT(!m_shell, delete m_shell);
m_shell = new QtcProcess; m_shell = new QtcProcess;
m_shell->setCommand(dockerRun); m_shell->setCommand(dockerRun);
connect(m_shell, &QtcProcess::finished, this, [this] { connect(m_shell, &QtcProcess::finished, this, [this] {
@@ -858,6 +857,14 @@ void DockerDevicePrivate::tryCreateLocalFileAccess()
qApp->processEvents(); // FIXME turn this for-loop into QEventLoop qApp->processEvents(); // FIXME turn this for-loop into QEventLoop
QThread::msleep(100); QThread::msleep(100);
} }
}
void DockerDevicePrivate::tryCreateLocalFileAccess()
{
if (!m_container.isEmpty() || m_accessible == NoDaemon)
return;
startContainer();
QtcProcess proc; QtcProcess proc;
proc.setCommand({"docker", {"inspect", "--format={{.GraphDriver.Data.MergedDir}}", m_container}}); proc.setCommand({"docker", {"inspect", "--format={{.GraphDriver.Data.MergedDir}}", m_container}});

View File

@@ -106,6 +106,8 @@ void BuildDirectoryAspect::fromMap(const QVariantMap &map)
if (!d->sourceDir.isEmpty()) { if (!d->sourceDir.isEmpty()) {
d->savedShadowBuildDir = FilePath::fromString(map.value(settingsKey() + ".shadowDir") d->savedShadowBuildDir = FilePath::fromString(map.value(settingsKey() + ".shadowDir")
.toString()); .toString());
if (d->savedShadowBuildDir.isEmpty())
setFilePath(d->sourceDir);
setChecked(d->sourceDir != filePath()); setChecked(d->sourceDir != filePath());
} }
} }

View File

@@ -27,6 +27,7 @@
#include "buildinfo.h" #include "buildinfo.h"
#include "buildstepspage.h" #include "buildstepspage.h"
#include "target.h" #include "target.h"
#include "project.h"
#include "buildconfiguration.h" #include "buildconfiguration.h"
#include "projectconfigurationmodel.h" #include "projectconfigurationmodel.h"
#include "session.h" #include "session.h"
@@ -300,16 +301,16 @@ void BuildSettingsWidget::cloneConfiguration()
return; return;
bc->setDisplayName(name); bc->setDisplayName(name);
const std::function<bool(const QString &)> isBuildDirOk = [this](const QString &candidate) { const FilePath buildDirectory = bc->buildDirectory();
const auto fp = FilePath::fromString(candidate); if (buildDirectory != m_target->project()->projectDirectory()) {
if (fp.exists()) const std::function<bool(const FilePath &)> isBuildDirOk = [this](const FilePath &candidate) {
if (candidate.exists())
return false; return false;
return !anyOf(m_target->buildConfigurations(), [&fp](const BuildConfiguration *bc) { return !anyOf(m_target->buildConfigurations(), [&candidate](const BuildConfiguration *bc) {
return bc->buildDirectory() == fp; }); return bc->buildDirectory() == candidate; });
}; };
bc->setBuildDirectory(FilePath::fromString(makeUniquelyNumbered( bc->setBuildDirectory(makeUniquelyNumbered(buildDirectory, isBuildDirOk));
bc->buildDirectory().toString(), }
isBuildDirOk)));
m_target->addBuildConfiguration(bc); m_target->addBuildConfiguration(bc);
SessionManager::setActiveBuildConfiguration(m_target, bc, SetActive::Cascade); SessionManager::setActiveBuildConfiguration(m_target, bc, SetActive::Cascade);
} }

View File

@@ -48,6 +48,9 @@ bool ItemLibraryCategory::categoryExpanded() const
QString ItemLibraryCategory::sortingName() const QString ItemLibraryCategory::sortingName() const
{ {
if (ItemLibraryModel::categorySortingHash.contains(categoryName()))
return ItemLibraryModel::categorySortingHash.value(categoryName());
return categoryName(); return categoryName();
} }

View File

@@ -350,8 +350,11 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model)
} else if (catName == ItemLibraryImport::quick3DAssetsTitle()) { } else if (catName == ItemLibraryImport::quick3DAssetsTitle()) {
importSection = importHash[ItemLibraryImport::quick3DAssetsTitle()]; importSection = importHash[ItemLibraryImport::quick3DAssetsTitle()];
} else { } else {
if (catName.startsWith("Qt Quick - ")) if (catName.contains("Qt Quick - ")) {
catName = catName.mid(11); // remove "Qt Quick - " QString sortingName = catName;
catName = catName.mid(11 + catName.indexOf("Qt Quick - ")); // remove "Qt Quick - " or "x.Qt Quick - "
categorySortingHash.insert(catName, sortingName);
}
importSection = importHash[entry.requiredImport().isEmpty() ? "QtQuick" importSection = importHash[entry.requiredImport().isEmpty() ? "QtQuick"
: entry.requiredImport()]; : entry.requiredImport()];

View File

@@ -80,6 +80,8 @@ public:
Import entryToImport(const ItemLibraryEntry &entry); Import entryToImport(const ItemLibraryEntry &entry);
inline static QHash<QString, QString> categorySortingHash;
signals: signals:
void isAnyCategoryHiddenChanged(); void isAnyCategoryHiddenChanged();

View File

@@ -366,6 +366,19 @@ static void warnAboutInvalidKit()
).arg(Core::Constants::IDE_DISPLAY_NAME)); ).arg(Core::Constants::IDE_DISPLAY_NAME));
} }
static Utils::FilePath pathForBinPuppet(ProjectExplorer::Target *target)
{
if (!target || !target->kit())
return {};
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(target->kit());
if (currentQtVersion)
return currentQtVersion->binPath() / Utils::HostOsInfo::withExecutableSuffix("qml2puppet");
return {};
}
void PuppetCreator::createQml2PuppetExecutableIfMissing() void PuppetCreator::createQml2PuppetExecutableIfMissing()
{ {
m_availablePuppetType = FallbackPuppet; m_availablePuppetType = FallbackPuppet;
@@ -387,6 +400,10 @@ void PuppetCreator::createQml2PuppetExecutableIfMissing()
m_qml2PuppetForKitPuppetHash.insert(m_target->id(), m_availablePuppetType); m_qml2PuppetForKitPuppetHash.insert(m_target->id(), m_availablePuppetType);
} }
} }
} else if (m_target->kit()->isValid()) {
if (pathForBinPuppet(m_target).isExecutableFile())
m_availablePuppetType = BinPathPuppet;
} }
} }
@@ -415,6 +432,9 @@ QString PuppetCreator::qmlPuppetDirectory(PuppetType puppetType) const
+ '/' + QString::fromLatin1(qtHash()); + '/' + QString::fromLatin1(qtHash());
#ifndef QMLDESIGNER_TEST #ifndef QMLDESIGNER_TEST
if (puppetType == BinPathPuppet)
return pathForBinPuppet(m_target).toFileInfo().absoluteDir().canonicalPath();
return qmlPuppetFallbackDirectory(m_designerSettings); return qmlPuppetFallbackDirectory(m_designerSettings);
#else #else
return QString(); return QString();
@@ -461,7 +481,7 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
static const QString pathSep = Utils::HostOsInfo::pathListSeparator(); static const QString pathSep = Utils::HostOsInfo::pathListSeparator();
Utils::Environment environment = Utils::Environment::systemEnvironment(); Utils::Environment environment = Utils::Environment::systemEnvironment();
if (QTC_GUARD(m_target)) { if (QTC_GUARD(m_target)) {
if (!useOnlyFallbackPuppet()) if (!useOnlyFallbackPuppet() || m_availablePuppetType == BinPathPuppet) {
m_target->kit()->addToBuildEnvironment(environment); m_target->kit()->addToBuildEnvironment(environment);
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(m_target->kit()); const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(m_target->kit());
if (QTC_GUARD(qt)) { // Kits without a Qt version should not have a puppet! if (QTC_GUARD(qt)) { // Kits without a Qt version should not have a puppet!
@@ -470,6 +490,7 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
environment.prependOrSetPath(qtBinPath.toString()); environment.prependOrSetPath(qtBinPath.toString());
} }
} }
}
environment.set("QML_BAD_GUI_RENDER_LOOP", "true"); environment.set("QML_BAD_GUI_RENDER_LOOP", "true");
environment.set("QML_PUPPET_MODE", "true"); environment.set("QML_PUPPET_MODE", "true");
environment.set("QML_DISABLE_DISK_CACHE", "true"); environment.set("QML_DISABLE_DISK_CACHE", "true");

View File

@@ -46,10 +46,7 @@ class Model;
class PuppetCreator class PuppetCreator
{ {
public: public:
enum PuppetType { enum PuppetType { FallbackPuppet, UserSpacePuppet, BinPathPuppet };
FallbackPuppet,
UserSpacePuppet
};
PuppetCreator(ProjectExplorer::Target *target, const Model *model); PuppetCreator(ProjectExplorer::Target *target, const Model *model);

View File

@@ -10,7 +10,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Item" name: "Item"
category: "Qt Quick - Basic" category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/item-icon.png" libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0" version: "2.0"
@@ -25,7 +25,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Rectangle" name: "Rectangle"
category: "Qt Quick - Basic" category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/rect-icon.png" libraryIcon: ":/qtquickplugin/images/rect-icon.png"
version: "2.0" version: "2.0"
@@ -41,7 +41,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Text" name: "Text"
category: "Qt Quick - Basic" category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/text-icon.png" libraryIcon: ":/qtquickplugin/images/text-icon.png"
version: "2.0" version: "2.0"
@@ -56,7 +56,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Text Edit" name: "Text Edit"
category: "Qt Quick - Basic" category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/text-edit-icon.png" libraryIcon: ":/qtquickplugin/images/text-edit-icon.png"
version: "2.0" version: "2.0"
@@ -73,7 +73,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Text Input" name: "Text Input"
category: "Qt Quick - Basic" category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/text-input-icon.png" libraryIcon: ":/qtquickplugin/images/text-input-icon.png"
version: "2.0" version: "2.0"
@@ -90,7 +90,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Mouse Area" name: "Mouse Area"
category: "Qt Quick - Basic" category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/mouse-area-icon.png" libraryIcon: ":/qtquickplugin/images/mouse-area-icon.png"
version: "2.0" version: "2.0"
@@ -105,7 +105,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Image" name: "Image"
category: "Qt Quick - Basic" category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/image-icon.png" libraryIcon: ":/qtquickplugin/images/image-icon.png"
version: "2.0" version: "2.0"
@@ -122,7 +122,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Animated Image" name: "Animated Image"
category: "Qt Quick - Basic" category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/animated-image-icon.png" libraryIcon: ":/qtquickplugin/images/animated-image-icon.png"
version: "2.0" version: "2.0"
@@ -138,7 +138,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Border Image" name: "Border Image"
category: "Qt Quick - Basic" category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/border-image-icon.png" libraryIcon: ":/qtquickplugin/images/border-image-icon.png"
version: "2.0" version: "2.0"
@@ -154,7 +154,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Flickable" name: "Flickable"
category: "Qt Quick - Basic" category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/flickable-icon.png" libraryIcon: ":/qtquickplugin/images/flickable-icon.png"
version: "2.0" version: "2.0"
@@ -169,7 +169,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Grid View" name: "Grid View"
category: "Qt Quick - Views" category: "b.Qt Quick - Views"
libraryIcon: ":/qtquickplugin/images/gridview-icon.png" libraryIcon: ":/qtquickplugin/images/gridview-icon.png"
version: "2.0" version: "2.0"
@@ -183,7 +183,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "List View" name: "List View"
category: "Qt Quick - Views" category: "b.Qt Quick - Views"
libraryIcon: ":/qtquickplugin/images/listview-icon.png" libraryIcon: ":/qtquickplugin/images/listview-icon.png"
version: "2.0" version: "2.0"
@@ -197,7 +197,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Path View" name: "Path View"
category: "Qt Quick - Views" category: "b.Qt Quick - Views"
libraryIcon: ":/qtquickplugin/images/pathview-icon.png" libraryIcon: ":/qtquickplugin/images/pathview-icon.png"
version: "2.0" version: "2.0"
@@ -211,7 +211,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Focus Scope" name: "Focus Scope"
category: "Qt Quick - Basic" category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/focusscope-icon.png" libraryIcon: ":/qtquickplugin/images/focusscope-icon.png"
version: "2.0" version: "2.0"
@@ -226,7 +226,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Column" name: "Column"
category: "Qt Quick - Positioner" category: "c.Qt Quick - Positioner"
libraryIcon: ":/qtquickplugin/images/column-positioner-icon.png" libraryIcon: ":/qtquickplugin/images/column-positioner-icon.png"
version: "2.0" version: "2.0"
@@ -241,7 +241,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Row" name: "Row"
category: "Qt Quick - Positioner" category: "c.Qt Quick - Positioner"
libraryIcon: ":/qtquickplugin/images/row-positioner-icon.png" libraryIcon: ":/qtquickplugin/images/row-positioner-icon.png"
version: "2.0" version: "2.0"
@@ -256,7 +256,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Grid" name: "Grid"
category: "Qt Quick - Positioner" category: "c.Qt Quick - Positioner"
libraryIcon: ":/qtquickplugin/images/grid-positioner-icon.png" libraryIcon: ":/qtquickplugin/images/grid-positioner-icon.png"
version: "2.0" version: "2.0"
@@ -271,7 +271,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Flow" name: "Flow"
category: "Qt Quick - Positioner" category: "c.Qt Quick - Positioner"
libraryIcon: ":/qtquickplugin/images/flow-positioner-icon.png" libraryIcon: ":/qtquickplugin/images/flow-positioner-icon.png"
version: "2.0" version: "2.0"
@@ -293,7 +293,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Property Animation" name: "Property Animation"
category: "Qt Quick - Animation" category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png" libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0" version: "2.0"
} }
@@ -312,7 +312,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Pause Animation" name: "Pause Animation"
category: "Qt Quick - Animation" category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png" libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0" version: "2.0"
} }
@@ -330,7 +330,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Sequential Animation" name: "Sequential Animation"
category: "Qt Quick - Animation" category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png" libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0" version: "2.0"
} }
@@ -348,7 +348,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Parallel Animation" name: "Parallel Animation"
category: "Qt Quick - Animation" category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png" libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0" version: "2.0"
} }
@@ -367,7 +367,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Property Action" name: "Property Action"
category: "Qt Quick - Animation" category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png" libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0" version: "2.0"
} }
@@ -386,7 +386,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Script Action" name: "Script Action"
category: "Qt Quick - Animation" category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png" libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0" version: "2.0"
} }
@@ -405,7 +405,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "ColorAnimation" name: "ColorAnimation"
category: "Qt Quick - Animation" category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png" libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0" version: "2.0"
} }
@@ -424,7 +424,7 @@ MetaInfo {
ItemLibraryEntry { ItemLibraryEntry {
name: "Number Animation" name: "Number Animation"
category: "Qt Quick - Animation" category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png" libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0" version: "2.0"
Property { name: "to"; type: "int"; value: 0; } Property { name: "to"; type: "int"; value: 0; }

View File

@@ -105,6 +105,10 @@ QmlProjectItem *QmlProjectFileFormat::parseProjectFile(const Utils::FilePath &fi
if (qtForMCUProperty.isValid() && qtForMCUProperty.toBool()) if (qtForMCUProperty.isValid() && qtForMCUProperty.toBool())
projectItem->setQtForMCUs(qtForMCUProperty.toBool()); projectItem->setQtForMCUs(qtForMCUProperty.toBool());
const QVariant qt6ProjectProperty = rootNode->property("qt6Project");
if (qt6ProjectProperty.isValid() && qt6ProjectProperty.toBool())
projectItem->setQt6Project(qt6ProjectProperty.toBool());
if (debug) if (debug)
qDebug() << "importPath:" << importPathsProperty << "mainFile:" << mainFileProperty; qDebug() << "importPath:" << importPathsProperty << "mainFile:" << mainFileProperty;

View File

@@ -60,6 +60,11 @@ void QmlProjectItem::setQtForMCUs(bool b)
m_qtForMCUs = b; m_qtForMCUs = b;
} }
void QmlProjectItem::setQt6Project(bool qt6Project)
{
m_qt6Project = qt6Project;
}
void QmlProjectItem::setImportPaths(const QStringList &importPaths) void QmlProjectItem::setImportPaths(const QStringList &importPaths)
{ {
if (m_importPaths != importPaths) if (m_importPaths != importPaths)

View File

@@ -54,6 +54,9 @@ public:
bool qtForMCUs() const { return m_qtForMCUs; } bool qtForMCUs() const { return m_qtForMCUs; }
void setQtForMCUs(bool qtForMCUs); void setQtForMCUs(bool qtForMCUs);
bool qt6Project() const { return m_qt6Project; }
void setQt6Project(bool qt6Project);
QStringList importPaths() const { return m_importPaths; } QStringList importPaths() const { return m_importPaths; }
void setImportPaths(const QStringList &paths); void setImportPaths(const QStringList &paths);
@@ -87,6 +90,7 @@ protected:
QVector<QmlProjectContentItem *> m_content; // content property QVector<QmlProjectContentItem *> m_content; // content property
bool m_forceFreeType = false; bool m_forceFreeType = false;
bool m_qtForMCUs = false; bool m_qtForMCUs = false;
bool m_qt6Project = false;
}; };
} // namespace QmlProjectManager } // namespace QmlProjectManager

View File

@@ -272,6 +272,13 @@ bool QmlBuildSystem::qtForMCUs() const
return false; return false;
} }
bool QmlBuildSystem::qt6Project() const
{
if (m_projectItem)
return m_projectItem.data()->qt6Project();
return false;
}
void QmlBuildSystem::setMainFile(const QString &mainFilePath) void QmlBuildSystem::setMainFile(const QString &mainFilePath)
{ {
if (m_projectItem) if (m_projectItem)
@@ -466,6 +473,8 @@ QVariant QmlBuildSystem::additionalData(Id id) const
return forceFreeType(); return forceFreeType();
if (id == Constants::customQtForMCUs) if (id == Constants::customQtForMCUs)
return qtForMCUs(); return qtForMCUs();
if (id == Constants::customQt6Project)
return qt6Project();
return {}; return {};
} }

View File

@@ -79,6 +79,7 @@ public:
Utils::FilePath mainFilePath() const; Utils::FilePath mainFilePath() const;
bool qtForMCUs() const; bool qtForMCUs() const;
bool qt6Project() const;
void setMainFile(const QString &mainFilePath); void setMainFile(const QString &mainFilePath);
Utils::FilePath targetDirectory() const; Utils::FilePath targetDirectory() const;
Utils::FilePath targetFile(const Utils::FilePath &sourceFile) const; Utils::FilePath targetFile(const Utils::FilePath &sourceFile) const;

View File

@@ -34,6 +34,7 @@ const char * const QMLPROJECT_MIMETYPE = QmlJSTools::Constants::QMLPROJECT_MIMET
const char customFileSelectorsData[] = "CustomFileSelectorsData"; const char customFileSelectorsData[] = "CustomFileSelectorsData";
const char customForceFreeTypeData[] = "CustomForceFreeType"; const char customForceFreeTypeData[] = "CustomForceFreeType";
const char customQtForMCUs[] = "CustomQtForMCUs"; const char customQtForMCUs[] = "CustomQtForMCUs";
const char customQt6Project[] = "CustomQt6Project";
} // namespace Constants } // namespace Constants
} // namespace QmlProjectManager } // namespace QmlProjectManager

View File

@@ -41,12 +41,12 @@ using namespace ProjectExplorer;
namespace QtSupport { namespace QtSupport {
// opt. drive letter + filename: (2 brackets) // opt. drive letter + filename: (2 brackets)
#define FILE_PATTERN "^(([A-Za-z]:)?[^:]+\\.[^:]+)" #define FILE_PATTERN R"(^(?<file>(?:[A-Za-z]:)?[^:\(]+\.[^:\(]+))"
QtParser::QtParser() : QtParser::QtParser() :
m_mocRegExp(QLatin1String(FILE_PATTERN"[:\\(](\\d+?)\\)?:\\s([Ww]arning|[Ee]rror|[Nn]ote):\\s(.+?)$")), m_mocRegExp(FILE_PATTERN R"([:\(](?<line>\d+)?(?::(?<column>\d+))?\)?:\s(?<level>[Ww]arning|[Ee]rror|[Nn]ote):\s(?<description>.+?)$)"),
m_uicRegExp(QLatin1String(FILE_PATTERN": Warning:\\s(?<msg>.+?)$")), m_uicRegExp(FILE_PATTERN R"(: Warning:\s(?<msg>.+?)$)"),
m_translationRegExp(QLatin1String("^([Ww]arning|[Ee]rror):\\s+(.*?) in '(.*?)'$")) m_translationRegExp(R"(^(?<level>[Ww]arning|[Ee]rror):\s+(?<description>.*?) in '(?<file>.*?)'$)")
{ {
setObjectName(QLatin1String("QtParser")); setObjectName(QLatin1String("QtParser"));
} }
@@ -60,20 +60,21 @@ Utils::OutputLineParser::Result QtParser::handleLine(const QString &line, Utils:
QRegularExpressionMatch match = m_mocRegExp.match(lne); QRegularExpressionMatch match = m_mocRegExp.match(lne);
if (match.hasMatch()) { if (match.hasMatch()) {
bool ok; bool ok;
int lineno = match.captured(3).toInt(&ok); int lineno = match.captured("line").toInt(&ok);
if (!ok) if (!ok)
lineno = -1; lineno = -1;
Task::TaskType type = Task::Error; Task::TaskType type = Task::Error;
const QString level = match.captured(4); const QString level = match.captured("level");
if (level.compare(QLatin1String("Warning"), Qt::CaseInsensitive) == 0) if (level.compare(QLatin1String("Warning"), Qt::CaseInsensitive) == 0)
type = Task::Warning; type = Task::Warning;
if (level.compare(QLatin1String("Note"), Qt::CaseInsensitive) == 0) if (level.compare(QLatin1String("Note"), Qt::CaseInsensitive) == 0)
type = Task::Unknown; type = Task::Unknown;
LinkSpecs linkSpecs; LinkSpecs linkSpecs;
const Utils::FilePath file const Utils::FilePath file
= absoluteFilePath(Utils::FilePath::fromUserInput(match.captured(1))); = absoluteFilePath(Utils::FilePath::fromUserInput(match.captured("file")));
addLinkSpecForAbsoluteFilePath(linkSpecs, file, lineno, match, 1); addLinkSpecForAbsoluteFilePath(linkSpecs, file, lineno, match, "file");
CompileTask task(type, match.captured(5).trimmed() /* description */, file, lineno); CompileTask task(type, match.captured("description").trimmed(), file, lineno);
task.column = match.captured("column").toInt();
scheduleTask(task, 1); scheduleTask(task, 1);
return {Status::Done, linkSpecs}; return {Status::Done, linkSpecs};
} }
@@ -88,7 +89,7 @@ Utils::OutputLineParser::Result QtParser::handleLine(const QString &line, Utils:
message.prepend(": ").prepend(fileName); message.prepend(": ").prepend(fileName);
} else if (fileName.endsWith(".ui")) { } else if (fileName.endsWith(".ui")) {
filePath = absoluteFilePath(Utils::FilePath::fromUserInput(fileName)); filePath = absoluteFilePath(Utils::FilePath::fromUserInput(fileName));
addLinkSpecForAbsoluteFilePath(linkSpecs, filePath, -1, match, 1); addLinkSpecForAbsoluteFilePath(linkSpecs, filePath, -1, match, "file");
} else { } else {
isUicMessage = false; isUicMessage = false;
} }
@@ -100,13 +101,13 @@ Utils::OutputLineParser::Result QtParser::handleLine(const QString &line, Utils:
match = m_translationRegExp.match(line); match = m_translationRegExp.match(line);
if (match.hasMatch()) { if (match.hasMatch()) {
Task::TaskType type = Task::Warning; Task::TaskType type = Task::Warning;
if (match.captured(1) == QLatin1String("Error")) if (match.captured("level") == QLatin1String("Error"))
type = Task::Error; type = Task::Error;
LinkSpecs linkSpecs; LinkSpecs linkSpecs;
const Utils::FilePath file const Utils::FilePath file
= absoluteFilePath(Utils::FilePath::fromUserInput(match.captured(3))); = absoluteFilePath(Utils::FilePath::fromUserInput(match.captured("file")));
addLinkSpecForAbsoluteFilePath(linkSpecs, file, 0, match, 3); addLinkSpecForAbsoluteFilePath(linkSpecs, file, 0, match, "file");
CompileTask task(type, match.captured(2), file); CompileTask task(type, match.captured("description"), file);
scheduleTask(task, 1); scheduleTask(task, 1);
return {Status::Done, linkSpecs}; return {Status::Done, linkSpecs};
} }
@@ -177,6 +178,22 @@ void QtSupportPlugin::testQtOutputParser_data()
QLatin1String("Property declaration ) has no READ accessor function. The property will be invalid."), QLatin1String("Property declaration ) has no READ accessor function. The property will be invalid."),
Utils::FilePath::fromUserInput(QLatin1String("c:\\code\\test.h")), 96)) Utils::FilePath::fromUserInput(QLatin1String("c:\\code\\test.h")), 96))
<< QString(); << QString();
QTest::newRow("moc warning (Qt 6/Windows)")
<< QString::fromLatin1(R"(C:/Users/alportal/dev/qt-creator-qt6/src/plugins/qmlprofiler/qmlprofilerplugin.h(38:1): error: Plugin Metadata file "QmlProfiler.json" does not exist. Declaration will be ignored)")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks() << CompileTask(Task::Error,
R"(Plugin Metadata file "QmlProfiler.json" does not exist. Declaration will be ignored)",
Utils::FilePath::fromUserInput("C:/Users/alportal/dev/qt-creator-qt6/src/plugins/qmlprofiler/qmlprofilerplugin.h"), 38, 1))
<< QString();
QTest::newRow("moc warning (Qt 6/Unix)")
<< QString::fromLatin1(R"(/Users/alportal/dev/qt-creator-qt6/src/plugins/qmlprofiler/qmlprofilerplugin.h:38:1: error: Plugin Metadata file "QmlProfiler.json" does not exist. Declaration will be ignored)")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks() << CompileTask(Task::Error,
R"(Plugin Metadata file "QmlProfiler.json" does not exist. Declaration will be ignored)",
Utils::FilePath::fromUserInput("/Users/alportal/dev/qt-creator-qt6/src/plugins/qmlprofiler/qmlprofilerplugin.h"), 38, 1))
<< QString();
QTest::newRow("moc note") QTest::newRow("moc note")
<< QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.") << QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.")
<< OutputParserTester::STDERR << OutputParserTester::STDERR

View File

@@ -53,21 +53,23 @@ Item {
model: ProjectModel { model: ProjectModel {
id: projectModel id: projectModel
} }
onItemSelected: projectModel.openProjectAt(index) onItemSelected: function(index, item) { projectModel.openProjectAt(index) }
} }
} }
CustomScrollView { CustomScrollView {
ProjectsGrid { ProjectsGrid {
model: ExamplesModel {} model: ExamplesModel {}
onItemSelected: projectModel.openExample(item.projectName, item.qmlFileName, item.url) onItemSelected: function(index, item) {
projectModel.openExample(item.projectName, item.qmlFileName, item.url)
}
} }
} }
CustomScrollView{ CustomScrollView{
ProjectsGrid { ProjectsGrid {
model: TutorialsModel {} model: TutorialsModel {}
onItemSelected: Qt.openUrlExternally(item.url) onItemSelected: function(index, item) { Qt.openUrlExternally(item.url) }
} }
} }
} }