From 95953f949af748e79fe14e711b5529bae4446d3f Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 12 Feb 2020 14:56:08 +0100 Subject: [PATCH 01/10] QmlDesigner: Only scatter item if they have positions Task-number: QDS-1642 Change-Id: I0e99cfc9027e283d3dc6ce239a74c48bfc092e99 Reviewed-by: Tim Jenssen --- .../qmldesigner/components/integration/designdocument.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index 5adc18347c0..9d3809727ed 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -394,6 +394,9 @@ static void scatterItem(const ModelNode &pastedNode, const ModelNode &targetNode if (targetNode.metaInfo().isValid() && targetNode.metaInfo().isLayoutable()) return; + if (!(pastedNode.hasVariantProperty("x") && pastedNode.hasVariantProperty("y"))) + return; + bool scatter = false; foreach (const ModelNode &childNode, targetNode.directSubModelNodes()) { if ((childNode.variantProperty("x").value() == pastedNode.variantProperty("x").value()) && From c8779e9c9376585d909c393f2a2060f33277dcc3 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 13 Feb 2020 13:04:37 +0100 Subject: [PATCH 02/10] QmlDesigner: Create connections inside the target element Change-Id: I29e00e4f90d1fec2f230a989c7b04f64e8b81a9b Reviewed-by: Tim Jenssen --- .../connectioneditor/connectionmodel.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp index 1347c76045b..560be7c4f6b 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -210,6 +211,10 @@ void ConnectionModel::updateTargetNode(int rowNumber) ModelNode connectionNode = signalHandlerProperty.parentModelNode(); if (!newTarget.isEmpty()) { + const ModelNode parent = connectionView()->modelNodeForId(newTarget); + if (parent.isValid() && QmlItemNode::isValidQmlItemNode(parent)) + parent.nodeListProperty("data").reparentHere(connectionNode); + connectionView()->executeInTransaction("ConnectionModel::updateTargetNode", [= ,&connectionNode](){ connectionNode.bindingProperty("target").setExpression(newTarget); }); @@ -255,14 +260,21 @@ void ConnectionModel::addConnection() nodeMetaInfo.majorVersion(), nodeMetaInfo.minorVersion()); - rootModelNode.nodeAbstractProperty(rootModelNode.metaInfo().defaultPropertyName()).reparentHere(newNode); newNode.signalHandlerProperty("onClicked").setSource(QLatin1String("print(\"clicked\")")); - if (connectionView()->selectedModelNodes().count() == 1 - && !connectionView()->selectedModelNodes().constFirst().id().isEmpty()) { + if (connectionView()->selectedModelNodes().count() == 1) { const ModelNode selectedNode = connectionView()->selectedModelNodes().constFirst(); + if (QmlItemNode::isValidQmlItemNode(selectedNode)) + selectedNode.nodeAbstractProperty("data").reparentHere(newNode); + else + rootModelNode.nodeAbstractProperty(rootModelNode.metaInfo().defaultPropertyName()).reparentHere(newNode); + + if (!connectionView()->selectedModelNodes().constFirst().id().isEmpty()) newNode.bindingProperty("target").setExpression(selectedNode.id()); + else + newNode.bindingProperty("target").setExpression(QLatin1String("parent")); } else { + rootModelNode.nodeAbstractProperty(rootModelNode.metaInfo().defaultPropertyName()).reparentHere(newNode); newNode.bindingProperty("target").setExpression(QLatin1String("parent")); } }); From 02e62602e7c39013adcab6425e808cceb6692273 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 11 Feb 2020 16:31:28 +0100 Subject: [PATCH 03/10] QmlDesigner: Increase number of digits for timeline duration Task-number: QDS-1635 Change-Id: Ie9c556faec578a5a5c01a6998074d929eec901b5 Reviewed-by: Tim Jenssen --- .../timelineeditor/timelineanimationform.ui | 12 ++++++------ .../components/timelineeditor/timelineform.ui | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelineanimationform.ui b/src/plugins/qmldesigner/components/timelineeditor/timelineanimationform.ui index 5d13cfa7264..f24da6edf99 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelineanimationform.ui +++ b/src/plugins/qmldesigner/components/timelineeditor/timelineanimationform.ui @@ -149,10 +149,10 @@ - -10000 + 0 - 10000 + 100000 @@ -244,10 +244,10 @@ - -10000 + -100000 - 10000 + 100000 @@ -313,10 +313,10 @@ - -10000 + -100000 - 10000 + 100000 diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelineform.ui b/src/plugins/qmldesigner/components/timelineeditor/timelineform.ui index b8b47e4c701..d962608b11e 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelineform.ui +++ b/src/plugins/qmldesigner/components/timelineeditor/timelineform.ui @@ -6,7 +6,7 @@ 0 0 - 627 + 641 170 @@ -39,10 +39,10 @@ - -10000 + -100000 - 10000 + 100000 @@ -61,10 +61,10 @@ - -10000 + -100000 - 10000 + 100000 @@ -187,7 +187,7 @@ true - 20000 + 200000 From 2f13a2a029cfdcfc7df0df10d24bcb2271f91f07 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 13 Feb 2020 16:11:36 +0100 Subject: [PATCH 04/10] QmlDesigner: Add property editor sheets for animations Task-number: QDS-1613 Change-Id: I38bd2274983ec063af625f924f61cfb262e24d1f Reviewed-by: Leena Miettinen Reviewed-by: Tim Jenssen --- .../QtQuick/AnimationSection.qml | 104 ++++++++++++++++++ .../QtQuick/AnimationTargetSection.qml | 70 ++++++++++++ .../QtQuick/ColorAnimationSpecifics.qml | 62 +++++++++++ .../QtQuick/NumberAnimationSpecifics.qml | 84 ++++++++++++++ .../QtQuick/ParallelAnimationSpecifics.qml | 37 +++++++ .../QtQuick/PauseAnimationSpecifics.qml | 36 ++++++ .../QtQuick/PropertyActionSpecifics.qml | 60 ++++++++++ .../QtQuick/PropertyAnimationSpecifics.qml | 40 +++++++ .../QtQuick/ScriptActionSpecifics.qml | 37 +++++++ .../QtQuick/SequentialAnimationSpecifics.qml | 37 +++++++ 10 files changed, 567 insertions(+) create mode 100644 share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationSection.qml create mode 100644 share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationTargetSection.qml create mode 100644 share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ColorAnimationSpecifics.qml create mode 100644 share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/NumberAnimationSpecifics.qml create mode 100644 share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ParallelAnimationSpecifics.qml create mode 100644 share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PauseAnimationSpecifics.qml create mode 100644 share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PropertyActionSpecifics.qml create mode 100644 share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PropertyAnimationSpecifics.qml create mode 100644 share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ScriptActionSpecifics.qml create mode 100644 share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/SequentialAnimationSpecifics.qml diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationSection.qml new file mode 100644 index 00000000000..23c801eca39 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationSection.qml @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import HelperWidgets 2.0 +import QtQuick 2.1 +import QtQuick.Layouts 1.1 +Section { + id: section + caption: qsTr("Animation") + anchors.left: parent.left + anchors.right: parent.right + + property bool showDuration: true + + SectionLayout { + Label { + text: qsTr("Running") + tooltip: qsTr("Sets whether the animation should run to completion when it is stopped.") + } + + CheckBox { + text: backendValues.running.valueToString + backendValue: backendValues.running + } + + Label { + text: qsTr("Paused") + tooltip: qsTr("Sets whether the animation is currently paused.") + } + + CheckBox { + text: backendValues.paused.valueToString + backendValue: backendValues.paused + } + Label { + text: qsTr("Loops") + tooltip: qsTr("Sets the number of times the animation should play.") + } + + SecondColumnLayout { + SpinBox { + maximumValue: 9999999 + minimumValue: -1 + backendValue: backendValues.loops + Layout.fillWidth: true + Layout.maximumWidth: 100 + } + + ExpandingSpacer { + } + } + + Label { + visible: section.showDuration + text: qsTr("Duration") + tooltip: qsTr("Sets the duration of the animation, in milliseconds.") + } + + SecondColumnLayout { + visible: section.showDuration + SpinBox { + maximumValue: 9999999 + minimumValue: -9999999 + backendValue: backendValues.duration + Layout.fillWidth: true + Layout.maximumWidth: 100 + } + + ExpandingSpacer { + } + } + Label { + text: qsTr("Always Run To End") + tooltip: qsTr("Sets whether the animation should run to completion when it is stopped.") + } + + CheckBox { + text: backendValues.alwaysRunToEnd.valueToString + backendValue: backendValues.alwaysRunToEnd + } + } +} diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationTargetSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationTargetSection.qml new file mode 100644 index 00000000000..e614a6563b7 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationTargetSection.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import HelperWidgets 2.0 +import QtQuick 2.1 +import QtQuick.Layouts 1.1 +Section { + id: section + caption: qsTr("Animation Targets") + anchors.left: parent.left + anchors.right: parent.right + + SectionLayout { + Label { + text: qsTr("Target") + tooltip: qsTr("Sets the target to animate the properties of.") + } + SecondColumnLayout { + ItemFilterComboBox { + typeFilter: "QtQuick.QtObject" + validator: RegExpValidator { regExp: /(^$|^[a-z_]\w*)/ } + backendValue: backendValues.target + Layout.fillWidth: true + } + + ExpandingSpacer { + } + } + + Label { + text: qsTr("Property") + tooltip: qsTr("Sets the property to animate.") + } + LineEdit { + backendValue: backendValues.property + Layout.fillWidth: true + } + Label { + text: qsTr("Properties") + tooltip: qsTr("Sets the properties to animate.") + } + LineEdit { + backendValue: backendValues.properties + Layout.fillWidth: true + } + + } +} diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ColorAnimationSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ColorAnimationSpecifics.qml new file mode 100644 index 00000000000..26a38d42119 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ColorAnimationSpecifics.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import HelperWidgets 2.0 +import QtQuick 2.1 +import QtQuick.Layouts 1.1 +Column { + anchors.left: parent.left + anchors.right: parent.right + + Section { + anchors.left: parent.left + anchors.right: parent.right + caption: qsTr("To Color") + + ColorEditor { + backendValue: backendValues.to + supportGradient: false + } + } + + Section { + anchors.left: parent.left + anchors.right: parent.right + caption: qsTr("From Color") + + ColorEditor { + backendValue: backendValues.from + supportGradient: false + } + } + + AnimationTargetSection { + + } + + AnimationSection { + } +} + diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/NumberAnimationSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/NumberAnimationSpecifics.qml new file mode 100644 index 00000000000..19f159526bc --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/NumberAnimationSpecifics.qml @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import HelperWidgets 2.0 +import QtQuick 2.1 +import QtQuick.Layouts 1.1 +Column { + anchors.left: parent.left + anchors.right: parent.right + + Section { + caption: qsTr("Number Animation") + anchors.left: parent.left + anchors.right: parent.right + + SectionLayout { + Label { + text: qsTr("From") + tooltip: qsTr("Sets the starting value for the animation.") + } + + SecondColumnLayout { + SpinBox { + maximumValue: 9999999 + minimumValue: -1 + backendValue: backendValues.from + Layout.fillWidth: true + Layout.maximumWidth: 100 + } + + ExpandingSpacer { + } + } + + Label { + text: qsTr("To") + tooltip: qsTr("Sets the end value for the animation.") + } + + SecondColumnLayout { + SpinBox { + maximumValue: 9999999 + minimumValue: -1 + backendValue: backendValues.to + Layout.fillWidth: true + Layout.maximumWidth: 100 + } + + ExpandingSpacer { + } + } + } + } + + AnimationTargetSection { + + } + + AnimationSection { + } +} + diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ParallelAnimationSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ParallelAnimationSpecifics.qml new file mode 100644 index 00000000000..f78de15475b --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ParallelAnimationSpecifics.qml @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import HelperWidgets 2.0 +import QtQuick 2.1 +import QtQuick.Layouts 1.1 +Column { + anchors.left: parent.left + anchors.right: parent.right + + AnimationSection { + showDuration: false + } +} + diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PauseAnimationSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PauseAnimationSpecifics.qml new file mode 100644 index 00000000000..dd826dfb343 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PauseAnimationSpecifics.qml @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import HelperWidgets 2.0 +import QtQuick 2.1 +import QtQuick.Layouts 1.1 +Column { + anchors.left: parent.left + anchors.right: parent.right + + AnimationSection { + } +} + diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PropertyActionSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PropertyActionSpecifics.qml new file mode 100644 index 00000000000..7d64f226125 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PropertyActionSpecifics.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import HelperWidgets 2.0 +import QtQuick 2.1 +import QtQuick.Layouts 1.1 +Column { + anchors.left: parent.left + anchors.right: parent.right + + Section { + id: section + caption: qsTr("Property Action") + anchors.left: parent.left + anchors.right: parent.right + + SectionLayout { + Label { + text: qsTr("Value") + tooltip: qsTr("Sets the value of the property.") + } + LineEdit { + backendValue: backendValues.value + Layout.fillWidth: true + } + } + } + + + AnimationTargetSection { + + } + + AnimationSection { + showDuration: false + } +} + diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PropertyAnimationSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PropertyAnimationSpecifics.qml new file mode 100644 index 00000000000..271f6bae677 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PropertyAnimationSpecifics.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import HelperWidgets 2.0 +import QtQuick 2.1 +import QtQuick.Layouts 1.1 +Column { + anchors.left: parent.left + anchors.right: parent.right + + AnimationTargetSection { + + } + + AnimationSection { + } +} + diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ScriptActionSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ScriptActionSpecifics.qml new file mode 100644 index 00000000000..848364901a5 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ScriptActionSpecifics.qml @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import HelperWidgets 2.0 +import QtQuick 2.1 +import QtQuick.Layouts 1.1 +Column { + anchors.left: parent.left + anchors.right: parent.right + + AnimationSection { + showDuration: false + } +} + diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/SequentialAnimationSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/SequentialAnimationSpecifics.qml new file mode 100644 index 00000000000..848364901a5 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/SequentialAnimationSpecifics.qml @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import HelperWidgets 2.0 +import QtQuick 2.1 +import QtQuick.Layouts 1.1 +Column { + anchors.left: parent.left + anchors.right: parent.right + + AnimationSection { + showDuration: false + } +} + From f5389e57a9298f878fb4ada1ebeee1dd4fee6710 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 13 Feb 2020 13:05:14 +0100 Subject: [PATCH 05/10] QmlDesigner: Add animations to item library Change-Id: I04272988e4d46ae9726a0dbdfc9433fd0b026607 Reviewed-by: Brook Cronin Reviewed-by: Tim Jenssen --- .../qmldesigner/qtquickplugin/quick.metainfo | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) diff --git a/src/plugins/qmldesigner/qtquickplugin/quick.metainfo b/src/plugins/qmldesigner/qtquickplugin/quick.metainfo index df983ea1d90..a8562bf18ff 100644 --- a/src/plugins/qmldesigner/qtquickplugin/quick.metainfo +++ b/src/plugins/qmldesigner/qtquickplugin/quick.metainfo @@ -275,4 +275,149 @@ MetaInfo { Property { name: "height"; type: "int"; value: 400; } } } + + Type { + name: "QtQuick.PropertyAnimation" + icon: ":/qtquickplugin/images/item-icon16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Property Animation" + category: "Qt Quick - Animation" + libraryIcon: ":/qtquickplugin/images/item-icon.png" + version: "2.0" + } + } + + Type { + name: "QtQuick.PauseAnimation" + icon: ":/qtquickplugin/images/item-icon16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Pause Animation" + category: "Qt Quick - Animation" + libraryIcon: ":/qtquickplugin/images/item-icon.png" + version: "2.0" + } + } + + Type { + name: "QtQuick.SequentialAnimation" + icon: ":/qtquickplugin/images/item-icon16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Sequential Animation" + category: "Qt Quick - Animation" + libraryIcon: ":/qtquickplugin/images/item-icon.png" + version: "2.0" + } + } + + Type { + name: "QtQuick.ParallelAnimation" + icon: ":/qtquickplugin/images/item-icon16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Parallel Animation" + category: "Qt Quick - Animation" + libraryIcon: ":/qtquickplugin/images/item-icon.png" + version: "2.0" + } + } + + Type { + name: "QtQuick.PropertyAction" + icon: ":/qtquickplugin/images/item-icon16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Property Action" + category: "Qt Quick - Animation" + libraryIcon: ":/qtquickplugin/images/item-icon.png" + version: "2.0" + } + } + + Type { + name: "QtQuick.ScriptAction" + icon: ":/qtquickplugin/images/item-icon16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Script Action" + category: "Qt Quick - Animation" + libraryIcon: ":/qtquickplugin/images/item-icon.png" + version: "2.0" + } + } + + Type { + name: "QtQuick.ColorAnimation" + icon: ":/qtquickplugin/images/item-icon16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "ColorAnimation" + category: "Qt Quick - Animation" + libraryIcon: ":/qtquickplugin/images/item-icon.png" + version: "2.0" + } + } + + Type { + name: "QtQuick.NumberAnimation" + icon: ":/qtquickplugin/images/item-icon16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Number Animation" + category: "Qt Quick - Animation" + libraryIcon: ":/qtquickplugin/images/item-icon.png" + version: "2.0" + } + } + } From 0ffc029d70f048d05fedcbf047acc84313304317 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 13 Feb 2020 13:11:07 +0100 Subject: [PATCH 06/10] QmlDesigner: Rename resources to assets in the ui Task-number: QDS-1646 Change-Id: I8937f70adc3ad59f28d40f99852f2be053ce6c3b Reviewed-by: Leena Miettinen Reviewed-by: Tim Jenssen --- .../creator-only/creator-mobile-app-tutorial.qdoc | 10 +++++----- .../src/qtquick/creator-only/qtquick-app-tutorial.qdoc | 4 ++-- doc/qtcreator/src/qtquick/qtquick-components.qdoc | 4 ++-- doc/qtdesignstudio/src/qtdesignstudio-fonts.qdoc | 4 ++-- .../src/qtdesignstudio-importing-designs.qdoc | 10 +++++----- doc/qtdesignstudio/src/qtdesignstudio-projects.qdoc | 2 +- .../qtdesignstudio-3d-design-mode.qdoc | 4 ++-- .../src/qtquick3d-editor/qtdesignstudio-3d.qdoc | 4 ++-- .../components/itemlibrary/itemlibrarywidget.cpp | 8 ++++---- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/qtcreator/src/qtquick/creator-only/creator-mobile-app-tutorial.qdoc b/doc/qtcreator/src/qtquick/creator-only/creator-mobile-app-tutorial.qdoc index 6b09066b873..7165df0c4c6 100644 --- a/doc/qtcreator/src/qtquick/creator-only/creator-mobile-app-tutorial.qdoc +++ b/doc/qtcreator/src/qtquick/creator-only/creator-mobile-app-tutorial.qdoc @@ -75,7 +75,7 @@ To use \e {Bluebubble.svg} in your project, copy it to the project directory (same subdirectory as the QML file). - The image appears in \uicontrol Resources. You can also use any other + The image appears in \uicontrol Assets. You can also use any other image or a QML type, instead. To create the UI in the Design mode: @@ -106,7 +106,7 @@ \endlist - \li In \uicontrol Library > \uicontrol Resources, select Bluebubble.svg + \li In \uicontrol Library > \uicontrol Assets, select Bluebubble.svg and drag and drop it to \e mainWindow in the navigator. \li In the \uicontrol Properties pane, \uicontrol Id field, enter @@ -257,15 +257,15 @@ After adding the dependencies, select \uicontrol Build > \uicontrol {Run qmake} to apply the changes to the Makefile of the project. - \section1 Adding Resources + \section1 Adding Assets - You need to add the Bluebubble.svg image file to the application resources + You need to add the Bluebubble.svg image file to the application assets for deployment to mobile devices: \list 1 \li In the \uicontrol Projects view, double-click the qml.qrc file to open it - in the resource editor. + in the assets editor. \li Select \uicontrol Add to add Bluebubble.svg. diff --git a/doc/qtcreator/src/qtquick/creator-only/qtquick-app-tutorial.qdoc b/doc/qtcreator/src/qtquick/creator-only/qtquick-app-tutorial.qdoc index 0d93f62c9ff..5c6c8fe73d4 100644 --- a/doc/qtcreator/src/qtquick/creator-only/qtquick-app-tutorial.qdoc +++ b/doc/qtcreator/src/qtquick/creator-only/qtquick-app-tutorial.qdoc @@ -62,7 +62,7 @@ To use the \e qt-logo.png image in your application, you must copy it from the Qt examples directory to the project directory (same subdirectory as - the QML file). The image appears in \uicontrol Resources. You can also use + the QML file). The image appears in \uicontrol Assets. You can also use any other image or a QML type, instead. \list 1 @@ -78,7 +78,7 @@ \li Select \uicontrol Page in the navigator, and enter \e page in the \uicontrol Id field. - \li In \uicontrol Library > \uicontrol Resources, select qt-logo.png and + \li In \uicontrol Library > \uicontrol Assets, select qt-logo.png and drag and drop it to the \e page in the navigator. \image qmldesigner-tutorial-user-icon.png "Image properties" diff --git a/doc/qtcreator/src/qtquick/qtquick-components.qdoc b/doc/qtcreator/src/qtquick/qtquick-components.qdoc index c21bbe559da..475a8928b53 100644 --- a/doc/qtcreator/src/qtquick/qtquick-components.qdoc +++ b/doc/qtcreator/src/qtquick/qtquick-components.qdoc @@ -48,7 +48,7 @@ applications. The \uicontrol {Library} pane lists the available QML types, UI - components, resources, and imports. + components, assets, and imports. \image qmldesigner-qml-components.png "QML Components" @@ -66,7 +66,7 @@ the import statements automatically. You can remove import statements in \uicontrol Imports - \uicontrol {Resources} displays the images and other files that you copy + \uicontrol {Assets} displays the images and other files that you copy to the project folder (to the same subfolder as the QML files). \section1 Adding Components to Designs diff --git a/doc/qtdesignstudio/src/qtdesignstudio-fonts.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-fonts.qdoc index 1ceef949d76..39073a2d531 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-fonts.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio-fonts.qdoc @@ -42,8 +42,8 @@ To add fonts: \list 1 - \li Select \uicontrol Library > \uicontrol Resources > - \uicontrol {Add New Resources}. + \li Select \uicontrol Library > \uicontrol Assets > + \uicontrol {Add New Assets}. \li Browse to the folder that contains the font files and select them. \li Enter the name of the directory to save the fonts. By default, \QDS suggests the project directory. diff --git a/doc/qtdesignstudio/src/qtdesignstudio-importing-designs.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-importing-designs.qdoc index ee7f2250f9a..ce53ae2ccd0 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-importing-designs.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio-importing-designs.qdoc @@ -77,8 +77,8 @@ instructions of the wizard to create an empty project. \li In \uicontrol Projects, double-click \e Screen01.ui.qml to move to the Design mode. - \li Select \uicontrol Library > \uicontrol Resources > - \uicontrol {Add New Resources}. + \li Select \uicontrol Library > \uicontrol Assets > + \uicontrol {Add New Assets}. \li Select the folder where you exported the assets. \li Select \uicontrol {Exported Assets (*.metadata)} in the dropdown menu to filter \e .metadata files. @@ -106,7 +106,7 @@ might take a little while for complex projects. \endlist - The imported assets are displayed in the \uicontrol Resources tab in the + The imported assets are displayed in the \uicontrol Assets tab in the \uicontrol Library as PNG images. The components that you specified in the design tool are displayed in the \uicontrol {My QML Components} tab, as well as in the \uicontrol Project tab of the \uicontrol Navigator as @@ -161,8 +161,8 @@ To import 3D assets to \QDS projects: \list 1 - \li In the Design mode, select \uicontrol Library > \uicontrol Resources - > \uicontrol {Add New Resources}. + \li In the Design mode, select \uicontrol Library > \uicontrol Assets + > \uicontrol {Add New Assets}. \li Select \uicontrol {3D Assets} in the dropdown menu to filter 3D graphics files. \li Select a file to import, and then select \uicontrol Open. diff --git a/doc/qtdesignstudio/src/qtdesignstudio-projects.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-projects.qdoc index 570f2c8eb01..54ff29935f1 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-projects.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio-projects.qdoc @@ -36,7 +36,7 @@ \list \li Group files together - \li Include forms and resource files + \li Include forms and assets files \li Specify settings for previewing UIs \endlist diff --git a/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-design-mode.qdoc b/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-design-mode.qdoc index e214c544f25..da2964d5ba3 100644 --- a/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-design-mode.qdoc +++ b/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-design-mode.qdoc @@ -32,7 +32,7 @@ \title Editing 3D Assets in Design Mode \QDS opens QML files that contain 3D scenes in the Design mode and the - scenes in the 3D editor. You can add imported 3D assets as resources + scenes in the 3D editor. You can add imported 3D assets to projects and edit them to create scenes and states, as well as the transitions between them. @@ -55,7 +55,7 @@ \li \uicontrol {Library} (3) displays the building blocks that you can use to create scenes: predefined Qt Quick 3D Components, Qt Quick Controls, your own 3D assets that you import to the - project, and other resources. For more information, see + project, and other assets. For more information, see \l {Adding 3D Views}. \li \uicontrol {Navigator} (4) displays the items in the current QML file as a tree structure. For more information, see diff --git a/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d.qdoc b/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d.qdoc index 0256759f859..03f3085ad60 100644 --- a/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d.qdoc +++ b/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d.qdoc @@ -48,8 +48,8 @@ \li \l {Editing 3D Assets in Design Mode} \QDS opens QML files that contain 3D scenes in the Design mode and - the scenes in the 3D editor. You can add imported 3D assets as - resources to projects as 3D components. + the scenes in the 3D editor. You can add imported 3D assets + to projects as 3D components. \li \l {Working in the 3D Editor} You can select 3D components in the 3D editor to move, rotate, and diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp index 10464f77fe8..445d342d7fd 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp @@ -120,7 +120,7 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) : /* other widgets */ auto tabBar = new QTabBar(this); tabBar->addTab(tr("QML Types", "Title of library QML types view")); - tabBar->addTab(tr("Resources", "Title of library resources view")); + tabBar->addTab(tr("Assets", "Title of library assets view")); tabBar->addTab(tr("Imports", "Title of library imports view")); tabBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); connect(tabBar, &QTabBar::currentChanged, this, &ItemLibraryWidget::setCurrentIndexOfStackedWidget); @@ -184,8 +184,8 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) : font.setPixelSize(Theme::instance()->smallFontPixelSize()); button->setFont(font); button->setIcon(Utils::Icons::PLUS.icon()); - button->setText(tr("Add New Resources...")); - button->setToolTip(tr("Add new resources to project.")); + button->setText(tr("Add New Assets...")); + button->setToolTip(tr("Add new assets to project.")); button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); flowLayout->addWidget(button); connect(button, &QToolButton::clicked, this, &ItemLibraryWidget::addResources); @@ -511,7 +511,7 @@ void ItemLibraryWidget::addResources() const QString currentDir = lastDir.isEmpty() ? document->fileName().parentDir().toString() : lastDir; const auto fileNames = QFileDialog::getOpenFileNames(Core::ICore::mainWindow(), - tr("Add Resources"), + tr("Add Assets"), currentDir, filters.join(";;")); From 9af4b8694f82aa455ce844368c4f9c00b6f907b9 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 13 Feb 2020 13:38:27 +0100 Subject: [PATCH 07/10] QmlDesigner: Remove duration from TimelineForm The timeline has an end and start. There was an invisble spinbox for duration that I removed. Change-Id: I5ab8c888db650f97dbb3dac08b5b202fa681d291 Reviewed-by: Tim Jenssen --- .../timelineeditor/timelineform.cpp | 6 - .../components/timelineeditor/timelineform.ui | 268 ++++++++---------- 2 files changed, 118 insertions(+), 156 deletions(-) diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelineform.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineform.cpp index eb63ad48838..db9e8a8ef64 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelineform.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelineform.cpp @@ -47,8 +47,6 @@ TimelineForm::TimelineForm(QWidget *parent) { ui->setupUi(this); - ui->duration->setVisible(false); - connect(ui->expressionBindingLineEdit, &QLineEdit::editingFinished, [this]() { QTC_ASSERT(m_timeline.isValid(), return ); @@ -135,13 +133,10 @@ void TimelineForm::setTimeline(const QmlTimeline &timeline) if (m_timeline.isValid()) { ui->idLineEdit->setText(m_timeline.modelNode().displayName()); - ui->duration->setValue(qRound(m_timeline.duration())); ui->startFrame->setValue( m_timeline.modelNode().variantProperty("startFrame").value().toInt()); ui->endFrame->setValue(m_timeline.modelNode().variantProperty("endFrame").value().toInt()); - ui->duration->setValue(qRound(m_timeline.duration())); - if (m_timeline.modelNode().hasBindingProperty("currentFrame")) { ui->expressionBindingLineEdit->setText( m_timeline.modelNode().bindingProperty("currentFrame").expression()); @@ -173,7 +168,6 @@ void TimelineForm::setProperty(const PropertyName &propertyName, const QVariant } catch (const Exception &e) { e.showException(); } - ui->duration->setValue(qRound(m_timeline.duration())); } void TimelineForm::connectSpinBox(QSpinBox *spinBox, const PropertyName &propertyName) diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelineform.ui b/src/plugins/qmldesigner/components/timelineeditor/timelineform.ui index d962608b11e..370a6f8154c 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelineform.ui +++ b/src/plugins/qmldesigner/components/timelineeditor/timelineform.ui @@ -11,7 +11,23 @@ - + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 49 + 20 + + + + + Qt::Horizontal @@ -24,25 +40,23 @@ - - - - - 80 - 0 - + + + + End frame: - - - 80 - 16777215 - + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - -100000 + + + + + + Start frame: - - 100000 + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -68,129 +82,6 @@ - - - - Duration - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - Expression binding: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - - 49 - 20 - - - - - - - - End frame: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - false - - - Animation - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 49 - 20 - - - - - - - - true - - - - 240 - 0 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 49 - 20 - - - - - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - true - - - 200000 - - - @@ -201,13 +92,6 @@ - - - - - - - @@ -237,16 +121,100 @@ - - + + + + false + - Start frame: + Animation + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 49 + 20 + + + + + + + + Expression binding: Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + -100000 + + + 100000 + + + + + + + + + + + + + + true + + + + 240 + 0 + + + + + + + + Qt::Horizontal + + + + 49 + 20 + + + + From 1f5a089f24f56ade1b8c29a0cf07699fc7fd8747 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 13 Feb 2020 18:01:27 +0100 Subject: [PATCH 08/10] Qbs: Pass related info directly to command line creation function Saves a few casts and otherwise unneeded accessors. Change-Id: I7a6ff1e8348a24690f35e69d300463a6c5c18867 Reviewed-by: Christian Kandeler --- .../qbsbuildconfiguration.cpp | 106 +++--------------- .../qbsprojectmanager/qbsbuildconfiguration.h | 19 +++- .../qbsprojectmanager/qbsbuildstep.cpp | 20 +++- src/plugins/qbsprojectmanager/qbsbuildstep.h | 1 + .../qbsprojectmanager/qbscleanstep.cpp | 6 +- src/plugins/qbsprojectmanager/qbscleanstep.h | 3 +- .../qbsprojectmanager/qbsinstallstep.cpp | 17 ++- .../qbsprojectmanager/qbsinstallstep.h | 1 + 8 files changed, 74 insertions(+), 99 deletions(-) diff --git a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp index f66aba31654..f2aac00591b 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp @@ -261,84 +261,7 @@ QString QbsBuildConfiguration::configurationName() const return m_configurationName->value(); } -class StepProxy -{ -public: - StepProxy(const BuildStep *buildStep) - : m_qbsBuildStep(qobject_cast(buildStep)) - , m_qbsCleanStep(qobject_cast(buildStep)) - , m_qbsInstallStep(qobject_cast(buildStep)) - { - } - - QString command() const { - if (m_qbsBuildStep) - return QLatin1String("build"); - if (m_qbsInstallStep) - return QLatin1String("install"); - return QLatin1String("clean"); - } - - bool dryRun() const { - if (m_qbsBuildStep) - return false; - if (m_qbsInstallStep) - return m_qbsInstallStep->dryRun(); - return m_qbsCleanStep->dryRun(); - } - - bool keepGoing() const { - if (m_qbsBuildStep) - return m_qbsBuildStep->keepGoing(); - if (m_qbsInstallStep) - return m_qbsInstallStep->keepGoing(); - return m_qbsCleanStep->keepGoing(); - } - - bool forceProbeExecution() const { return m_qbsBuildStep && m_qbsBuildStep->forceProbes(); } - - bool showCommandLines() const { - return m_qbsBuildStep ? m_qbsBuildStep->showCommandLines() : false; - } - - bool noInstall() const { - return m_qbsBuildStep ? !m_qbsBuildStep->install() : false; - } - - bool noBuild() const { return m_qbsInstallStep; } - - bool cleanInstallRoot() const { - if (m_qbsBuildStep) - return m_qbsBuildStep->cleanInstallRoot(); - if (m_qbsInstallStep) - return m_qbsInstallStep->removeFirst(); - return false; - } - - int jobCount() const { - return m_qbsBuildStep ? m_qbsBuildStep->maxJobs() : 0; - } - - Utils::FilePath installRoot() const { - const QbsBuildStep *bs = nullptr; - if (m_qbsBuildStep) { - bs = m_qbsBuildStep; - } else if (m_qbsInstallStep) { - bs = static_cast(m_qbsInstallStep->deployConfiguration() - ->target()->activeBuildConfiguration())->qbsStep(); - } - if (bs) - return bs->installRoot(); - return Utils::FilePath(); - } - -private: - const QbsBuildStep * const m_qbsBuildStep; - const QbsCleanStep * const m_qbsCleanStep; - const QbsInstallStep * const m_qbsInstallStep; -}; - -QString QbsBuildConfiguration::equivalentCommandLine(const BuildStep *buildStep) const +QString QbsBuildConfiguration::equivalentCommandLine(const QbsBuildStepData &stepData) const { CommandLine commandLine; const QString qbsInstallDir = QString::fromLocal8Bit(qgetenv("QBS_INSTALL_DIR")); @@ -346,42 +269,41 @@ QString QbsBuildConfiguration::equivalentCommandLine(const BuildStep *buildStep) ? qbsInstallDir + QLatin1String("/bin/qbs") : QCoreApplication::applicationDirPath() + QLatin1String("/qbs")); commandLine.addArg(QDir::toNativeSeparators(qbsFilePath)); - const StepProxy stepProxy(buildStep); - commandLine.addArg(stepProxy.command()); + commandLine.addArg(stepData.command); const QString buildDir = buildDirectory().toUserOutput(); commandLine.addArgs({"-d", buildDir}); - commandLine.addArgs({"-f", buildStep->project()->projectFilePath().toUserOutput()}); + commandLine.addArgs({"-f", project()->projectFilePath().toUserOutput()}); if (QbsSettings::useCreatorSettingsDirForQbs()) { commandLine.addArgs({"--settings-dir", QDir::toNativeSeparators(QbsSettings::qbsSettingsBaseDir())}); } - if (stepProxy.dryRun()) + if (stepData.dryRun) commandLine.addArg("--dry-run"); - if (stepProxy.keepGoing()) + if (stepData.keepGoing) commandLine.addArg("--keep-going"); - if (stepProxy.forceProbeExecution()) + if (stepData.forceProbeExecution) commandLine.addArg("--force-probe-execution"); - if (stepProxy.showCommandLines()) + if (stepData.showCommandLines) commandLine.addArgs({"--command-echo-mode", "command-line"}); - if (stepProxy.noInstall()) + if (stepData.noInstall) commandLine.addArg("--no-install"); - if (stepProxy.noBuild()) + if (stepData.noBuild) commandLine.addArg("--no-build"); - if (stepProxy.cleanInstallRoot()) + if (stepData.cleanInstallRoot) commandLine.addArg("--clean-install-root"); - const int jobCount = stepProxy.jobCount(); + const int jobCount = stepData.jobCount; if (jobCount > 0) commandLine.addArgs({"--jobs", QString::number(jobCount)}); - const QString profileName = QbsProfileManager::profileNameForKit(buildStep->target()->kit()); + const QString profileName = QbsProfileManager::profileNameForKit(target()->kit()); const QString buildVariant = qbsConfiguration() .value(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)).toString(); commandLine.addArg("config:" + configurationName()); commandLine.addArg(QString(Constants::QBS_CONFIG_VARIANT_KEY) + ':' + buildVariant); - const FilePath installRoot = stepProxy.installRoot(); + const FilePath installRoot = stepData.installRoot; if (!installRoot.isEmpty()) { commandLine.addArg(QString(Constants::QBS_INSTALL_ROOT_KEY) + ':' + installRoot.toUserOutput()); - if (qobject_cast(buildStep)) + if (stepData.isInstallStep) commandLine.addArgs({"--installRoot", installRoot.toUserOutput()}); } commandLine.addArg("profile:" + profileName); diff --git a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h index cc7e0e90d36..96b66e2f47a 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h +++ b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h @@ -40,7 +40,22 @@ namespace QbsProjectManager { namespace Internal { class QbsBuildStep; -class QbsProject; + +class QbsBuildStepData +{ +public: + QString command; + bool dryRun = false; + bool keepGoing = false; + bool forceProbeExecution = false; + bool showCommandLines = false; + bool noInstall = false; + bool noBuild = false; + bool cleanInstallRoot = false; + bool isInstallStep = false; + int jobCount = 0; + Utils::FilePath installRoot; +}; class QbsBuildConfiguration final : public ProjectExplorer::BuildConfiguration { @@ -73,7 +88,7 @@ public: QStringList products() const; QString configurationName() const; - QString equivalentCommandLine(const ProjectExplorer::BuildStep *buildStep) const; + QString equivalentCommandLine(const QbsBuildStepData &stepData) const; bool isQmlDebuggingEnabled() const; ProjectExplorer::TriState qmlDebuggingSetting() const; diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp index 1884d6eb278..dea23b0453f 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp @@ -523,6 +523,23 @@ void QbsBuildStep::finish() emit finished(m_lastWasSuccess); } +QbsBuildStepData QbsBuildStep::stepData() const +{ + QbsBuildStepData data; + data.command = "build"; + data.dryRun = false; + data.keepGoing = m_keepGoing; + data.forceProbeExecution = m_forceProbes; + data.showCommandLines = m_showCommandLines; + data.noInstall = !m_install; + data.noBuild = false; + data.cleanInstallRoot = m_cleanInstallDir; + data.jobCount = maxJobs(); + data.installRoot = installRoot(); + return data; +} + + // -------------------------------------------------------------------- // QbsBuildStepConfigWidget: // -------------------------------------------------------------------- @@ -674,7 +691,8 @@ void QbsBuildStepConfigWidget::updateState() const int idx = (buildVariant == Constants::QBS_VARIANT_DEBUG) ? 0 : 1; buildVariantComboBox->setCurrentIndex(idx); const auto qbsBuildConfig = static_cast(step()->buildConfiguration()); - QString command = qbsBuildConfig->equivalentCommandLine(qbsStep()); + + QString command = qbsBuildConfig->equivalentCommandLine(qbsStep()->stepData()); for (int i = 0; i < m_propertyCache.count(); ++i) { command += ' ' + m_propertyCache.at(i).name + ':' + m_propertyCache.at(i).effectiveValue; diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.h b/src/plugins/qbsprojectmanager/qbsbuildstep.h index 79ab7bb0431..3c5249dfb07 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.h +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.h @@ -70,6 +70,7 @@ public: bool forceProbes() const { return m_forceProbes; } QbsBuildSystem *qbsBuildSystem() const; + QbsBuildStepData stepData() const; signals: void qbsConfigurationChanged(); diff --git a/src/plugins/qbsprojectmanager/qbscleanstep.cpp b/src/plugins/qbsprojectmanager/qbscleanstep.cpp index b27d16d932e..ddecb793dcd 100644 --- a/src/plugins/qbsprojectmanager/qbscleanstep.cpp +++ b/src/plugins/qbsprojectmanager/qbscleanstep.cpp @@ -67,8 +67,12 @@ QbsCleanStep::QbsCleanStep(BuildStepList *bsl, Core::Id id) effectiveCommandAspect->setLabelText(tr("Equivalent command line:")); setSummaryUpdater([this, effectiveCommandAspect] { + QbsBuildStepData data; + data.command = "clean"; + data.dryRun = m_dryRunAspect->value(); + data.keepGoing = m_keepGoingAspect->value(); QString command = static_cast(buildConfiguration()) - ->equivalentCommandLine(this); + ->equivalentCommandLine(data); effectiveCommandAspect->setValue(command); return tr("Qbs: %1").arg(command); }); diff --git a/src/plugins/qbsprojectmanager/qbscleanstep.h b/src/plugins/qbsprojectmanager/qbscleanstep.h index 1a5c9f83403..7af3d61fc72 100644 --- a/src/plugins/qbsprojectmanager/qbscleanstep.h +++ b/src/plugins/qbsprojectmanager/qbscleanstep.h @@ -44,8 +44,7 @@ public: QbsCleanStep(ProjectExplorer::BuildStepList *bsl, Core::Id id); ~QbsCleanStep() override; - bool dryRun() const { return m_dryRunAspect->value(); } - bool keepGoing() const { return m_keepGoingAspect->value(); } + QbsBuildStepData stepData() const; private: bool init() override; diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp index bc0abe9866e..ba98e6d2e70 100644 --- a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp @@ -231,6 +231,21 @@ void QbsInstallStep::setKeepGoing(bool kg) emit changed(); } +QbsBuildStepData QbsInstallStep::stepData() const +{ + QbsBuildStepData data; + data.command = "install"; + data.dryRun = dryRun(); + data.keepGoing = keepGoing(); + data.noBuild = true; + data.cleanInstallRoot = removeFirst(); + data.isInstallStep = true; + auto bs = static_cast(target()->activeBuildConfiguration())->qbsStep(); + if (bs) + data.installRoot = bs->installRoot(); + return data; +}; + // -------------------------------------------------------------------- // QbsInstallStepConfigWidget: // -------------------------------------------------------------------- @@ -320,7 +335,7 @@ void QbsInstallStepConfigWidget::updateState() m_keepGoingCheckBox->setChecked(m_step->keepGoing()); } - QString command = m_step->buildConfig()->equivalentCommandLine(m_step); + QString command = m_step->buildConfig()->equivalentCommandLine(m_step->stepData()); m_commandLineTextEdit->setPlainText(command); diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.h b/src/plugins/qbsprojectmanager/qbsinstallstep.h index 943beaac899..c02d2ab25f8 100644 --- a/src/plugins/qbsprojectmanager/qbsinstallstep.h +++ b/src/plugins/qbsprojectmanager/qbsinstallstep.h @@ -48,6 +48,7 @@ public: bool removeFirst() const { return m_cleanInstallRoot; } bool dryRun() const { return m_dryRun; } bool keepGoing() const { return m_keepGoing; } + QbsBuildStepData stepData() const; signals: void changed(); From a7bd6864c174b7c453ef6ac9c2a5bb22b7b03edf Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 13 Feb 2020 18:38:23 +0100 Subject: [PATCH 09/10] Qbs: Avoid a FilePath<->QString roundtrip in QbsInstallStep Change-Id: I8366fc694ba899bf74e0fea8e85aa99e709a57b4 Reviewed-by: Christian Kandeler --- src/plugins/qbsprojectmanager/qbsinstallstep.cpp | 8 ++++---- src/plugins/qbsprojectmanager/qbsinstallstep.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp index ba98e6d2e70..1f414749bdd 100644 --- a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp @@ -182,7 +182,7 @@ void QbsInstallStep::installDone(const ErrorInfo &error) m_session = nullptr; for (const ErrorInfoItem &item : error.items) - createTaskAndOutput(Task::Error, item.description, item.filePath.toString(), item.line); + createTaskAndOutput(Task::Error, item.description, item.filePath, item.line); emit finished(!error.hasError()); } @@ -199,10 +199,10 @@ void QbsInstallStep::handleProgress(int value) emit progress(value * 100 / m_maxProgress, m_description); } -void QbsInstallStep::createTaskAndOutput(ProjectExplorer::Task::TaskType type, - const QString &message, const QString &file, int line) +void QbsInstallStep::createTaskAndOutput(Task::TaskType type, const QString &message, + const Utils::FilePath &file, int line) { - const CompileTask task(type, message, Utils::FilePath::fromString(file), line); + const CompileTask task(type, message, file, line); emit addTask(task, 1); emit addOutput(message, OutputFormat::Stdout); } diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.h b/src/plugins/qbsprojectmanager/qbsinstallstep.h index c02d2ab25f8..9df1afaa7ee 100644 --- a/src/plugins/qbsprojectmanager/qbsinstallstep.h +++ b/src/plugins/qbsprojectmanager/qbsinstallstep.h @@ -67,7 +67,7 @@ private: void handleProgress(int value); void createTaskAndOutput(ProjectExplorer::Task::TaskType type, - const QString &message, const QString &file, int line); + const QString &message, const Utils::FilePath &file, int line); void setRemoveFirst(bool rf); void setDryRun(bool dr); From 9510c7293f1b4ef1dd0b33de5b0dd8dbe591cb51 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 11 Feb 2020 17:56:55 +0100 Subject: [PATCH 10/10] ModelEditor: Simplify setup of some plugin singletons Change-Id: Ica4d10155160d06be52daf4b56b714d07ad92290 Reviewed-by: Jochen Becher Reviewed-by: hjk --- src/plugins/modeleditor/actionhandler.cpp | 8 +++----- src/plugins/modeleditor/actionhandler.h | 2 +- src/plugins/modeleditor/modeleditor_plugin.cpp | 9 ++++----- src/plugins/modeleditor/modeleditorfactory.cpp | 16 ++-------------- src/plugins/modeleditor/modeleditorfactory.h | 9 +-------- 5 files changed, 11 insertions(+), 33 deletions(-) diff --git a/src/plugins/modeleditor/actionhandler.cpp b/src/plugins/modeleditor/actionhandler.cpp index 0c60f893759..837914be320 100644 --- a/src/plugins/modeleditor/actionhandler.cpp +++ b/src/plugins/modeleditor/actionhandler.cpp @@ -45,7 +45,7 @@ namespace Internal { class ActionHandler::ActionHandlerPrivate { public: - Core::Context context; + Core::Context context{Constants::MODEL_EDITOR_ID}; QAction *undoAction = nullptr; QAction *redoAction = nullptr; QAction *cutAction = nullptr; @@ -60,11 +60,9 @@ public: QAction *exportSelectedElementsAction = nullptr; }; -ActionHandler::ActionHandler(const Core::Context &context, QObject *parent) - : QObject(parent), - d(new ActionHandlerPrivate) +ActionHandler::ActionHandler() + : d(new ActionHandlerPrivate) { - d->context = context; } ActionHandler::~ActionHandler() diff --git a/src/plugins/modeleditor/actionhandler.h b/src/plugins/modeleditor/actionhandler.h index 5ec858e5356..fcc2665736d 100644 --- a/src/plugins/modeleditor/actionhandler.h +++ b/src/plugins/modeleditor/actionhandler.h @@ -52,7 +52,7 @@ class ActionHandler : class ActionHandlerPrivate; public: - ActionHandler(const Core::Context &context, QObject *parent = nullptr); + ActionHandler(); ~ActionHandler(); public: diff --git a/src/plugins/modeleditor/modeleditor_plugin.cpp b/src/plugins/modeleditor/modeleditor_plugin.cpp index 2b34be2b33c..67756e94642 100644 --- a/src/plugins/modeleditor/modeleditor_plugin.cpp +++ b/src/plugins/modeleditor/modeleditor_plugin.cpp @@ -32,6 +32,7 @@ #include "modelsmanager.h" #include "settingscontroller.h" #include "uicontroller.h" +#include "actionhandler.h" #include "qmt/infrastructure/uid.h" @@ -59,7 +60,8 @@ class ModelEditorPluginPrivate final public: ModelsManager modelsManager; UiController uiController; - ModelEditorFactory modelFactory{&uiController}; + ActionHandler actionHandler; + ModelEditorFactory modelFactory{&uiController, &actionHandler}; SettingsController settingsController; }; @@ -93,10 +95,7 @@ bool ModelEditorPlugin::initialize(const QStringList &arguments, QString *errorS void ModelEditorPlugin::extensionsInitialized() { - // Retrieve objects from the plugin manager's object pool - // In the extensionsInitialized method, a plugin can be sure that all - // plugins that depend on it are completely initialized. - d->modelFactory.extensionsInitialized(); + d->actionHandler.createActions(); d->settingsController.load(Core::ICore::settings()); } diff --git a/src/plugins/modeleditor/modeleditorfactory.cpp b/src/plugins/modeleditor/modeleditorfactory.cpp index 821df721108..f0f3c651ea2 100644 --- a/src/plugins/modeleditor/modeleditorfactory.cpp +++ b/src/plugins/modeleditor/modeleditorfactory.cpp @@ -34,24 +34,12 @@ namespace ModelEditor { namespace Internal { -ModelEditorFactory::ModelEditorFactory(UiController *uiController) +ModelEditorFactory::ModelEditorFactory(UiController *uiController, ActionHandler *actionHandler) { setId(Constants::MODEL_EDITOR_ID); setDisplayName(QCoreApplication::translate("OpenWith::Editors", Constants::MODEL_EDITOR_DISPLAY_NAME)); addMimeType(Constants::MIME_TYPE_MODEL); - m_uiController = uiController; - m_actionHandler = new ActionHandler(Core::Context(Constants::MODEL_EDITOR_ID), this); - setEditorCreator([this] { return new ModelEditor(m_uiController, m_actionHandler); }); -} - -ModelEditorFactory::~ModelEditorFactory() -{ - delete m_actionHandler; -} - -void ModelEditorFactory::extensionsInitialized() -{ - m_actionHandler->createActions(); + setEditorCreator([uiController, actionHandler] { return new ModelEditor(uiController, actionHandler); }); } } // namespace Internal diff --git a/src/plugins/modeleditor/modeleditorfactory.h b/src/plugins/modeleditor/modeleditorfactory.h index 5ae8ab563d3..1a84500ade9 100644 --- a/src/plugins/modeleditor/modeleditorfactory.h +++ b/src/plugins/modeleditor/modeleditorfactory.h @@ -37,14 +37,7 @@ class UiController; class ModelEditorFactory : public Core::IEditorFactory { public: - explicit ModelEditorFactory(UiController *uiController); - ~ModelEditorFactory(); - - void extensionsInitialized(); - -private: - UiController *m_uiController = nullptr; - ActionHandler *m_actionHandler = nullptr; + ModelEditorFactory(UiController *uiController, ActionHandler *actionHandler); }; } // namespace Internal