From 7b796bd4c3191dd01c54ddc551f916e66475064b Mon Sep 17 00:00:00 2001 From: Ali Kianian Date: Tue, 18 Oct 2022 10:58:59 +0300 Subject: [PATCH 01/12] QmlDesigner: Update Placeholder text in 3D Editor The placeholder text should be modified since there is no Library View anymore. Task-number: QDS-6776 Change-Id: I244c7933f1b8c9869aec52d06040e20df5a08459 Reviewed-by: Reviewed-by: Miikka Heikkinen Reviewed-by: Mahmoud Badri --- .../components/edit3d/edit3dwidget.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp index dfe8d8c1a72..05189a53ccc 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp +++ b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp @@ -162,10 +162,18 @@ Edit3DWidget::Edit3DWidget(Edit3DView *view) m_onboardingLabel = new QLabel(this); QString labelText = tr("Your file does not import Qt Quick 3D.

" - "To create a 3D view, add the QtQuick3D module in the Library view. Or click" - " here " - "to add it immediately.

" - "To import 3D assets from another tool, click the \"Add New Assets...\" button in the Assets tab of the Library view."); + "To create a 3D view, add the" + " QtQuick3D" + " module in the" + " Components" + " view or click" + " here" + ".

" + "To import 3D assets, select" + " +" + " in the" + " Assets" + " view."); m_onboardingLabel->setText(labelText.arg(Utils::creatorTheme()->color(Utils::Theme::TextColorLink).name())); m_onboardingLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); connect(m_onboardingLabel, &QLabel::linkActivated, this, &Edit3DWidget::linkActivated); From 4667d8ae4eed6cb6a6b139b34b9f9b8b8f6ed8a5 Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Tue, 18 Oct 2022 12:23:27 +0300 Subject: [PATCH 02/12] QmlDesigner: Disable "add material" actions when QtQuick3D not imported Fixes: QDS-7516 Change-Id: Id92a76e455b17b6c7baa11f8e472fa0b6bfcde9f Reviewed-by: Samuel Ghinet Reviewed-by: Miikka Heikkinen --- .../qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml index 19458a93f55..ce9f7d16e3d 100644 --- a/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml +++ b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml @@ -76,8 +76,8 @@ Item { var userMatsSecBottom = mapFromItem(userMaterialsSection, 0, userMaterialsSection.y).y + userMaterialsSection.height; - if (!materialBrowserModel.hasMaterialRoot && (!materialBrowserBundleModel.matBundleExists - || mouse.y < userMatsSecBottom)) { + if (!materialBrowserModel.hasMaterialRoot && materialBrowserModel.hasQuick3DImport + && (!materialBrowserBundleModel.matBundleExists || mouse.y < userMatsSecBottom)) { root.currentMaterial = null ctxMenu.popup() } @@ -288,6 +288,7 @@ Item { anchors.verticalCenter: parent.verticalCenter buttonSize: searchBox.height onClicked: materialBrowserModel.addNewMaterial() + enabled: materialBrowserModel.hasQuick3DImport } } From 18670aa74a95a866426be9d7cfcd045e821cdbd1 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 17 Oct 2022 12:09:09 +0200 Subject: [PATCH 03/12] RemoteLinux: Fix RsyncDeployService::setDeployableFiles() It previously did not set, but appended. Amends 515845b815c. Cherry-picked from bf575688808e4c8e31feb935c072f1627ef6bc02 Change-Id: Ida3bd66e188ad4b1bbf0ea7686ac101a3f61c28e Reviewed-by: Eike Ziller Reviewed-by: Jarek Kobus Reviewed-by: Qt CI Bot --- src/plugins/remotelinux/rsyncdeploystep.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/remotelinux/rsyncdeploystep.cpp b/src/plugins/remotelinux/rsyncdeploystep.cpp index 7b8cf858f19..044b8aa31d6 100644 --- a/src/plugins/remotelinux/rsyncdeploystep.cpp +++ b/src/plugins/remotelinux/rsyncdeploystep.cpp @@ -110,6 +110,7 @@ private: void RsyncDeployService::setDeployableFiles(const QList &files) { + m_files.clear(); for (const DeployableFile &f : files) m_files.append({f.localFilePath(), deviceConfiguration()->filePath(f.remoteFilePath())}); } From 9316f43efe36ef3c1bfad5bee6972971ea0611b5 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 18 Oct 2022 16:17:08 +0200 Subject: [PATCH 04/12] Add change log for 8.0.2 Change-Id: I73f5039b6388d3132564d86fa8c1515dd6345e8e Reviewed-by: Leena Miettinen --- dist/changes-8.0.2.md | 91 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 dist/changes-8.0.2.md diff --git a/dist/changes-8.0.2.md b/dist/changes-8.0.2.md new file mode 100644 index 00000000000..7dc343604d1 --- /dev/null +++ b/dist/changes-8.0.2.md @@ -0,0 +1,91 @@ +Qt Creator 8.0.2 +================ + +Qt Creator version 8.0.2 contains bug fixes. + +The most important changes are listed in this document. For a complete list of +changes, see the Git log for the Qt Creator sources that you can check out from +the public Git repository. For example: + + git clone git://code.qt.io/qt-creator/qt-creator.git + git log --cherry-pick --pretty=oneline origin/v8.0.1..v8.0.2 + +Editing +------- + +* Fixed importing color schemes +* Fixed moving text between editors by drag & drop (QTCREATORBUG-28125, + QTCREATORBUG-28126) +* Fixed that the default font could be blurry (QTCREATORBUG-28106, + QTCREATORBUG-28139) + +### C++ + +* Re-added non-Clangd version of `Extract Function` (QTCREATORBUG-28030) + +### Language Client + +* Fixed issues after resetting server (QTCREATORBUG-27596) + +### SCXML + +* Fixed crash when closing document (QTCREATORBUG-28027) + +Version Control +--------------- + +* Fixed handling of `\r` in tool output (QTCREATORBUG-27615) + +Test Integration +---------------- + +* GTest + * Fixed running selected tests (QTCREATORBUG-28153) +* Catch2 + * Fixed crash when running tests (QTCREATORBUG-28269) + +Platforms +--------- + +### Android + +* Fixed deployment in release mode (QTCREATORBUG-28163) + +### Remote Linux + +* Fixed issue with deployment (QTCREATORBUG-28167) +* Fixed key deployment on Windows (QTCREATORBUG-28092) +* Fixed killing remote processes (QTCREATORBUG-28072) + +Credits for these changes go to: +-------------------------------- +Aleksei German +Ali Kianian +André Pönitz +Antti Määttä +Brook Cronin +Christian Kandeler +Christian Stenger +Cristian Adam +David Schulz +Eike Ziller +Fawzi Mohamed +Henning Gruendl +Ivan Komissarov +Jaroslaw Kobus +Knud Dollereder +Leena Miettinen +Mahmoud Badri +Marco Bubke +Marcus Tillmanns +Mats Honkamaa +Miikka Heikkinen +Petri Virkkunen +Pranta Dastider +Robert Löhning +Samuel Ghinet +Sivert Krøvel +Sona Kurazyan +Thomas Hartmann +Tim Jenssen +Vikas Pachdha From d3e83f601ea5589482da66ab50026ae2f8b25410 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 30 Sep 2022 14:43:38 +0200 Subject: [PATCH 05/12] QmlDesigner: Fix test testRewriterSignalDefinition Otherwise the check if the property was handled will throw an assert. Change-Id: Ifc2fab22cd10ae811cd36137196c1ed6ba82677e Reviewed-by: Reviewed-by: Marco Bubke --- src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index fa56d855f80..2a5471be8f4 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -1372,6 +1372,7 @@ void TextToModelMerger::syncNode(ModelNode &modelNode, } syncSignalDeclarationProperty(modelProperty, signature, differenceHandler); + modelPropertyNames.remove(astName.toUtf8()); continue; // Done } From e55ea179c4c3f3c55365053293ab1f94d1bb9ef6 Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Tue, 18 Oct 2022 16:26:16 +0300 Subject: [PATCH 06/12] QmlDesigner: Extract material browser ctx menus into separate components Change-Id: I43305567f5224ed8015bcb507c7ee27e268d4d67 Reviewed-by: Miikka Heikkinen --- .../MaterialBrowser.qml | 183 ++---------------- .../MaterialBrowserContextMenu.qml | 140 ++++++++++++++ .../MaterialBundleContextMenu.qml | 74 +++++++ 3 files changed, 234 insertions(+), 163 deletions(-) create mode 100644 share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowserContextMenu.qml create mode 100644 share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBundleContextMenu.qml diff --git a/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml index ce9f7d16e3d..ad9356d44db 100644 --- a/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml +++ b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml @@ -24,7 +24,6 @@ ****************************************************************************/ import QtQuick 2.15 -import QtQuick.Layouts 1.15 import QtQuickDesignerTheme 1.0 import HelperWidgets 2.0 import StudioControls 1.0 as StudioControls @@ -36,12 +35,7 @@ Item { readonly property int cellWidth: 100 readonly property int cellHeight: 120 - property var currentMaterial: null - property int currentMaterialIdx: 0 - property var currentBundleMaterial: null - property int copiedMaterialInternalId: -1 - - property var matSectionsModel: [] + property var currMaterialItem: null // Called also from C++ to close context menu on focus out function closeContextMenu() @@ -78,8 +72,7 @@ Item { if (!materialBrowserModel.hasMaterialRoot && materialBrowserModel.hasQuick3DImport && (!materialBrowserBundleModel.matBundleExists || mouse.y < userMatsSecBottom)) { - root.currentMaterial = null - ctxMenu.popup() + ctxMenu.popupMenu() } } } @@ -89,11 +82,23 @@ Item { function onSelectedIndexChanged() { // commit rename upon changing selection - var item = gridRepeater.itemAt(currentMaterialIdx); - if (item) - item.commitRename(); + if (root.currMaterialItem) + root.currMaterialItem.commitRename(); - currentMaterialIdx = materialBrowserModel.selectedIndex; + root.currMaterialItem = gridRepeater.itemAt(materialBrowserModel.selectedIndex); + } + } + + MaterialBrowserContextMenu { + id: ctxMenu + } + + MaterialBundleContextMenu { + id: ctxMenuBundle + + onUnimport: (bundleMat) => { + unimportBundleMaterialDialog.targetBundleMaterial = bundleMat + unimportBundleMaterialDialog.open() } } @@ -101,152 +106,6 @@ Item { id: unimportBundleMaterialDialog } - StudioControls.Menu { - id: ctxMenu - - closePolicy: StudioControls.Menu.CloseOnEscape | StudioControls.Menu.CloseOnPressOutside - - StudioControls.MenuItem { - text: qsTr("Apply to selected (replace)") - enabled: root.currentMaterial && materialBrowserModel.hasModelSelection - onTriggered: materialBrowserModel.applyToSelected(root.currentMaterial.materialInternalId, false) - } - - StudioControls.MenuItem { - text: qsTr("Apply to selected (add)") - enabled: root.currentMaterial && materialBrowserModel.hasModelSelection - onTriggered: materialBrowserModel.applyToSelected(root.currentMaterial.materialInternalId, true) - } - - StudioControls.MenuSeparator { - height: StudioTheme.Values.border - } - - StudioControls.Menu { - title: qsTr("Copy properties") - enabled: root.currentMaterial - - width: parent.width - - onAboutToShow: { - if (root.currentMaterial.hasDynamicProperties) - root.matSectionsModel = ["All", "Custom"]; - else - root.matSectionsModel = ["All"]; - - switch (root.currentMaterial.materialType) { - case "DefaultMaterial": - root.matSectionsModel = root.matSectionsModel.concat(materialBrowserModel.defaultMaterialSections); - break; - - case "PrincipledMaterial": - root.matSectionsModel = root.matSectionsModel.concat(materialBrowserModel.principledMaterialSections); - break; - - case "CustomMaterial": - root.matSectionsModel = root.matSectionsModel.concat(materialBrowserModel.customMaterialSections); - break; - } - } - - Repeater { - model: root.matSectionsModel - - StudioControls.MenuItem { - text: modelData - enabled: root.currentMaterial - onTriggered: { - root.copiedMaterialInternalId = root.currentMaterial.materialInternalId - materialBrowserModel.copyMaterialProperties(root.currentMaterialIdx, modelData) - } - } - } - } - - StudioControls.MenuItem { - text: qsTr("Paste properties") - enabled: root.currentMaterial - && root.copiedMaterialInternalId !== root.currentMaterial.materialInternalId - && root.currentMaterial.materialType === materialBrowserModel.copiedMaterialType - && materialBrowserModel.isCopiedMaterialValid() - onTriggered: materialBrowserModel.pasteMaterialProperties(root.currentMaterialIdx) - } - - StudioControls.MenuSeparator { - height: StudioTheme.Values.border - } - - StudioControls.MenuItem { - text: qsTr("Duplicate") - enabled: root.currentMaterial - onTriggered: materialBrowserModel.duplicateMaterial(root.currentMaterialIdx) - } - - StudioControls.MenuItem { - text: qsTr("Rename") - enabled: root.currentMaterial - onTriggered: { - var item = gridRepeater.itemAt(root.currentMaterialIdx); - if (item) - item.startRename(); - } - } - - StudioControls.MenuItem { - text: qsTr("Delete") - enabled: root.currentMaterial - - onTriggered: materialBrowserModel.deleteMaterial(root.currentMaterialIdx) - } - - StudioControls.MenuSeparator {} - - StudioControls.MenuItem { - text: qsTr("Create New Material") - - onTriggered: materialBrowserModel.addNewMaterial() - } - } - - StudioControls.Menu { - id: ctxMenuBundle - - closePolicy: StudioControls.Menu.CloseOnEscape | StudioControls.Menu.CloseOnPressOutside - - StudioControls.MenuItem { - text: qsTr("Apply to selected (replace)") - enabled: root.currentBundleMaterial && materialBrowserModel.hasModelSelection - onTriggered: materialBrowserBundleModel.applyToSelected(root.currentBundleMaterial, false) - } - - StudioControls.MenuItem { - text: qsTr("Apply to selected (add)") - enabled: root.currentBundleMaterial && materialBrowserModel.hasModelSelection - onTriggered: materialBrowserBundleModel.applyToSelected(root.currentBundleMaterial, true) - } - - StudioControls.MenuSeparator {} - - StudioControls.MenuItem { - enabled: !materialBrowserBundleModel.importerRunning - text: qsTr("Add an instance to project") - - onTriggered: { - materialBrowserBundleModel.addToProject(root.currentBundleMaterial) - } - } - - StudioControls.MenuItem { - enabled: !materialBrowserBundleModel.importerRunning && root.currentBundleMaterial.bundleMaterialImported - text: qsTr("Remove from project") - - onTriggered: { - unimportBundleMaterialDialog.targetBundleMaterial = root.currentBundleMaterial - unimportBundleMaterialDialog.open() - } - } - } - Column { id: col y: 5 @@ -347,8 +206,7 @@ Item { height: root.cellHeight onShowContextMenu: { - root.currentMaterial = model - ctxMenu.popup() + ctxMenu.popupMenu(this, model) } } } @@ -410,8 +268,7 @@ Item { height: root.cellHeight onShowContextMenu: { - root.currentBundleMaterial = modelData - ctxMenuBundle.popup() + ctxMenuBundle.popupMenu(modelData) } } } diff --git a/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowserContextMenu.qml b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowserContextMenu.qml new file mode 100644 index 00000000000..d1e9f1ab1f4 --- /dev/null +++ b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowserContextMenu.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2022 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 QtQuick +import HelperWidgets +import StudioControls as StudioControls +import StudioTheme as StudioTheme + +StudioControls.Menu { + id: root + + property var targetMaterial: null + property var targetItem: null + property int copiedMaterialInternalId: -1 + property var matSectionsModel: [] + + function popupMenu(targetItem = null, targetMaterial = null) + { + this.targetItem = targetItem + this.targetMaterial = targetMaterial + popup() + } + + closePolicy: StudioControls.Menu.CloseOnEscape | StudioControls.Menu.CloseOnPressOutside + + StudioControls.MenuItem { + text: qsTr("Apply to selected (replace)") + enabled: root.targetMaterial && materialBrowserModel.hasModelSelection + onTriggered: materialBrowserModel.applyToSelected(root.targetMaterial.materialInternalId, false) + } + + StudioControls.MenuItem { + text: qsTr("Apply to selected (add)") + enabled: root.targetMaterial && materialBrowserModel.hasModelSelection + onTriggered: materialBrowserModel.applyToSelected(root.targetMaterial.materialInternalId, true) + } + + StudioControls.MenuSeparator {} + + StudioControls.Menu { + title: qsTr("Copy properties") + enabled: root.targetMaterial + + width: parent.width + + onAboutToShow: { + if (root.targetMaterial.hasDynamicProperties) + root.matSectionsModel = ["All", "Custom"]; + else + root.matSectionsModel = ["All"]; + + switch (root.targetMaterial.materialType) { + case "DefaultMaterial": + root.matSectionsModel = root.matSectionsModel.concat(materialBrowserModel.defaultMaterialSections); + break; + + case "PrincipledMaterial": + root.matSectionsModel = root.matSectionsModel.concat(materialBrowserModel.principledMaterialSections); + break; + + case "CustomMaterial": + root.matSectionsModel = root.matSectionsModel.concat(materialBrowserModel.customMaterialSections); + break; + } + } + + Repeater { + model: root.matSectionsModel + + StudioControls.MenuItem { + text: modelData + enabled: root.targetMaterial + onTriggered: { + root.copiedMaterialInternalId = root.targetMaterial.materialInternalId + materialBrowserModel.copyMaterialProperties(materialBrowserModel.selectedIndex, modelData) + } + } + } + } + + StudioControls.MenuItem { + text: qsTr("Paste properties") + enabled: root.targetMaterial + && root.copiedMaterialInternalId !== root.targetMaterial.materialInternalId + && root.targetMaterial.materialType === materialBrowserModel.copiedMaterialType + && materialBrowserModel.isCopiedMaterialValid() + onTriggered: materialBrowserModel.pasteMaterialProperties(materialBrowserModel.selectedIndex) + } + + StudioControls.MenuSeparator {} + + StudioControls.MenuItem { + text: qsTr("Duplicate") + enabled: root.targetMaterial + onTriggered: materialBrowserModel.duplicateMaterial(materialBrowserModel.selectedIndex) + } + + StudioControls.MenuItem { + text: qsTr("Rename") + enabled: root.targetItem + onTriggered: root.targetItem.startRename(); + } + + StudioControls.MenuItem { + text: qsTr("Delete") + enabled: root.targetMaterial + + onTriggered: materialBrowserModel.deleteMaterial(materialBrowserModel.selectedIndex) + } + + StudioControls.MenuSeparator {} + + StudioControls.MenuItem { + text: qsTr("Create New Material") + + onTriggered: materialBrowserModel.addNewMaterial() + } +} diff --git a/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBundleContextMenu.qml b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBundleContextMenu.qml new file mode 100644 index 00000000000..eb698d69932 --- /dev/null +++ b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBundleContextMenu.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2022 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 QtQuick 2.15 +import HelperWidgets 2.0 +import StudioControls 1.0 as StudioControls +import StudioTheme 1.0 as StudioTheme + +StudioControls.Menu { + id: root + + property var targetMaterial: null + signal unimport(var bundleMat); + + function popupMenu(targetMaterial = null) + { + this.targetMaterial = targetMaterial + popup() + } + + closePolicy: StudioControls.Menu.CloseOnEscape | StudioControls.Menu.CloseOnPressOutside + + StudioControls.MenuItem { + text: qsTr("Apply to selected (replace)") + enabled: root.targetMaterial && materialBrowserModel.hasModelSelection + onTriggered: materialBrowserBundleModel.applyToSelected(root.targetMaterial, false) + } + + StudioControls.MenuItem { + text: qsTr("Apply to selected (add)") + enabled: root.targetMaterial && materialBrowserModel.hasModelSelection + onTriggered: materialBrowserBundleModel.applyToSelected(root.targetMaterial, true) + } + + StudioControls.MenuSeparator {} + + StudioControls.MenuItem { + enabled: !materialBrowserBundleModel.importerRunning + text: qsTr("Add an instance to project") + + onTriggered: { + materialBrowserBundleModel.addToProject(root.targetMaterial) + } + } + + StudioControls.MenuItem { + enabled: !materialBrowserBundleModel.importerRunning && root.targetMaterial.bundleMaterialImported + text: qsTr("Remove from project") + + onTriggered: root.unimport(root.targetMaterial); + } +} From edd07ff986b6edb4ad001a88d673c152501b555f Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 18 Oct 2022 16:49:09 +0200 Subject: [PATCH 07/12] QmlDesigner: Delay project preview generation by 10 seconds This way the preview generation does not block opening the project and the project is fully loaded. If the preview is null we store this in the data base and wait one hour until we try to regenerate it. Otherwise we might try to render a preview whenever we switch files. Task-number: QDS-7992 Change-Id: I80a078ec7b8d418fa1fccd14bc4603b82c36c5e0 Reviewed-by: Marco Bubke Reviewed-by: Qt CI Bot --- .../qmldesigner/qmldesignerprojectmanager.cpp | 28 ++++++++++++++----- .../qmldesigner/qmldesignerprojectmanager.h | 3 ++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp b/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp index 366f1ef04e3..95ad8eff6a6 100644 --- a/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp +++ b/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp @@ -138,7 +138,7 @@ public: ImageCacheCollector collector{connectionManager, QSize{300, 300}, QSize{1000, 1000}, - ImageCacheCollectorNullImageHandling::DontCaptureNullImage}; + ImageCacheCollectorNullImageHandling::CaptureNullImage}; PreviewTimeStampProvider timeStampProvider; AsynchronousImageFactory factory; QPointer<::ProjectExplorer::Target> activeTarget; @@ -167,6 +167,11 @@ QmlDesignerProjectManager::QmlDesignerProjectManager() QObject::connect(sessionManager, &::ProjectExplorer::SessionManager::projectRemoved, [&](auto *project) { projectRemoved(project); }); + + QObject::connect(&m_previewTimer, + &QTimer::timeout, + this, + &QmlDesignerProjectManager::generatePreview); } QmlDesignerProjectManager::~QmlDesignerProjectManager() = default; @@ -196,13 +201,8 @@ void QmlDesignerProjectManager::currentEditorChanged(::Core::IEditor *) if (!m_projectData || !m_projectData->activeTarget) return; - ::QmlProjectManager::QmlBuildSystem *qmlBuildSystem = getQmlBuildSystem( - m_projectData->activeTarget); + m_previewTimer.start(10000); - if (qmlBuildSystem) { - m_projectData->collector.setTarget(m_projectData->activeTarget); - m_projectData->factory.generate(qmlBuildSystem->mainFilePath().toString().toUtf8()); - } } void QmlDesignerProjectManager::editorsClosed(const QList<::Core::IEditor *> &) {} @@ -221,6 +221,20 @@ void QmlDesignerProjectManager::aboutToRemoveProject(::ProjectExplorer::Project void QmlDesignerProjectManager::projectRemoved(::ProjectExplorer::Project *) {} +void QmlDesignerProjectManager::generatePreview() +{ + if (!m_projectData || !m_projectData->activeTarget) + return; + + ::QmlProjectManager::QmlBuildSystem *qmlBuildSystem = getQmlBuildSystem( + m_projectData->activeTarget); + + if (qmlBuildSystem) { + m_projectData->collector.setTarget(m_projectData->activeTarget); + m_projectData->factory.generate(qmlBuildSystem->mainFilePath().toString().toUtf8()); + } +} + QmlDesignerProjectManager::ImageCacheData *QmlDesignerProjectManager::imageCacheData() { std::call_once(imageCacheFlag, [this]() { diff --git a/src/plugins/qmldesigner/qmldesignerprojectmanager.h b/src/plugins/qmldesigner/qmldesignerprojectmanager.h index 68cd809be3d..78001988128 100644 --- a/src/plugins/qmldesigner/qmldesignerprojectmanager.h +++ b/src/plugins/qmldesigner/qmldesignerprojectmanager.h @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -68,6 +69,7 @@ private: void projectAdded(::ProjectExplorer::Project *project); void aboutToRemoveProject(::ProjectExplorer::Project *project); void projectRemoved(::ProjectExplorer::Project *project); + void generatePreview(); ImageCacheData *imageCacheData(); private: @@ -75,5 +77,6 @@ private: std::unique_ptr m_imageCacheData; std::unique_ptr m_previewImageCacheData; std::unique_ptr m_projectData; + QTimer m_previewTimer; }; } // namespace QmlDesigner From 3be3663bf767d33c44297a7be957591939f4b7b7 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 18 Oct 2022 16:47:11 +0200 Subject: [PATCH 08/12] QmlDesigner: Do not compare type names for file components For file components the fully qualified type name is not properly defined and the component is created from source anyway. Task-number: QDS-7992 Change-Id: I2c2754c1bab53257a210c2e4de990a0a768618a3 Reviewed-by: Marco Bubke Reviewed-by: Qt CI Bot --- .../qmldesigner/designercore/metainfo/nodemetainfo.cpp | 4 ++++ .../qmldesigner/designercore/model/texttomodelmerger.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index a07443af5fd..f8da416b17c 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -827,6 +827,8 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, TypeName type, int maj, i if (importInfo.type() == ImportType::Library) { m_majorVersion = importInfo.version().majorVersion(); m_minorVersion = importInfo.version().minorVersion(); + } else { + m_isFileComponent = true; } m_qualfiedTypeName = getUnqualifiedName(m_qualfiedTypeName); @@ -835,6 +837,8 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, TypeName type, int maj, i || importInfo.type() == ImportType::Directory); if (prepandName) m_qualfiedTypeName.prepend(importInfo.name().toUtf8() + '.'); + + m_qualfiedTypeName.replace("/", "."); } m_objectValue = getObjectValue(); diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index 2a5471be8f4..1a0d3ae9c33 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -531,7 +531,7 @@ public: qDebug() << metaInfo.isValid() << metaInfo.typeName(); qDebug() << metaInfo.directSuperClass().typeName(); - if (!typeName.startsWith("...") && m_model == m_model->metaInfoProxyModel() + if (!metaInfo.isFileComponent() && m_model == m_model->metaInfoProxyModel() && metaInfo.isValid()) throw RewritingException(__LINE__, __FUNCTION__, __FILE__, "test", "test"); } From ea13277c7a6522183c01b2569b181d69f068bc3a Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 28 Sep 2022 16:56:31 +0200 Subject: [PATCH 09/12] QmlDesigner: Fix StyleMerger for custom types If the template uses custom types they are only found if we register the correct fileUrl. Change-Id: Ia358a39d5c5c5bbcaf403ae3c250495ddadfc326 Reviewed-by: Qt CI Bot Reviewed-by: Vikas Pachdha Reviewed-by: --- .../components/componentcore/modelnodeoperations.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp index 0d5a10fb105..92f903aa0a6 100644 --- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp +++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp @@ -1514,7 +1514,7 @@ void styleMerge(const SelectionContext &selectionContext, const QString &templat QScopedPointer templateModel(Model::create("QtQuick.Item", 2, 1, parentModel)); Q_ASSERT(templateModel.data()); - templateModel->setFileUrl(QUrl::fromLocalFile(templateFile)); + templateModel->setFileUrl(selectionContext.view()->model()->fileUrl()); QPlainTextEdit textEditTemplate; Utils::FileReader reader; @@ -1540,7 +1540,7 @@ void styleMerge(const SelectionContext &selectionContext, const QString &templat QScopedPointer styleModel(Model::create("QtQuick.Item", 2, 1, parentModel)); Q_ASSERT(styleModel.data()); - styleModel->setFileUrl(QUrl::fromLocalFile(templateFile)); + styleModel->setFileUrl(selectionContext.view()->model()->fileUrl()); QPlainTextEdit textEditStyle; RewriterView *parentRewriterView = selectionContext.view()->model()->rewriterView(); From 1523129d50c5c7b7fc9c8b142a34f60f01a99f67 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 28 Sep 2022 17:51:01 +0200 Subject: [PATCH 10/12] QmlDesigner: Add helper function to StylesheetMerger Change-Id: If3857af4a3541cb1b77a87d168f33571954dd5e4 Reviewed-by: Qt CI Bot Reviewed-by: Vikas Pachdha Reviewed-by: --- .../componentcore/modelnodeoperations.cpp | 64 +---------------- .../designercore/include/stylesheetmerger.h | 2 + .../designercore/model/stylesheetmerger.cpp | 71 +++++++++++++++++++ 3 files changed, 74 insertions(+), 63 deletions(-) diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp index 92f903aa0a6..5724d5d1002 100644 --- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp +++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp @@ -1505,68 +1505,6 @@ QString getTemplateDialog(const Utils::FilePath &projectPath) return result; } -void styleMerge(const SelectionContext &selectionContext, const QString &templateFile) -{ - Model *parentModel = selectionContext.view()->model(); - - QTC_ASSERT(parentModel, return); - - QScopedPointer templateModel(Model::create("QtQuick.Item", 2, 1, parentModel)); - Q_ASSERT(templateModel.data()); - - templateModel->setFileUrl(selectionContext.view()->model()->fileUrl()); - - QPlainTextEdit textEditTemplate; - Utils::FileReader reader; - - QTC_ASSERT(reader.fetch(Utils::FilePath::fromString(templateFile)), return); - QString qmlTemplateString = QString::fromUtf8(reader.data()); - QString imports; - - for (const Import &import : parentModel->imports()) - imports += QStringLiteral("import ") + import.toString(true) + QLatin1Char(';') + QLatin1Char('\n'); - - textEditTemplate.setPlainText(imports + qmlTemplateString); - NotIndentingTextEditModifier textModifierTemplate(&textEditTemplate); - - QScopedPointer templateRewriterView(new RewriterView(RewriterView::Amend, nullptr)); - templateRewriterView->setTextModifier(&textModifierTemplate); - templateModel->attachView(templateRewriterView.data()); - templateRewriterView->setCheckSemanticErrors(false); - - ModelNode templateRootNode = templateRewriterView->rootModelNode(); - QTC_ASSERT(templateRootNode.isValid(), return); - - QScopedPointer styleModel(Model::create("QtQuick.Item", 2, 1, parentModel)); - Q_ASSERT(styleModel.data()); - - styleModel->setFileUrl(selectionContext.view()->model()->fileUrl()); - - QPlainTextEdit textEditStyle; - RewriterView *parentRewriterView = selectionContext.view()->model()->rewriterView(); - QTC_ASSERT(parentRewriterView, return); - textEditStyle.setPlainText(parentRewriterView->textModifierContent()); - NotIndentingTextEditModifier textModifierStyle(&textEditStyle); - - QScopedPointer styleRewriterView(new RewriterView(RewriterView::Amend, nullptr)); - styleRewriterView->setTextModifier(&textModifierStyle); - styleModel->attachView(styleRewriterView.data()); - - StylesheetMerger merger(templateRewriterView.data(), styleRewriterView.data()); - - try { - merger.merge(); - } catch (Exception &e) { - e.showException(); - } - - try { - parentRewriterView->textModifier()->textDocument()->setPlainText(templateRewriterView->textModifierContent()); - } catch (Exception &e) { - e.showException(); - } -} - void mergeWithTemplate(const SelectionContext &selectionContext) { const Utils::FilePath projectPath = Utils::FilePath::fromString(baseDirectory(selectionContext.view()->model()->fileUrl())); @@ -1574,7 +1512,7 @@ void mergeWithTemplate(const SelectionContext &selectionContext) const QString templateFile = getTemplateDialog(projectPath); if (QFileInfo::exists(templateFile)) - styleMerge(selectionContext, templateFile); + StylesheetMerger::styleMerge(selectionContext.view()->model(), templateFile); } void removeGroup(const SelectionContext &selectionContext) diff --git a/src/plugins/qmldesigner/designercore/include/stylesheetmerger.h b/src/plugins/qmldesigner/designercore/include/stylesheetmerger.h index 86f48f06776..202f54ad3bf 100644 --- a/src/plugins/qmldesigner/designercore/include/stylesheetmerger.h +++ b/src/plugins/qmldesigner/designercore/include/stylesheetmerger.h @@ -48,6 +48,8 @@ class QMLDESIGNERCORE_EXPORT StylesheetMerger public: StylesheetMerger(AbstractView*, AbstractView*); void merge(); + static void styleMerge(Model *model, const QString &templateFile); + private: void preprocessStyleSheet(); bool idExistsInBothModels(const QString& id); diff --git a/src/plugins/qmldesigner/designercore/model/stylesheetmerger.cpp b/src/plugins/qmldesigner/designercore/model/stylesheetmerger.cpp index e12912811f8..655a8a0938c 100644 --- a/src/plugins/qmldesigner/designercore/model/stylesheetmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/stylesheetmerger.cpp @@ -34,8 +34,14 @@ #include #include #include +#include +#include #include +#include +#include + +#include #include #include @@ -527,4 +533,69 @@ void StylesheetMerger::merge() } } } + +void StylesheetMerger::styleMerge(Model *model, const QString &templateFile) +{ + Model *parentModel = model; + + QTC_ASSERT(parentModel, return ); + + QScopedPointer templateModel(Model::create("QtQuick.Item", 2, 1, parentModel)); + Q_ASSERT(templateModel.data()); + + templateModel->setFileUrl(parentModel->fileUrl()); + + QPlainTextEdit textEditTemplate; + Utils::FileReader reader; + + QTC_ASSERT(reader.fetch(Utils::FilePath::fromString(templateFile)), return ); + QString qmlTemplateString = QString::fromUtf8(reader.data()); + QString imports; + + for (const Import &import : parentModel->imports()) + imports += QStringLiteral("import ") + import.toString(true) + QLatin1Char(';') + + QLatin1Char('\n'); + + textEditTemplate.setPlainText(imports + qmlTemplateString); + NotIndentingTextEditModifier textModifierTemplate(&textEditTemplate); + + QScopedPointer templateRewriterView( + new RewriterView(RewriterView::Amend, nullptr)); + templateRewriterView->setTextModifier(&textModifierTemplate); + templateModel->attachView(templateRewriterView.data()); + templateRewriterView->setCheckSemanticErrors(false); + + ModelNode templateRootNode = templateRewriterView->rootModelNode(); + QTC_ASSERT(templateRootNode.isValid(), return ); + + QScopedPointer styleModel(Model::create("QtQuick.Item", 2, 1, parentModel)); + Q_ASSERT(styleModel.data()); + + styleModel->setFileUrl(parentModel->fileUrl()); + + QPlainTextEdit textEditStyle; + RewriterView *parentRewriterView = parentModel->rewriterView(); + QTC_ASSERT(parentRewriterView, return ); + textEditStyle.setPlainText(parentRewriterView->textModifierContent()); + NotIndentingTextEditModifier textModifierStyle(&textEditStyle); + + QScopedPointer styleRewriterView(new RewriterView(RewriterView::Amend, nullptr)); + styleRewriterView->setTextModifier(&textModifierStyle); + styleModel->attachView(styleRewriterView.data()); + + StylesheetMerger merger(templateRewriterView.data(), styleRewriterView.data()); + + try { + merger.merge(); + } catch (Exception &e) { + e.showException(); + } + + try { + parentRewriterView->textModifier()->textDocument()->setPlainText( + templateRewriterView->textModifierContent()); + } catch (Exception &e) { + e.showException(); + } +} } From 5ca3db5ff7a76a5aed1e5817853d13e14ebb9d3c Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 18 Oct 2022 17:31:06 +0200 Subject: [PATCH 11/12] QmlDesigner: Fix crash We access the rewriterView() for the decription. Change-Id: I30883d02ab1a2b12dcd6a2bcac6fae82b97a2f5b Reviewed-by: Tim Jenssen Reviewed-by: Qt CI Bot Reviewed-by: --- src/plugins/qmldesigner/designercore/model/model.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/model/model.cpp b/src/plugins/qmldesigner/designercore/model/model.cpp index a1855f0b652..3501ab431ae 100644 --- a/src/plugins/qmldesigner/designercore/model/model.cpp +++ b/src/plugins/qmldesigner/designercore/model/model.cpp @@ -726,10 +726,15 @@ void ModelPrivate::setAuxiliaryData(const InternalNodePointer &node, void ModelPrivate::resetModelByRewriter(const QString &description) { - if (rewriterView()) + if (rewriterView()) { rewriterView()->resetToLastCorrectQml(); - throw RewritingException(__LINE__, __FUNCTION__, __FILE__, description.toUtf8(), rewriterView()->textModifierContent()); + throw RewritingException(__LINE__, + __FUNCTION__, + __FILE__, + description.toUtf8(), + rewriterView()->textModifierContent()); + } } void ModelPrivate::attachView(AbstractView *view) From 029f926bcfcbb01757b53bf67410ffcbbbe28569 Mon Sep 17 00:00:00 2001 From: Mats Honkamaa Date: Wed, 19 Oct 2022 12:48:28 +0300 Subject: [PATCH 12/12] Doc: Fix 3D effect docs Task-number: QDS-8026 Change-Id: Ic59b58e8d0c033b2fc6ec1e18d0ca4ddcfe63699 Reviewed-by: Leena Miettinen --- .../src/qtquick3d-editor/qtdesignstudio-3d-effects.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-effects.qdoc b/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-effects.qdoc index 5679e96874f..58d3da59e5e 100644 --- a/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-effects.qdoc +++ b/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-effects.qdoc @@ -35,8 +35,8 @@ \QDS provides a set of 3D effects, which are visible in the \l {2D} view. To apply a visual effect to a scene, drag-and-drop an effect from \uicontrol Components > \uicontrol {Qt Quick 3D} > - \uicontrol {Qt Quick 3D Effects} to a \uicontrol View3D component in - \l Navigator. + \uicontrol {Qt Quick 3D Effects} to a \uicontrol SceneEnvironment component + in \l Navigator. You can use the \l Effect component available in \uicontrol Components > \uicontrol {Qt Quick 3D} > \uicontrol {Qt Quick 3D} as the base