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 = {}
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:
printer = self.printer.gen_printer(value.nativeValue)
except:

View File

@@ -729,11 +729,18 @@ void NodeInstanceServer::setupMockupTypes(const QVector<MockupTypeContainer> &co
for (const MockupTypeContainer &mockupType : container) {
if (!isTypeAvailable(mockupType, engine()))
#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(),
mockupType.majorVersion(),
mockupType.minorVersion(),
mockupType.typeName());
}
#else
qmlRegisterType(QUrl("qrc:/qtquickplugin/mockfiles/GenericBackend.qml"),
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/
**
** 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/
**
** This file is part of Qt Creator.
@@ -24,12 +24,9 @@
****************************************************************************/
import QtQuick 2.15
import HelperWidgets 2.0
import QtQuick.Layouts 1.15
Column {
anchors.left: parent.left
anchors.right: parent.right
import HelperWidgets 2.0
import StudioTheme 1.0 as StudioTheme
Section {
anchors.left: parent.left
@@ -37,46 +34,53 @@ Column {
caption: qsTr("Connections")
SectionLayout {
Label {
PropertyLabel {
text: qsTr("Enabled")
tooltip: qsTr("Sets whether the component accepts change events.")
}
SecondColumnLayout {
CheckBox {
text: backendValues.enabled.valueToString
backendValue: backendValues.enabled
implicitWidth: 180
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
ExpandingSpacer {}
}
Label {
PropertyLabel {
text: qsTr("Ignore unknown signals")
tooltip: qsTr("Ignores runtime errors produced by connections to non-existent signals.")
}
SecondColumnLayout {
CheckBox {
text: backendValues.ignoreUnknownSignals.valueToString
backendValue: backendValues.ignoreUnknownSignals
implicitWidth: 180
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
ExpandingSpacer {}
}
Label {
PropertyLabel {
text: qsTr("Target")
tooltip: qsTr("Sets the component that sends the signal.")
}
SecondColumnLayout {
ItemFilterComboBox {
typeFilter: "QtQuick.Item"
validator: RegExpValidator { regExp: /(^$|^[a-z_]\w*)/ }
backendValue: backendValues.target
Layout.fillWidth: true
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ 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/
**
** This file is part of Qt Creator.
@@ -22,9 +22,11 @@
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick 2.1
import QtQuick 2.15
import HelperWidgets 2.0
import QtQuick.Layouts 1.0
import QtQuick.Layouts 1.15
import StudioTheme 1.0 as StudioTheme
Column {
anchors.left: parent.left
@@ -41,18 +43,17 @@ Column {
caption: qsTr("Dialog")
SectionLayout {
Label {
text: qsTr("Title")
}
PropertyLabel { text: qsTr("Title") }
SecondColumnLayout {
LineEdit {
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
}
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/
**
** This file is part of Qt Creator.
@@ -22,9 +22,11 @@
** 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 QtQuick.Layouts 1.0
import StudioTheme 1.0 as StudioTheme
Column {
anchors.left: parent.left
@@ -41,36 +43,41 @@ Column {
caption: qsTr("Drawer")
SectionLayout {
Label {
PropertyLabel {
text: qsTr("Edge")
tooltip: qsTr("Defines the edge of the window the drawer will open from.")
}
SecondColumnLayout {
ComboBox {
Layout.fillWidth: true
backendValue: backendValues.edge
scope: "Qt"
model: ["TopEdge", "LeftEdge", "RightEdge", "BottomEdge"]
}
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
Label {
text: qsTr("Drag Margin")
ExpandingSpacer {}
}
PropertyLabel {
text: qsTr("Drag margin")
tooltip: qsTr("Defines the distance from the screen edge within which drag actions will open the drawer.")
}
SecondColumnLayout {
SpinBox {
backendValue: backendValues.dragMargin
hasSlider: true
Layout.preferredWidth: 80
minimumValue: 0
maximumValue: 400
stepSize: 1
decimals: 0
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
ExpandingSpacer {
}
ExpandingSpacer {}
}
}
}
@@ -85,6 +92,5 @@ Column {
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/
**
** 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/
**
** This file is part of Qt Creator.
@@ -22,148 +22,154 @@
** 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 QtQuick.Layouts 1.0
import StudioTheme 1.0 as StudioTheme
Section {
anchors.left: parent.left
anchors.right: parent.right
caption: qsTr("Popup")
SectionLayout {
Label {
text: qsTr("Size")
}
PropertyLabel { text: qsTr("Size") }
SecondColumnLayout {
Label {
text: "W"
width: 12
}
SpinBox {
backendValue: backendValues.width
minimumValue: 0
maximumValue: 10000
decimals: 0
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
Label {
text: "H"
width: 12
Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }
ControlLabel {
//: The width of the object
text: qsTr("W", "width")
}
Spacer { implicitWidth: StudioTheme.Values.controlGap }
SpinBox {
backendValue: backendValues.height
minimumValue: 0
maximumValue: 10000
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 {
text: qsTr("Visibility")
ExpandingSpacer {}
}
PropertyLabel { text: qsTr("Visibility") }
SecondColumnLayout {
CheckBox {
text: qsTr("Is visible")
text: qsTr("Visible")
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
backendValue: backendValues.visible
Layout.preferredWidth: 100
}
Item {
width: 10
height: 10
}
Spacer { implicitWidth: StudioTheme.Values.twoControlColumnGap }
CheckBox {
text: qsTr("Clip")
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
backendValue: backendValues.clip
}
Item {
Layout.fillWidth: true
}
ExpandingSpacer {}
}
Label {
text: qsTr("Behavior")
}
PropertyLabel { text: qsTr("Behavior") }
SecondColumnLayout {
CheckBox {
text: qsTr("Modal")
backendValue: backendValues.modal
tooltip: qsTr("Defines the modality of the popup.")
Layout.preferredWidth: 100
backendValue: backendValues.modal
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
Item {
width: 10
height: 10
}
Spacer { implicitWidth: StudioTheme.Values.twoControlColumnGap }
CheckBox {
text: qsTr("Dim")
tooltip: qsTr("Defines whether the popup dims the background.")
backendValue: backendValues.dim
}
Item {
Layout.fillWidth: true
}
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
Label {
text: qsTr("Opacity")
ExpandingSpacer {}
}
PropertyLabel { text: qsTr("Opacity") }
SecondColumnLayout {
SpinBox {
backendValue: backendValues.opacity
hasSlider: true
Layout.preferredWidth: 80
minimumValue: 0
maximumValue: 1
stepSize: 0.1
decimals: 2
}
ExpandingSpacer {
}
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
Label {
text: qsTr("Scale")
ExpandingSpacer {}
}
PropertyLabel { text: qsTr("Scale") }
SecondColumnLayout {
SpinBox {
backendValue: backendValues.scale
hasSlider: true
Layout.preferredWidth: 80
minimumValue: 0
maximumValue: 1
stepSize: 0.1
decimals: 2
}
ExpandingSpacer {
}
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
Label {
ExpandingSpacer {}
}
PropertyLabel {
text: qsTr("Spacing")
tooltip: qsTr("Spacing between internal elements of the control.")
}
SecondColumnLayout {
SpinBox {
minimumValue: -4000
maximumValue: 4000
decimals: 0
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/
**
** This file is part of Qt Creator.
@@ -22,9 +22,10 @@
** 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 QtQuick.Layouts 1.0
Column {
anchors.left: parent.left
@@ -45,6 +46,5 @@ Column {
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/
**
** 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 QtQuick.Layouts 1.0
Column {
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/
**
** 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/
**
** This file is part of Qt Creator.
@@ -26,8 +26,8 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuickDesignerTheme 1.0
import QtQuick.Templates 2.15 as T
import QtQuickDesignerTheme 1.0
import HelperWidgets 2.0
import StudioControls 1.0 as StudioControls
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/
**
** 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 QtQuick 2.1
import QtQuick.Layouts 1.1
Column {
anchors.left: parent.left
anchors.right: parent.right
@@ -34,4 +35,3 @@ Column {
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/
**
** 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 QtQuick 2.1
import QtQuick.Layouts 1.1
Column {
anchors.left: parent.left
anchors.right: parent.right
@@ -34,4 +35,3 @@ Column {
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/
**
** This file is part of Qt Creator.
@@ -24,8 +24,9 @@
****************************************************************************/
import QtQuick 2.15
import HelperWidgets 2.0
import QtQuick.Layouts 1.15
import HelperWidgets 2.0
import StudioTheme 1.0 as StudioTheme
Column {
anchors.left: parent.left
@@ -37,42 +38,53 @@ Column {
caption: qsTr("State")
SectionLayout {
Label {
PropertyLabel {
text: qsTr("When")
tooltip: qsTr("Sets when the state should be applied.")
}
SecondColumnLayout {
CheckBox {
text: backendValues.when.valueToString
backendValue: backendValues.when
implicitWidth: 180
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
ExpandingSpacer {}
}
Label {
PropertyLabel {
text: qsTr("Name")
tooltip: qsTr("The name of the state.")
}
SecondColumnLayout {
LineEdit {
backendValue: backendValues.name
Layout.fillWidth: true
showTranslateCheckBox: false
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
}
ExpandingSpacer {}
}
Label {
PropertyLabel {
text: qsTr("Extend")
tooltip: qsTr("The state that this state extends.")
}
SecondColumnLayout {
LineEdit {
backendValue: backendValues.extend
Layout.fillWidth: true
showTranslateCheckBox: false
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
}
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/
**
** 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/
**
** 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 QtQuick.Layouts 1.0
Column {
anchors.left: parent.left
anchors.right: parent.right
import StudioTheme 1.0 as StudioTheme
Section {
anchors.left: parent.left
@@ -37,107 +34,93 @@ Column {
caption: qsTr("Window")
SectionLayout {
Label {
text: qsTr("Title")
}
PropertyLabel { text: qsTr("Title") }
SecondColumnLayout {
LineEdit {
backendValue: backendValues.title
Layout.fillWidth: true
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
}
ExpandingSpacer {
}
ExpandingSpacer {}
}
Label {
text: qsTr("Size")
}
PropertyLabel { text: qsTr("Size") }
SecondColumnLayout {
Label {
text: "W"
width: 12
}
SpinBox {
backendValue: backendValues.width
minimumValue: 0
maximumValue: 10000
decimals: 0
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
Label {
text: "H"
width: 12
Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }
ControlLabel {
//: The width of the object
text: qsTr("W", "width")
}
Spacer { implicitWidth: StudioTheme.Values.controlGap }
SpinBox {
backendValue: backendValues.height
minimumValue: 0
maximumValue: 10000
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 {
anchors.left: parent.left
anchors.right: parent.right
caption: qsTr("Color")
PropertyLabel { text: qsTr("Color") }
ColorEditor {
caption: qsTr("Color")
backendValue: backendValues.color
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 {
CheckBox {
backendValue: backendValues.visible
Layout.preferredWidth: 80
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
ExpandingSpacer {
ExpandingSpacer {}
}
}
Label {
text: qsTr("Opacity")
}
PropertyLabel { text: qsTr("Opacity") }
SecondColumnLayout {
SpinBox {
backendValue: backendValues.opacity
hasSlider: true
Layout.preferredWidth: 80
minimumValue: 0
maximumValue: 1
stepSize: 0.1
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/
**
** This file is part of Qt Creator.

View File

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

View File

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

View File

@@ -56,7 +56,7 @@ HelperWidgets.ComboBox {
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)
onEditTextChanged: comboBox.dirty = true

View File

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

View File

@@ -51,7 +51,9 @@ T.SpinBox {
property bool edit: spinBoxInput.activeFocus
// 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 sliderDrag: sliderPopup.drag

View File

@@ -910,7 +910,7 @@ bool ResolveExpression::visit(CallAST *ast)
if (Symbol *declaration = templateTy->declaration()) {
if (Function *funTy = declaration->asFunction()) {
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()) {
if (Template *templ = s->asTemplate()) {
QString &n = nameParts[i];
const int paramCount = templ->templateParameterCount();
if (paramCount > 0) {
n += '<';
for (int index = 0; index < templ->templateParameterCount(); ++index) {
for (int index = 0; index < paramCount; ++index) {
if (index)
n += QLatin1String(", ");
QString arg = _overview->prettyName(templ->templateParameterAt(index)->name());
QString arg = _overview->prettyName(
templ->templateParameterAt(index)->name());
if (arg.isEmpty()) {
arg += 'T';
arg += QString::number(index + 1);
@@ -402,6 +405,7 @@ void TypePrettyPrinter::visit(Function *type)
}
n += '>';
}
}
if (s->identifier())
--i;
}
@@ -435,7 +439,8 @@ void TypePrettyPrinter::visit(Function *type)
if (_overview->showEnclosingTemplate) {
if (Template *templ = type->enclosingTemplate()) {
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 (i > 0)
templateScope.append(", ");
@@ -452,6 +457,7 @@ void TypePrettyPrinter::visit(Function *type)
}
}
}
if (paramCount > 0)
_text.prepend(templateScope + ">\n");
}
}

View File

@@ -27,6 +27,7 @@
#include "clangdiagnosticmanager.h"
#include "clangtextmark.h"
#include "clangutils.h"
#include <clangsupport/sourcelocationscontainer.h>
#include <coreplugin/editormanager/editormanager.h>
@@ -35,6 +36,7 @@
#include <cplusplus/FindUsages.h>
#include <cpptools/cppeditorwidgetinterface.h>
#include <cpptools/cppfindreferences.h>
#include <cpptools/cppmodelmanager.h>
#include <cpptools/cpptoolsreuse.h>
#include <cpptools/cppvirtualfunctionassistprovider.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"};
setSupportedLanguage(langFilter);
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();
Utils::optional<TextDocumentClientCapabilities> textCaps = caps.textDocument();
if (textCaps) {

View File

@@ -81,6 +81,23 @@ static CppTools::CppModelManager *cppModelManager()
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()
: m_completionAssistProvider(m_communicator, CompletionType::Other)
, m_functionHintAssistProvider(m_communicator, CompletionType::FunctionHint)
@@ -119,6 +136,11 @@ ClangModelManagerSupport::ClangModelManagerSupport()
this, &ClangModelManagerSupport::onProjectAdded);
connect(sessionManager, &ProjectExplorer::SessionManager::aboutToRemoveProject,
this, &ClangModelManagerSupport::onAboutToRemoveProject);
connect(sessionManager, &ProjectExplorer::SessionManager::projectRemoved,
this, [this] {
if (ClangdClient * const fallbackClient = clientForProject(nullptr))
claimNonProjectSources(fallbackClient);
});
CppTools::ClangdSettings::setDefaultClangdPath(Utils::FilePath::fromString(
Core::ICore::clangdExecutable(CLANG_BINDIR)));
@@ -128,8 +150,9 @@ ClangModelManagerSupport::ClangModelManagerSupport()
connect(settings, &CppTools::CppCodeModelSettings::clangDiagnosticConfigsInvalidated,
this, &ClangModelManagerSupport::onDiagnosticConfigsInvalidated);
// TODO: Enable this once we do document-level stuff with clangd (highlighting etc)
// createClient(nullptr, {});
if (CppTools::ClangdSettings::instance().useClangd())
createClient(nullptr, {});
m_generatorSynchronizer.setCancelOnWait(true);
new ClangdQuickFixFactory(); // memory managed by CppEditor::g_cppQuickFixFactories
}
@@ -291,7 +314,7 @@ void ClangModelManagerSupport::updateLanguageClient(ProjectExplorer::Project *pr
if (Client * const oldClient = clientForProject(project))
LanguageClientManager::shutdownClient(oldClient);
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;
if (!SessionManager::hasProject(project))
return;
@@ -301,22 +324,15 @@ void ClangModelManagerSupport::updateLanguageClient(ProjectExplorer::Project *pr
return;
// Acquaint the client with all open C++ documents for this project.
ClangdClient * const fallbackClient = clientForProject(nullptr);
bool hasDocuments = false;
for (const Core::DocumentModel::Entry * const entry : Core::DocumentModel::entries()) {
const auto textDocument = qobject_cast<TextEditor::TextDocument *>(entry->document);
if (!textDocument)
for (TextEditor::BaseTextEditor * const editor : allCppEditors()) {
if (!project->isKnownFile(editor->textDocument()->filePath()))
continue;
const bool isCppDocument = Utils::contains(
Core::DocumentModel::editorsForDocument(textDocument),
[](Core::IEditor *editor) {
return CppTools::CppModelManager::isCppEditor(editor);
});
if (!isCppDocument)
continue;
if (!project->isKnownFile(entry->fileName()))
continue;
client->openDocument(textDocument);
ClangEditorDocumentProcessor::clearTextMarks(textDocument->filePath());
if (fallbackClient && fallbackClient->documentOpen(editor->textDocument()))
fallbackClient->closeDocument(editor->textDocument());
client->openDocument(editor->textDocument());
ClangEditorDocumentProcessor::clearTextMarks(editor->textDocument()->filePath());
hasDocuments = true;
}
@@ -376,6 +392,18 @@ ClangdClient *ClangModelManagerSupport::createClient(ProjectExplorer::Project *p
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)
{
QTC_ASSERT(editor, return);
@@ -389,6 +417,10 @@ void ClangModelManagerSupport::onEditorOpened(Core::IEditor *editor)
// 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::SessionManager::projectForFile(document->filePath());
if (Client * const client = clientForProject(project))
@@ -597,7 +629,6 @@ void ClangModelManagerSupport::onProjectPartsRemoved(const QStringList &projectP
void ClangModelManagerSupport::onClangdSettingsChanged()
{
// TODO: Handle also project-less client
for (ProjectExplorer::Project * const project : ProjectExplorer::SessionManager::projects()) {
const CppTools::ClangdSettings settings(
CppTools::ClangdProjectSettings(project).settings());
@@ -614,6 +645,25 @@ void ClangModelManagerSupport::onClangdSettingsChanged()
if (client->settingsData() != settings.data())
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(

View File

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

View File

@@ -522,7 +522,9 @@ private:
void addLanguageOptions()
{
// 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) {
fileKind = m_projectPart.languageVersion <= ::Utils::LanguageVersion::LatestC
? CppTools::ProjectFile::CHeader

View File

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

View File

@@ -304,7 +304,7 @@ QString documentationUrl(const QString &checkName)
const QString clangStaticAnalyzerPrefix = "clang-analyzer-core.";
if (name.startsWith(clazyPrefix)) {
name = checkName.mid(clazyPrefix.length());
url = QString(CppTools::Constants::CLAZY_DOCUMENTATION_URL_TEMPLATE).arg(name);
url = clazyDocUrl(name);
} else if (name.startsWith(clangStaticAnalyzerPrefix)) {
url = CppTools::Constants::CLANG_STATIC_ANALYZER_DOCUMENTATION_URL;
} else {
@@ -362,5 +362,16 @@ QString clangTidyDocUrl(const QString &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 ClangTools

View File

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

View File

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

View File

@@ -166,7 +166,23 @@ ClangTidyInfo::ClangTidyInfo(const QString &executablePath)
ClazyStandaloneInfo::ClazyStandaloneInfo(const QString &executablePath)
: defaultChecks(queryClangTidyChecks(executablePath, {})) // Yup, behaves as clang-tidy.
, 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)
{

View File

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

View File

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

View File

@@ -907,6 +907,34 @@ void CppEditorPlugin::test_quickfix_data()
"}\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.
// 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);
}
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()
{
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[]
= "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 CppTools

View File

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

View File

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

View File

@@ -314,6 +314,7 @@ public:
void tryCreateLocalFileAccess();
void startContainer();
void stopCurrentContainer();
void fetchSystemEnviroment();
@@ -778,11 +779,8 @@ void DockerDevicePrivate::stopCurrentContainer()
proc.runBlocking();
}
void DockerDevicePrivate::tryCreateLocalFileAccess()
void DockerDevicePrivate::startContainer()
{
if (!m_container.isEmpty() || m_accessible == NoDaemon)
return;
QString tempFileName;
{
@@ -811,6 +809,7 @@ void DockerDevicePrivate::tryCreateLocalFileAccess()
dockerRun.addArg("/bin/sh");
LOG("RUNNING: " << dockerRun.toUserOutput());
QTC_ASSERT(!m_shell, delete m_shell);
m_shell = new QtcProcess;
m_shell->setCommand(dockerRun);
connect(m_shell, &QtcProcess::finished, this, [this] {
@@ -858,6 +857,14 @@ void DockerDevicePrivate::tryCreateLocalFileAccess()
qApp->processEvents(); // FIXME turn this for-loop into QEventLoop
QThread::msleep(100);
}
}
void DockerDevicePrivate::tryCreateLocalFileAccess()
{
if (!m_container.isEmpty() || m_accessible == NoDaemon)
return;
startContainer();
QtcProcess proc;
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()) {
d->savedShadowBuildDir = FilePath::fromString(map.value(settingsKey() + ".shadowDir")
.toString());
if (d->savedShadowBuildDir.isEmpty())
setFilePath(d->sourceDir);
setChecked(d->sourceDir != filePath());
}
}

View File

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

View File

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

View File

@@ -350,8 +350,11 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model)
} else if (catName == ItemLibraryImport::quick3DAssetsTitle()) {
importSection = importHash[ItemLibraryImport::quick3DAssetsTitle()];
} else {
if (catName.startsWith("Qt Quick - "))
catName = catName.mid(11); // remove "Qt Quick - "
if (catName.contains("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"
: entry.requiredImport()];

View File

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

View File

@@ -366,6 +366,19 @@ static void warnAboutInvalidKit()
).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()
{
m_availablePuppetType = FallbackPuppet;
@@ -387,6 +400,10 @@ void PuppetCreator::createQml2PuppetExecutableIfMissing()
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());
#ifndef QMLDESIGNER_TEST
if (puppetType == BinPathPuppet)
return pathForBinPuppet(m_target).toFileInfo().absoluteDir().canonicalPath();
return qmlPuppetFallbackDirectory(m_designerSettings);
#else
return QString();
@@ -461,7 +481,7 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
static const QString pathSep = Utils::HostOsInfo::pathListSeparator();
Utils::Environment environment = Utils::Environment::systemEnvironment();
if (QTC_GUARD(m_target)) {
if (!useOnlyFallbackPuppet())
if (!useOnlyFallbackPuppet() || m_availablePuppetType == BinPathPuppet) {
m_target->kit()->addToBuildEnvironment(environment);
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(m_target->kit());
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.set("QML_BAD_GUI_RENDER_LOOP", "true");
environment.set("QML_PUPPET_MODE", "true");
environment.set("QML_DISABLE_DISK_CACHE", "true");

View File

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

View File

@@ -10,7 +10,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Item"
category: "Qt Quick - Basic"
category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0"
@@ -25,7 +25,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Rectangle"
category: "Qt Quick - Basic"
category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/rect-icon.png"
version: "2.0"
@@ -41,7 +41,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Text"
category: "Qt Quick - Basic"
category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/text-icon.png"
version: "2.0"
@@ -56,7 +56,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Text Edit"
category: "Qt Quick - Basic"
category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/text-edit-icon.png"
version: "2.0"
@@ -73,7 +73,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Text Input"
category: "Qt Quick - Basic"
category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/text-input-icon.png"
version: "2.0"
@@ -90,7 +90,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Mouse Area"
category: "Qt Quick - Basic"
category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/mouse-area-icon.png"
version: "2.0"
@@ -105,7 +105,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Image"
category: "Qt Quick - Basic"
category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/image-icon.png"
version: "2.0"
@@ -122,7 +122,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Animated Image"
category: "Qt Quick - Basic"
category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/animated-image-icon.png"
version: "2.0"
@@ -138,7 +138,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Border Image"
category: "Qt Quick - Basic"
category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/border-image-icon.png"
version: "2.0"
@@ -154,7 +154,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Flickable"
category: "Qt Quick - Basic"
category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/flickable-icon.png"
version: "2.0"
@@ -169,7 +169,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Grid View"
category: "Qt Quick - Views"
category: "b.Qt Quick - Views"
libraryIcon: ":/qtquickplugin/images/gridview-icon.png"
version: "2.0"
@@ -183,7 +183,7 @@ MetaInfo {
ItemLibraryEntry {
name: "List View"
category: "Qt Quick - Views"
category: "b.Qt Quick - Views"
libraryIcon: ":/qtquickplugin/images/listview-icon.png"
version: "2.0"
@@ -197,7 +197,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Path View"
category: "Qt Quick - Views"
category: "b.Qt Quick - Views"
libraryIcon: ":/qtquickplugin/images/pathview-icon.png"
version: "2.0"
@@ -211,7 +211,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Focus Scope"
category: "Qt Quick - Basic"
category: "a.Qt Quick - Basic"
libraryIcon: ":/qtquickplugin/images/focusscope-icon.png"
version: "2.0"
@@ -226,7 +226,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Column"
category: "Qt Quick - Positioner"
category: "c.Qt Quick - Positioner"
libraryIcon: ":/qtquickplugin/images/column-positioner-icon.png"
version: "2.0"
@@ -241,7 +241,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Row"
category: "Qt Quick - Positioner"
category: "c.Qt Quick - Positioner"
libraryIcon: ":/qtquickplugin/images/row-positioner-icon.png"
version: "2.0"
@@ -256,7 +256,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Grid"
category: "Qt Quick - Positioner"
category: "c.Qt Quick - Positioner"
libraryIcon: ":/qtquickplugin/images/grid-positioner-icon.png"
version: "2.0"
@@ -271,7 +271,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Flow"
category: "Qt Quick - Positioner"
category: "c.Qt Quick - Positioner"
libraryIcon: ":/qtquickplugin/images/flow-positioner-icon.png"
version: "2.0"
@@ -293,7 +293,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Property Animation"
category: "Qt Quick - Animation"
category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0"
}
@@ -312,7 +312,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Pause Animation"
category: "Qt Quick - Animation"
category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0"
}
@@ -330,7 +330,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Sequential Animation"
category: "Qt Quick - Animation"
category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0"
}
@@ -348,7 +348,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Parallel Animation"
category: "Qt Quick - Animation"
category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0"
}
@@ -367,7 +367,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Property Action"
category: "Qt Quick - Animation"
category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0"
}
@@ -386,7 +386,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Script Action"
category: "Qt Quick - Animation"
category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0"
}
@@ -405,7 +405,7 @@ MetaInfo {
ItemLibraryEntry {
name: "ColorAnimation"
category: "Qt Quick - Animation"
category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.0"
}
@@ -424,7 +424,7 @@ MetaInfo {
ItemLibraryEntry {
name: "Number Animation"
category: "Qt Quick - Animation"
category: "d.Qt Quick - Animation"
libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "2.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())
projectItem->setQtForMCUs(qtForMCUProperty.toBool());
const QVariant qt6ProjectProperty = rootNode->property("qt6Project");
if (qt6ProjectProperty.isValid() && qt6ProjectProperty.toBool())
projectItem->setQt6Project(qt6ProjectProperty.toBool());
if (debug)
qDebug() << "importPath:" << importPathsProperty << "mainFile:" << mainFileProperty;

View File

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

View File

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

View File

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

View File

@@ -79,6 +79,7 @@ public:
Utils::FilePath mainFilePath() const;
bool qtForMCUs() const;
bool qt6Project() const;
void setMainFile(const QString &mainFilePath);
Utils::FilePath targetDirectory() 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 customForceFreeTypeData[] = "CustomForceFreeType";
const char customQtForMCUs[] = "CustomQtForMCUs";
const char customQt6Project[] = "CustomQt6Project";
} // namespace Constants
} // namespace QmlProjectManager

View File

@@ -41,12 +41,12 @@ using namespace ProjectExplorer;
namespace QtSupport {
// opt. drive letter + filename: (2 brackets)
#define FILE_PATTERN "^(([A-Za-z]:)?[^:]+\\.[^:]+)"
#define FILE_PATTERN R"(^(?<file>(?:[A-Za-z]:)?[^:\(]+\.[^:\(]+))"
QtParser::QtParser() :
m_mocRegExp(QLatin1String(FILE_PATTERN"[:\\(](\\d+?)\\)?:\\s([Ww]arning|[Ee]rror|[Nn]ote):\\s(.+?)$")),
m_uicRegExp(QLatin1String(FILE_PATTERN": Warning:\\s(?<msg>.+?)$")),
m_translationRegExp(QLatin1String("^([Ww]arning|[Ee]rror):\\s+(.*?) in '(.*?)'$"))
m_mocRegExp(FILE_PATTERN R"([:\(](?<line>\d+)?(?::(?<column>\d+))?\)?:\s(?<level>[Ww]arning|[Ee]rror|[Nn]ote):\s(?<description>.+?)$)"),
m_uicRegExp(FILE_PATTERN R"(: Warning:\s(?<msg>.+?)$)"),
m_translationRegExp(R"(^(?<level>[Ww]arning|[Ee]rror):\s+(?<description>.*?) in '(?<file>.*?)'$)")
{
setObjectName(QLatin1String("QtParser"));
}
@@ -60,20 +60,21 @@ Utils::OutputLineParser::Result QtParser::handleLine(const QString &line, Utils:
QRegularExpressionMatch match = m_mocRegExp.match(lne);
if (match.hasMatch()) {
bool ok;
int lineno = match.captured(3).toInt(&ok);
int lineno = match.captured("line").toInt(&ok);
if (!ok)
lineno = -1;
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)
type = Task::Warning;
if (level.compare(QLatin1String("Note"), Qt::CaseInsensitive) == 0)
type = Task::Unknown;
LinkSpecs linkSpecs;
const Utils::FilePath file
= absoluteFilePath(Utils::FilePath::fromUserInput(match.captured(1)));
addLinkSpecForAbsoluteFilePath(linkSpecs, file, lineno, match, 1);
CompileTask task(type, match.captured(5).trimmed() /* description */, file, lineno);
= absoluteFilePath(Utils::FilePath::fromUserInput(match.captured("file")));
addLinkSpecForAbsoluteFilePath(linkSpecs, file, lineno, match, "file");
CompileTask task(type, match.captured("description").trimmed(), file, lineno);
task.column = match.captured("column").toInt();
scheduleTask(task, 1);
return {Status::Done, linkSpecs};
}
@@ -88,7 +89,7 @@ Utils::OutputLineParser::Result QtParser::handleLine(const QString &line, Utils:
message.prepend(": ").prepend(fileName);
} else if (fileName.endsWith(".ui")) {
filePath = absoluteFilePath(Utils::FilePath::fromUserInput(fileName));
addLinkSpecForAbsoluteFilePath(linkSpecs, filePath, -1, match, 1);
addLinkSpecForAbsoluteFilePath(linkSpecs, filePath, -1, match, "file");
} else {
isUicMessage = false;
}
@@ -100,13 +101,13 @@ Utils::OutputLineParser::Result QtParser::handleLine(const QString &line, Utils:
match = m_translationRegExp.match(line);
if (match.hasMatch()) {
Task::TaskType type = Task::Warning;
if (match.captured(1) == QLatin1String("Error"))
if (match.captured("level") == QLatin1String("Error"))
type = Task::Error;
LinkSpecs linkSpecs;
const Utils::FilePath file
= absoluteFilePath(Utils::FilePath::fromUserInput(match.captured(3)));
addLinkSpecForAbsoluteFilePath(linkSpecs, file, 0, match, 3);
CompileTask task(type, match.captured(2), file);
= absoluteFilePath(Utils::FilePath::fromUserInput(match.captured("file")));
addLinkSpecForAbsoluteFilePath(linkSpecs, file, 0, match, "file");
CompileTask task(type, match.captured("description"), file);
scheduleTask(task, 1);
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."),
Utils::FilePath::fromUserInput(QLatin1String("c:\\code\\test.h")), 96))
<< 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")
<< QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.")
<< OutputParserTester::STDERR

View File

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