From 00679f2af2b5b68a901cf13a1b29f70a92552d50 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 19 Aug 2022 08:46:22 +0200 Subject: [PATCH 01/35] StudioWelcome: Only disable welcome screen if download is started Task-number: QDS-7448 Change-Id: Ic239ba4e5ff4549642cbcb38ab823331dee64308 Reviewed-by: Thomas Hartmann --- src/plugins/studiowelcome/studiowelcomeplugin.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp index f78bc1ca626..b9df286c2a7 100644 --- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp +++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp @@ -647,8 +647,6 @@ WelcomeMode::WelcomeMode() m_quickWidget->rootObject()->setProperty("loadingProgress", m_dataModelDownloader->progress()); }); - m_quickWidget->setEnabled(false); - connect(m_dataModelDownloader, &DataModelDownloader::finished, this, [this, welcomePagePath]() { delete m_quickWidget; createQuickWidget(); From dc8e13995ab43fd1c05ec40ea876f5208869aa38 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 19 Aug 2022 12:41:23 +0200 Subject: [PATCH 02/35] StudioWelcome: Scale down splash screen if it does not fit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the splash screen does not fit on the screen we have to scale it down. Task-number: QDS-7449 Change-Id: I73018563e9f863d3a8f60facf7599590fb602f0f Reviewed-by: Brook Cronin Reviewed-by: Reviewed-by: Henning Gründl --- .../qml/splashscreen/Welcome_splash.qml | 5 ++--- .../studiowelcome/qml/splashscreen/main.qml | 14 ++++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/plugins/studiowelcome/qml/splashscreen/Welcome_splash.qml b/src/plugins/studiowelcome/qml/splashscreen/Welcome_splash.qml index 153436278ee..73c4eded2bc 100644 --- a/src/plugins/studiowelcome/qml/splashscreen/Welcome_splash.qml +++ b/src/plugins/studiowelcome/qml/splashscreen/Welcome_splash.qml @@ -32,7 +32,8 @@ import QtQuick.Shapes 1.0 Rectangle { id: welcome_splash - anchors.fill: parent + width: 600 + height: 720 clip: true gradient: Gradient { @@ -55,8 +56,6 @@ Rectangle { property bool doNotShowAgain: true property bool loadingPlugins: true - width: 600 - height: 720 visible: true color: "#1d212a" diff --git a/src/plugins/studiowelcome/qml/splashscreen/main.qml b/src/plugins/studiowelcome/qml/splashscreen/main.qml index b60e4668cb0..ee68681ab5f 100644 --- a/src/plugins/studiowelcome/qml/splashscreen/main.qml +++ b/src/plugins/studiowelcome/qml/splashscreen/main.qml @@ -27,8 +27,13 @@ import QtQuick 2.0 Item { id: root - width: 600 - height: 720 + width: 600 * root.mainScale + height: 720 * root.mainScale + + property int maxHeight: Screen.desktopAvailableHeight - 100 + + property real mainScale: root.maxHeight > 720 ? 1 : root.maxHeight / 720 + signal closeClicked signal checkBoxToggled @@ -42,9 +47,10 @@ Item { } Welcome_splash { + scale: root.mainScale id: welcome_splash - x: 0 - y: 0 + + transformOrigin: Item.TopLeft antialiasing: true onCloseClicked: root.closeClicked() onConfigureClicked: root.configureClicked() From 5e6ad51e972bbc1fb937269be73f5555f64e2986 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 15 Aug 2022 14:36:29 +0200 Subject: [PATCH 03/35] ScxmlEditor: Fix a crash when closing scxml editor Don't iterate on m_overlappedItems inside d'tor, as every iteration calls removeOverlappingItem() and it modifies the container being iterated. Do the same for m_outputTransitions and m_inputTransitions. Amends 8b444f88eb6cf37fcfbae8ae8d7388a43fcb78fb Fixes: QTCREATORBUG-28027 Change-Id: I78fe67b5ea584c969e4850a2db3f00d981296865 Reviewed-by: Reviewed-by: Artem Sokolovskii Reviewed-by: Alessandro Portale --- .../scxmleditor/plugin_interface/connectableitem.cpp | 12 ++++++++---- .../plugin_interface/scattributeitemdelegate.cpp | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp b/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp index 5132f19038b..6fe6899fa31 100644 --- a/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp +++ b/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp @@ -64,15 +64,18 @@ ConnectableItem::~ConnectableItem() { setBlockUpdates(true); - for (ConnectableItem *item : qAsConst(m_overlappedItems)) + const QList overlappedItems = m_overlappedItems; + for (ConnectableItem *item : overlappedItems) item->removeOverlappingItem(this); m_overlappedItems.clear(); - for (TransitionItem *transition : qAsConst(m_outputTransitions)) + const QList outputTransitions = m_outputTransitions; + for (TransitionItem *transition : outputTransitions) transition->disconnectItem(this); m_outputTransitions.clear(); - for (TransitionItem *transition : qAsConst(m_inputTransitions)) + const QList inputTransitions = m_inputTransitions; + for (TransitionItem *transition : inputTransitions) transition->disconnectItem(this); m_inputTransitions.clear(); @@ -310,7 +313,8 @@ void ConnectableItem::updateTransitions(bool allChildren) updateInputTransitions(); if (allChildren) { - for (QGraphicsItem *it : childItems()) { + const QList items = childItems(); + for (QGraphicsItem *it : items) { auto item = static_cast(it); if (item && item->type() >= InitialStateType) item->updateTransitions(allChildren); diff --git a/src/plugins/scxmleditor/plugin_interface/scattributeitemdelegate.cpp b/src/plugins/scxmleditor/plugin_interface/scattributeitemdelegate.cpp index bd90d3f8463..365038a476a 100644 --- a/src/plugins/scxmleditor/plugin_interface/scattributeitemdelegate.cpp +++ b/src/plugins/scxmleditor/plugin_interface/scattributeitemdelegate.cpp @@ -80,7 +80,7 @@ void SCAttributeItemDelegate::setEditorData(QWidget *editor, const QModelIndex & combo->clear(); const QStringList values = index.data(DataRole).toString().split(";"); - for (QString val : values) + for (const QString &val : values) combo->addItem(val); combo->setCurrentText(index.data().toString()); From 765f632b295adaf8634f047d3d4bf839b6e09e8a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 19 Aug 2022 09:48:25 +0200 Subject: [PATCH 04/35] StudioWelcome: Move plugin to "Utilities" category People regularly report that they somehow got this plugin enabled in Qt Creator, and one reason could be that they just enabled all plugins in the "Qt Quick" category (e.g. by clicking the checkbox for that category). Separate this plugin from the group. Task-number: QDS-7449 Change-Id: I0a6e7ee7bc1a59cb2cd2fc28bc037fc62e184315 Reviewed-by: Thomas Hartmann --- src/plugins/studiowelcome/StudioWelcome.json.in | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/studiowelcome/StudioWelcome.json.in b/src/plugins/studiowelcome/StudioWelcome.json.in index 6f029910334..94e7e2e2bea 100644 --- a/src/plugins/studiowelcome/StudioWelcome.json.in +++ b/src/plugins/studiowelcome/StudioWelcome.json.in @@ -13,7 +13,6 @@ \"\", \"Alternatively, this plugin 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 plugin. 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.\" ], - \"Category\" : \"Qt Quick\", \"Description\" : \"Qt Design Studio Welcome Page.\", \"Url\" : \"http://www.qt.io\", $$dependencyList From 3b73b27862c2fad1dc16b499c1c37a74bdbfdd25 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 22 Aug 2022 13:15:41 +0200 Subject: [PATCH 05/35] ScxmlEditor: Fix build with Qt5 Change-Id: I09609ac62604885f7800088619cbe1f4ea510d83 Reviewed-by: Jarek Kobus --- .../scxmleditor/plugin_interface/connectableitem.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp b/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp index 6fe6899fa31..a33166ca6eb 100644 --- a/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp +++ b/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp @@ -64,17 +64,17 @@ ConnectableItem::~ConnectableItem() { setBlockUpdates(true); - const QList overlappedItems = m_overlappedItems; + const QVector overlappedItems = m_overlappedItems; for (ConnectableItem *item : overlappedItems) item->removeOverlappingItem(this); m_overlappedItems.clear(); - const QList outputTransitions = m_outputTransitions; + const QVector outputTransitions = m_outputTransitions; for (TransitionItem *transition : outputTransitions) transition->disconnectItem(this); m_outputTransitions.clear(); - const QList inputTransitions = m_inputTransitions; + const QVector inputTransitions = m_inputTransitions; for (TransitionItem *transition : inputTransitions) transition->disconnectItem(this); m_inputTransitions.clear(); From 86d1526564b2aad91ac84039af9e97e69f072ae7 Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Mon, 22 Aug 2022 16:09:42 +0300 Subject: [PATCH 06/35] QmlDesigner: Fix propertyGroups.json warning for 2D projects Load property groups file only if Quick3D import exists Change-Id: Idf7b95cb4efa34dde6196964e5e2cbad54341193 Reviewed-by: Miikka Heikkinen --- .../materialbrowser/materialbrowsermodel.cpp | 5 ++++- .../materialbrowser/materialbrowsermodel.h | 2 +- .../materialbrowser/materialbrowserview.cpp | 18 ++++++++++++++---- .../materialbrowser/materialbrowserview.h | 2 ++ 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp index 4027a1c75ae..5a03ba43d8c 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp @@ -95,8 +95,9 @@ bool MaterialBrowserModel::isValidIndex(int idx) const * propertyGroups.json contains lists of QtQuick3D objects' properties grouped by sections * * @param path path to propertyGroups.json file + * @return load successful */ -void MaterialBrowserModel::loadPropertyGroups(const QString &path) +bool MaterialBrowserModel::loadPropertyGroups(const QString &path) { bool ok = true; @@ -131,6 +132,8 @@ void MaterialBrowserModel::loadPropertyGroups(const QString &path) m_customMaterialSections.append(customMatSections); } emit materialSectionsChanged(); + + return ok; } QHash MaterialBrowserModel::roleNames() const diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h index 5f38e7488eb..daa39c3539e 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h @@ -79,7 +79,7 @@ public: void updateSelectedMaterial(); int materialIndex(const ModelNode &material) const; ModelNode materialAt(int idx) const; - void loadPropertyGroups(const QString &path); + bool loadPropertyGroups(const QString &path); void resetModel(); diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp index 0d05b12d6a1..1b7ee3f71f9 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp @@ -128,14 +128,12 @@ void MaterialBrowserView::modelAttached(Model *model) { AbstractView::modelAttached(model); - QString matPropsPath = model->metaInfo("QtQuick3D.Material").importDirectoryPath() - + "/designer/propertyGroups.json"; - m_widget->materialBrowserModel()->loadPropertyGroups(matPropsPath); - m_widget->clearSearchFilter(); m_widget->materialBrowserModel()->setHasMaterialRoot(rootModelNode().isSubclassOf("QtQuick3D.Material")); m_hasQuick3DImport = model->hasImport("QtQuick3D"); + loadPropertyGroups(); + // Project load is already very busy and may even trigger puppet reset, so let's wait a moment // before refreshing the model QTimer::singleShot(1000, this, [this]() { @@ -295,6 +293,16 @@ void MaterialBrowserView::nodeRemoved(const ModelNode &removedNode, m_widget->materialBrowserModel()->updateSelectedMaterial(); } +void QmlDesigner::MaterialBrowserView::loadPropertyGroups() +{ + if (!m_hasQuick3DImport || m_propertyGroupsLoaded) + return; + + QString matPropsPath = model()->metaInfo("QtQuick3D.Material").importDirectoryPath() + + "/designer/propertyGroups.json"; + m_propertyGroupsLoaded = m_widget->materialBrowserModel()->loadPropertyGroups(matPropsPath); +} + void MaterialBrowserView::importsChanged(const QList &addedImports, const QList &removedImports) { Q_UNUSED(addedImports) @@ -307,6 +315,8 @@ void MaterialBrowserView::importsChanged(const QList &addedImports, cons m_hasQuick3DImport = hasQuick3DImport; + loadPropertyGroups(); + // Import change will trigger puppet reset, so we don't want to update previews immediately refreshModel(false); } diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.h b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.h index 503986a28ec..82ecfe593ed 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.h +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.h @@ -70,6 +70,8 @@ private: bool m_hasQuick3DImport = false; bool m_autoSelectModelMaterial = false; // TODO: wire this to some action bool m_puppetResetPending = false; + bool m_propertyGroupsLoaded = false; + void loadPropertyGroups(); }; } // namespace QmlDesigner From fc4ebb0cab19eb9e4a87262ea079c5ad74d9bf2b Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Fri, 19 Aug 2022 13:04:26 +0300 Subject: [PATCH 07/35] QmlDesigner: Create a context menu for the 3D Editor For now only 1 action is implemented (edit material), more actions are coming next. Task-number: QDS-7414 Task-number: QDS-7398 Change-Id: Id8e36c23d9a4d35ee94d55d3d6b15df78241a05d Reviewed-by: Reviewed-by: Miikka Heikkinen --- .../qt5informationnodeinstanceserver.cpp | 48 +++++++++++-------- .../qt5informationnodeinstanceserver.h | 1 + .../componentcore/modelnodeoperations.cpp | 6 ++- .../components/edit3d/edit3dcanvas.cpp | 3 ++ .../components/edit3d/edit3dview.cpp | 32 ++++++++++--- .../components/edit3d/edit3dview.h | 9 ++++ .../components/edit3d/edit3dwidget.cpp | 28 ++++++++++- .../components/edit3d/edit3dwidget.h | 16 +++++-- .../instances/nodeinstanceview.cpp | 3 +- 9 files changed, 111 insertions(+), 35 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index dae4f975b40..b94fa31fc63 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -291,6 +291,10 @@ void Qt5InformationNodeInstanceServer::handleInputEvents() // data stored internally in QMutableEventPoint to potentially be updated by system // before the event is delivered. QGuiApplication::sendEvent(m_editView3DData.window, me); + + // Context menu requested + if (command.button() == Qt::RightButton && command.modifiers() == Qt::NoModifier) + getModelAtPos(command.pos()); } } @@ -405,6 +409,29 @@ void Qt5InformationNodeInstanceServer::removeRotationBlocks(const QVector(m_3dHelper); + if (!helper) + return; + + QQmlProperty editViewProp(m_editView3DData.rootItem, "editView", context()); + QObject *obj = qvariant_cast(editViewProp.read()); + QQuick3DViewport *editView = qobject_cast(obj); + + QQuick3DModel *hitModel = helper->pickViewAt(editView, pos.x(), pos.y()).objectHit(); + + // filter out picks of models created dynamically or inside components + QQuick3DModel *resolvedPick = qobject_cast(helper->resolvePick(hitModel)); + + QVariant instance = resolvedPick ? instanceForObject(resolvedPick).instanceId() : -1; + nodeInstanceClient()->handlePuppetToCreatorCommand({PuppetToCreatorCommand::ModelAtPos, instance}); + return; +#endif +} + void Qt5InformationNodeInstanceServer::createEditView3D() { #ifdef QUICK3D_MODULE @@ -2399,26 +2426,7 @@ void Qt5InformationNodeInstanceServer::view3DAction(const View3DActionCommand &c #endif #ifdef QUICK3D_MODULE case View3DActionCommand::GetModelAtPos: { - // pick a Quick3DModel at view position - auto helper = qobject_cast(m_3dHelper); - if (!helper) - return; - - QQmlProperty editViewProp(m_editView3DData.rootItem, "editView", context()); - QObject *obj = qvariant_cast(editViewProp.read()); - QQuick3DViewport *editView = qobject_cast(obj); - - QPointF pos = command.value().toPointF(); - QQuick3DModel *hitModel = helper->pickViewAt(editView, pos.x(), pos.y()).objectHit(); - - // filter out picks of models created dynamically or inside components - QQuick3DModel *resolvedPick = qobject_cast(helper->resolvePick(hitModel)); - - if (resolvedPick) { - ServerNodeInstance instance = instanceForObject(resolvedPick); - nodeInstanceClient()->handlePuppetToCreatorCommand( - {PuppetToCreatorCommand::ModelAtPos, QVariant(instance.instanceId())}); - } + getModelAtPos(command.value().toPointF()); return; } #endif diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h index ea104442a6e..87c1d53d547 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h @@ -148,6 +148,7 @@ private: void updateMaterialPreviewData(const QVector &valueChanges); void updateRotationBlocks(const QVector &valueChanges); void removeRotationBlocks(const QVector &instanceIds); + void getModelAtPos(const QPointF &pos); void createAuxiliaryQuickView(const QUrl &url, RenderViewData &viewData); #ifdef QUICK3D_PARTICLES_MODULE diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp index 068e9cf2fd8..8df917be694 100644 --- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp +++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp @@ -796,7 +796,11 @@ void addNewSignalHandler(const SelectionContext &selectionState) // Open a model's material in the material editor void editMaterial(const SelectionContext &selectionContext) { - ModelNode modelNode = selectionContext.currentSingleSelectedNode(); + ModelNode modelNode = selectionContext.targetNode(); + + if (!modelNode.isValid()) + modelNode = selectionContext.currentSingleSelectedNode(); + QTC_ASSERT(modelNode.isValid(), return); BindingProperty prop = modelNode.bindingProperty("materials"); diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dcanvas.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dcanvas.cpp index 02d798c1f6b..98c052dc188 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dcanvas.cpp +++ b/src/plugins/qmldesigner/components/edit3d/edit3dcanvas.cpp @@ -102,6 +102,9 @@ QWidget *Edit3DCanvas::busyIndicator() const void Edit3DCanvas::mousePressEvent(QMouseEvent *e) { + if (e->button() == Qt::RightButton && e->modifiers() == Qt::NoModifier) + m_parent->view()->startContextMenu(e->pos()); + m_parent->view()->sendInputEvent(e); QWidget::mousePressEvent(e); } diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp index f848b58b3f0..fb844b1c858 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp +++ b/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp @@ -239,14 +239,25 @@ void Edit3DView::customNotification(const AbstractView *view, const QString &ide resetPuppet(); } +/** + * @brief get model at position from puppet process + * + * Response from puppet process for the model at requested position + * + * @param modelNode 3D model picked at the requested position, invalid node if no model exists + */ void Edit3DView::modelAtPosReady(const ModelNode &modelNode) { - if (!m_droppedMaterial.isValid() || !modelNode.isValid()) - return; - - executeInTransaction(__FUNCTION__, [&] { - assignMaterialTo3dModel(modelNode, m_droppedMaterial); - }); + if (m_modelAtPosReqType == ModelAtPosReqType::ContextMenu) { + m_edit3DWidget->showContextMenu(m_contextMenuPos, modelNode); + } else if (m_modelAtPosReqType == ModelAtPosReqType::MaterialDrop) { + if (m_droppedMaterial.isValid() && modelNode.isValid()) { + executeInTransaction(__FUNCTION__, [&] { + assignMaterialTo3dModel(modelNode, m_droppedMaterial); + }); + } + } + m_modelAtPosReqType = ModelAtPosReqType::None; } void Edit3DView::sendInputEvent(QInputEvent *e) const @@ -631,8 +642,17 @@ void Edit3DView::addQuick3DImport() tr("Could not add QtQuick3D import to project.")); } +// This method is called upon right-clicking the view to prepare for context-menu creation. The actual +// context menu is created when modelAtPosReady() is received from puppet +void Edit3DView::startContextMenu(const QPoint &pos) +{ + m_contextMenuPos = pos; + m_modelAtPosReqType = ModelAtPosReqType::ContextMenu; +} + void Edit3DView::dropMaterial(const ModelNode &matNode, const QPointF &pos) { + m_modelAtPosReqType = ModelAtPosReqType::MaterialDrop; m_droppedMaterial = matNode; QmlDesignerPlugin::instance()->viewManager().nodeInstanceView()->view3DAction({View3DActionCommand::GetModelAtPos, pos}); } diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dview.h b/src/plugins/qmldesigner/components/edit3d/edit3dview.h index 8b242058efb..0d3e9ff16fd 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dview.h +++ b/src/plugins/qmldesigner/components/edit3d/edit3dview.h @@ -79,9 +79,16 @@ public: void setSeeker(SeekerSlider *slider); void addQuick3DImport(); + void startContextMenu(const QPoint &pos); void dropMaterial(const ModelNode &matNode, const QPointF &pos); private: + enum class ModelAtPosReqType { + MaterialDrop, + ContextMenu, + None + }; + void createEdit3DWidget(); void checkImports(); @@ -120,6 +127,8 @@ private: int particlemode; ModelCache m_canvasCache; ModelNode m_droppedMaterial; + ModelAtPosReqType m_modelAtPosReqType; + QPoint m_contextMenuPos; }; } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp index a6672b9f164..8643bc091b1 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp +++ b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp @@ -30,6 +30,7 @@ #include "edit3dwidget.h" #include "edit3dvisibilitytogglesmenu.h" #include "metainfo.h" +#include "modelnodeoperations.h" #include "qmldesignerconstants.h" #include "qmldesignerplugin.h" #include "qmlvisualnode.h" @@ -49,8 +50,8 @@ namespace QmlDesigner { -Edit3DWidget::Edit3DWidget(Edit3DView *view) : - m_view(view) +Edit3DWidget::Edit3DWidget(Edit3DView *view) + : m_view(view) { setAcceptDrops(true); @@ -146,6 +147,8 @@ Edit3DWidget::Edit3DWidget(Edit3DView *view) : handleActions(view->backgroundColorActions(), m_backgroundColorMenu, false); + createContextMenu(); + view->setSeeker(seeker); seeker->setToolTip(QLatin1String("Seek particle system time when paused.")); @@ -173,6 +176,18 @@ Edit3DWidget::Edit3DWidget(Edit3DView *view) : showCanvas(false); } +void Edit3DWidget::createContextMenu() +{ + m_contextMenu = new QMenu(this); + m_editMaterialAction = m_contextMenu->addAction(tr("Edit Material"), [&] { + SelectionContext selCtx(m_view); + selCtx.setTargetNode(m_contextMenuTarget); + ModelNodeOperations::editMaterial(selCtx); + }); + + // TODO: add more actions: delete, create, etc +} + void Edit3DWidget::contextHelp(const Core::IContext::HelpCallback &callback) const { if (m_view) @@ -221,6 +236,15 @@ void Edit3DWidget::showBackgroundColorMenu(bool show, const QPoint &pos) m_backgroundColorMenu->close(); } +void Edit3DWidget::showContextMenu(const QPoint &pos, const ModelNode &modelNode) +{ + m_contextMenuTarget = modelNode; + + m_editMaterialAction->setEnabled(modelNode.isValid()); + + m_contextMenu->popup(mapToGlobal(pos)); +} + void Edit3DWidget::linkActivated(const QString &link) { Q_UNUSED(link) diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.h b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.h index 7d40fd54715..6b3e773fdc4 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.h +++ b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.h @@ -24,11 +24,13 @@ ****************************************************************************/ #pragma once -#include -#include -#include -#include +#include +#include +#include +#include + #include +#include namespace QmlDesigner { @@ -54,12 +56,15 @@ public: QMenu *backgroundColorMenu() const; void showBackgroundColorMenu(bool show, const QPoint &pos); + void showContextMenu(const QPoint &pos, const ModelNode &modelNode); + protected: void dragEnterEvent(QDragEnterEvent *dragEnterEvent) override; void dropEvent(QDropEvent *dropEvent) override; private: void linkActivated(const QString &link); + void createContextMenu(); QPointer m_edit3DView; QPointer m_view; @@ -69,6 +74,9 @@ private: Core::IContext *m_context = nullptr; QPointer m_visibilityTogglesMenu; QPointer m_backgroundColorMenu; + QPointer m_contextMenu; + QPointer m_editMaterialAction; + ModelNode m_contextMenuTarget; }; } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp index 1a703463ccf..d723a217924 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp @@ -1707,8 +1707,7 @@ void NodeInstanceView::handlePuppetToCreatorCommand(const PuppetToCreatorCommand emitImport3DSupportChanged(supportMap); } else if (command.type() == PuppetToCreatorCommand::ModelAtPos) { ModelNode modelNode = modelNodeForInternalId(command.data().toUInt()); - if (modelNode.isValid()) - emitModelAtPosResult(modelNode); + emitModelAtPosResult(modelNode); } } From 395e0560d4d4e2c9ab1c01bc39d5bcd3dc7c39a1 Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Sat, 20 Aug 2022 13:27:22 +0300 Subject: [PATCH 08/35] Update qbs submodule to HEAD of 1.23 branch Change-Id: I053b24ae7b03226de7bf1ffaf9d5424f123c620e Reviewed-by: Reviewed-by: Qt CI Bot Reviewed-by: Christian Kandeler --- src/shared/qbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/qbs b/src/shared/qbs index 3e0553e4651..09ff740b4e0 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit 3e0553e4651197e61c5086d96048b75462bde897 +Subproject commit 09ff740b4e0520374e84415cfc97561809152270 From aea64ca1fa3af08a39ef748b2ae91a7d4590141e Mon Sep 17 00:00:00 2001 From: Knud Dollereder Date: Thu, 4 Aug 2022 15:59:45 +0200 Subject: [PATCH 09/35] Add zoom slider to the curve editors toolbar Removed the "Set Default" button from the toolbar since it does the same as the "linear interpolation" button and space is rare in the toolbar. Fixes: QDS-6951 Change-Id: Ifdbf20af2e5365e9bf9b592783b872394cabb7eb Reviewed-by: Reviewed-by: Aleksei German --- .../components/curveeditor/curveeditor.cpp | 16 ++++++++++---- .../curveeditor/curveeditortoolbar.cpp | 21 ++++++++++++++----- .../curveeditor/curveeditortoolbar.h | 8 +++++-- .../curveeditor/detail/curveitem.cpp | 12 ----------- .../components/curveeditor/detail/curveitem.h | 2 -- .../curveeditor/detail/graphicsview.cpp | 17 ++++----------- .../curveeditor/detail/graphicsview.h | 4 ++-- .../curveeditor/detail/keyframeitem.cpp | 12 ----------- .../curveeditor/detail/keyframeitem.h | 2 -- .../components/curveeditor/keyframe.cpp | 9 -------- .../components/curveeditor/keyframe.h | 2 -- 11 files changed, 40 insertions(+), 65 deletions(-) diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditor.cpp b/src/plugins/qmldesigner/components/curveeditor/curveeditor.cpp index 29e88e2581d..18d838d2ff1 100644 --- a/src/plugins/qmldesigner/components/curveeditor/curveeditor.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditor.cpp @@ -71,10 +71,6 @@ CurveEditor::CurveEditor(CurveEditorModel *model, QWidget *parent) box->addWidget(m_statusLine); setLayout(box); - connect(m_toolbar, &CurveEditorToolBar::defaultClicked, [this]() { - m_view->setDefaultInterpolation(); - }); - connect(m_toolbar, &CurveEditorToolBar::unifyClicked, [this]() { m_view->toggleUnified(); }); @@ -99,6 +95,13 @@ CurveEditor::CurveEditor(CurveEditorModel *model, QWidget *parent) m_view->viewport()->update(); }); + connect(m_toolbar, &CurveEditorToolBar::zoomChanged, [this](double zoom) { + const bool wasBlocked = m_view->blockSignals(true); + m_view->setZoomX(zoom); + m_view->blockSignals(wasBlocked); + m_view->viewport()->update(); + }); + connect( m_view, &GraphicsView::currentFrameChanged, m_toolbar, &CurveEditorToolBar::setCurrentFrame); @@ -110,6 +113,11 @@ CurveEditor::CurveEditor(CurveEditorModel *model, QWidget *parent) m_tree->selectionModel(), &SelectionModel::curvesSelected, m_view, &GraphicsView::updateSelection); + connect(m_view, &GraphicsView::zoomChanged, [this](double x, double y) { + Q_UNUSED(y); + m_toolbar->setZoom(x); + }); + auto updateTimeline = [this, model](bool validTimeline) { if (validTimeline) { updateStatusLine(); diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditortoolbar.cpp b/src/plugins/qmldesigner/components/curveeditor/curveeditortoolbar.cpp index b7bbf370511..bf6fe06e47f 100644 --- a/src/plugins/qmldesigner/components/curveeditor/curveeditortoolbar.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditortoolbar.cpp @@ -67,7 +67,6 @@ CurveEditorToolBar::CurveEditorToolBar(CurveEditorModel *model, QWidget* parent) QAction *tangentSplineAction = addAction( QIcon(":/curveeditor/images/tangetToolsSplineIcon.png"), "Spline"); - QAction *tangentDefaultAction = addAction(tr("Set Default")); QAction *tangentUnifyAction = addAction(tr("Unify")); auto setLinearInterpolation = [this]() { @@ -79,9 +78,6 @@ CurveEditorToolBar::CurveEditorToolBar(CurveEditorModel *model, QWidget* parent) auto setSplineInterpolation = [this]() { emit interpolationClicked(Keyframe::Interpolation::Bezier); }; - auto setDefaultKeyframe = [this]() { - emit defaultClicked(); - }; auto toggleUnifyKeyframe = [this]() { emit unifyClicked(); }; @@ -89,7 +85,6 @@ CurveEditorToolBar::CurveEditorToolBar(CurveEditorModel *model, QWidget* parent) connect(tangentLinearAction, &QAction::triggered, setLinearInterpolation); connect(tangentStepAction, &QAction::triggered, setStepInterpolation); connect(tangentSplineAction, &QAction::triggered, setSplineInterpolation); - connect(tangentDefaultAction, &QAction::triggered, setDefaultKeyframe); connect(tangentUnifyAction, &QAction::triggered, toggleUnifyKeyframe); auto validateStart = [this](int val) -> bool { @@ -100,6 +95,7 @@ CurveEditorToolBar::CurveEditorToolBar(CurveEditorModel *model, QWidget* parent) m_startSpin = new ValidatableSpinBox(validateStart); m_startSpin->setRange(std::numeric_limits::lowest(), std::numeric_limits::max()); m_startSpin->setValue(model->minimumTime()); + m_startSpin->setFixedWidth(70); connect( m_startSpin, QOverload::of(&QSpinBox::valueChanged), @@ -117,6 +113,7 @@ CurveEditorToolBar::CurveEditorToolBar(CurveEditorModel *model, QWidget* parent) m_endSpin = new ValidatableSpinBox(validateEnd); m_endSpin->setRange(std::numeric_limits::lowest(), std::numeric_limits::max()); m_endSpin->setValue(model->maximumTime()); + m_endSpin->setFixedWidth(70); connect( m_endSpin, QOverload::of(&QSpinBox::valueChanged), @@ -128,6 +125,7 @@ CurveEditorToolBar::CurveEditorToolBar(CurveEditorModel *model, QWidget* parent) m_currentSpin->setMinimum(0); m_currentSpin->setMaximum(std::numeric_limits::max()); + m_currentSpin->setFixedWidth(70); connect( m_currentSpin, QOverload::of(&QSpinBox::valueChanged), @@ -150,6 +148,19 @@ CurveEditorToolBar::CurveEditorToolBar(CurveEditorModel *model, QWidget* parent) auto *positionWidget = new QWidget; positionWidget->setLayout(positionBox); addWidget(positionWidget); + + m_zoomSlider = new QSlider(Qt::Horizontal); + m_zoomSlider->setRange(0, 100); + connect(m_zoomSlider, &QSlider::valueChanged, [this](int value) { + emit zoomChanged(static_cast(value)/100.0f); + }); + addWidget(m_zoomSlider); +} + +void CurveEditorToolBar::setZoom(double zoom) +{ + QSignalBlocker blocker(m_zoomSlider); + m_zoomSlider->setValue( static_cast(zoom*100)); } void CurveEditorToolBar::setCurrentFrame(int current, bool notify) diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditortoolbar.h b/src/plugins/qmldesigner/components/curveeditor/curveeditortoolbar.h index 25271245c6e..7d3c02adb33 100644 --- a/src/plugins/qmldesigner/components/curveeditor/curveeditortoolbar.h +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditortoolbar.h @@ -26,6 +26,7 @@ #pragma once #include +#include #include #include #include @@ -53,8 +54,6 @@ class CurveEditorToolBar : public QToolBar Q_OBJECT signals: - void defaultClicked(); - void unifyClicked(); void interpolationClicked(Keyframe::Interpolation interpol); @@ -65,9 +64,13 @@ signals: void currentFrameChanged(int current); + void zoomChanged(double zoom); + public: CurveEditorToolBar(CurveEditorModel *model, QWidget* parent = nullptr); + void setZoom(double zoom); + void setCurrentFrame(int current, bool notify); void updateBoundsSilent(int start, int end); @@ -76,6 +79,7 @@ private: ValidatableSpinBox *m_startSpin; ValidatableSpinBox *m_endSpin; QSpinBox *m_currentSpin; + QSlider *m_zoomSlider; }; } // End namespace QmlDesigner. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp index 5b053099763..e6c99e70859 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp @@ -458,18 +458,6 @@ void CurveItem::setInterpolation(Keyframe::Interpolation interpolation) emit curveChanged(id(), curve(true)); } -void CurveItem::setDefaultInterpolation() -{ - if (m_keyframes.empty()) - return; - - for (auto *frame : qAsConst(m_keyframes)) { - if (frame->selected()) - frame->setDefaultInterpolation(); - } - emit curveChanged(id(), curve(true)); -} - void CurveItem::toggleUnified() { if (m_keyframes.empty()) diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.h b/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.h index c6bdc6d3d4c..0f0d5d53414 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.h +++ b/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.h @@ -125,8 +125,6 @@ public: void setInterpolation(Keyframe::Interpolation interpolation); - void setDefaultInterpolation(); - void toggleUnified(); void connect(GraphicsScene *scene); diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.cpp index 8ab71ace978..d01ffa47c71 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.cpp @@ -336,18 +336,6 @@ void GraphicsView::setInterpolation(Keyframe::Interpolation interpol) viewport()->update(); } -void GraphicsView::setDefaultInterpolation() -{ - const auto selectedCurves = m_scene->selectedCurves(); - for (auto *curve : selectedCurves) - curve->setDefaultInterpolation(); - - m_scene->setDirty(true); - - applyZoom(m_zoomX, m_zoomY); - viewport()->update(); -} - void GraphicsView::toggleUnified() { const auto selectedCurves = m_scene->selectedCurves(); @@ -569,7 +557,10 @@ void GraphicsView::applyZoom(double x, double y, const QPoint &pivot) } m_scene->doNotMoveItems(false); - this->update(); + + viewport()->update(); + + emit zoomChanged(m_zoomX, m_zoomY); } void GraphicsView::drawGrid(QPainter *painter) diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.h b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.h index 917a8e7e2c4..27b27a4a366 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.h +++ b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.h @@ -49,6 +49,8 @@ class GraphicsView : public QGraphicsView signals: void currentFrameChanged(int frame, bool notify); + void zoomChanged(double x, double y); + public: GraphicsView(CurveEditorModel *model, QWidget *parent = nullptr); @@ -112,8 +114,6 @@ public: void setInterpolation(Keyframe::Interpolation interpol); - void setDefaultInterpolation(); - void toggleUnified(); protected: diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.cpp index 0dbb2d125f0..171665cf2f6 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.cpp @@ -250,18 +250,6 @@ void KeyframeItem::setKeyframe(const Keyframe &keyframe) setPos(m_transform.map(m_frame.position())); } -void KeyframeItem::setDefaultInterpolation() -{ - if (!m_left || !m_right) - return; - - m_frame.setDefaultInterpolation(); - - setKeyframe(m_frame); - - emit redrawCurve(); -} - void KeyframeItem::toggleUnified() { if (!m_left || !m_right) diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.h b/src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.h index c7bfa02cd18..7d04bab2099 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.h +++ b/src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.h @@ -92,8 +92,6 @@ public: void setKeyframe(const Keyframe &keyframe); - void setDefaultInterpolation(); - void toggleUnified(); void setActivated(bool active, HandleItem::Slot slot); diff --git a/src/plugins/qmldesigner/components/curveeditor/keyframe.cpp b/src/plugins/qmldesigner/components/curveeditor/keyframe.cpp index 085c230335c..0b97764f9e8 100644 --- a/src/plugins/qmldesigner/components/curveeditor/keyframe.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/keyframe.cpp @@ -154,15 +154,6 @@ void Keyframe::setPosition(const QPointF &pos) m_position = pos; } -void Keyframe::setDefaultInterpolation() -{ - auto leftToRight = QLineF(m_leftHandle, m_rightHandle); - leftToRight.translate(m_position - leftToRight.center()); - - m_leftHandle = leftToRight.p1(); - m_rightHandle = leftToRight.p2(); -} - void Keyframe::setUnified(bool unified) { m_unified = unified; diff --git a/src/plugins/qmldesigner/components/curveeditor/keyframe.h b/src/plugins/qmldesigner/components/curveeditor/keyframe.h index 2757d229f58..13656859ece 100644 --- a/src/plugins/qmldesigner/components/curveeditor/keyframe.h +++ b/src/plugins/qmldesigner/components/curveeditor/keyframe.h @@ -68,8 +68,6 @@ public: Interpolation interpolation() const; - void setDefaultInterpolation(); - void setUnified(bool unified); void setPosition(const QPointF &pos); From 95a278760a6613398af2a0adba9e7a3cde7bbebf Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 3 Aug 2022 09:25:58 +0200 Subject: [PATCH 10/35] Doc: update remote CDB setup instructions Mention the dependencies of the cdbextension and instruct to copy the full folder instead of just the dll. Fixes: QTCREATORBUG-27914 Change-Id: If14d331af66437bc8723fc16fc72354cccd4e0d6 Reviewed-by: Leena Miettinen --- .../src/debugger/creator-only/creator-debugger.qdoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/qtcreator/src/debugger/creator-only/creator-debugger.qdoc b/doc/qtcreator/src/debugger/creator-only/creator-debugger.qdoc index 12495c11d25..59f944df96a 100644 --- a/doc/qtcreator/src/debugger/creator-only/creator-debugger.qdoc +++ b/doc/qtcreator/src/debugger/creator-only/creator-debugger.qdoc @@ -456,16 +456,16 @@ The installation folder contains the CDB command line executable (\c cdb.exe). - \li Copy the \QC CDB extension library from the Qt installation - directory to the a new folder on the remote machine (32 or 64 bit + \li Copy the \QC CDB extension library and the dependencies from the Qt installation + directory to a new folder on the remote machine (32 or 64 bit version depending on the version of the Debugging Tools for Windows used): \list - \li \c {\lib\qtcreatorcdbext32\qtcreatorcdbext.dll} (32 bit) + \li \c {\lib\qtcreatorcdbext32} (32 bit) - \li \c {\lib\qtcreatorcdbext64\qtcreatorcdbext.dll} (64 bit) + \li \c {\lib\qtcreatorcdbext64} (64 bit) \endlist From 635865dac474f195def542d315c23625187fd61c Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 23 Aug 2022 08:06:38 +0200 Subject: [PATCH 11/35] QmlDesigner: Fix compile Change-Id: Iab57aa9b78c73773ccdb66490ff2536b2a5465fd Reviewed-by: David Schulz --- src/plugins/qmldesigner/designercore/include/modelnode.h | 2 +- src/plugins/qmldesigner/designercore/model/modelnode.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/include/modelnode.h b/src/plugins/qmldesigner/designercore/include/modelnode.h index 003c732c80c..def083f02f6 100644 --- a/src/plugins/qmldesigner/designercore/include/modelnode.h +++ b/src/plugins/qmldesigner/designercore/include/modelnode.h @@ -25,6 +25,7 @@ #pragma once +#include "abstractproperty.h" #include "qmldesignercorelib_global.h" #include #include @@ -47,7 +48,6 @@ namespace Internal { using InternalPropertyPointer = QSharedPointer; } class NodeMetaInfo; -class AbstractProperty; class BindingProperty; class VariantProperty; class SignalHandlerProperty; diff --git a/src/plugins/qmldesigner/designercore/model/modelnode.cpp b/src/plugins/qmldesigner/designercore/model/modelnode.cpp index b61aa9ecd63..913c67b1a24 100644 --- a/src/plugins/qmldesigner/designercore/model/modelnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelnode.cpp @@ -24,7 +24,6 @@ ****************************************************************************/ #include "modelnode.h" -#include #include #include #include "internalnode_p.h" From cd87abf3fa8388642dfa8301d8098c5b66ddef00 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Mon, 22 Aug 2022 15:17:38 +0200 Subject: [PATCH 12/35] Doc: Add commas and fix style issues Change-Id: I10d1e11c5981704b5ae5e7690f3df036af9873b3 Reviewed-by: hjk --- .../creator-only/creator-language-server.qdoc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/qtcreator/src/editors/creator-only/creator-language-server.qdoc b/doc/qtcreator/src/editors/creator-only/creator-language-server.qdoc index 80ee71d960f..58633cdcfc1 100644 --- a/doc/qtcreator/src/editors/creator-only/creator-language-server.qdoc +++ b/doc/qtcreator/src/editors/creator-only/creator-language-server.qdoc @@ -165,15 +165,16 @@ To disable the Python language server, deselect \uicontrol {Use Python Language Server}. - \section2 Qml Language Server + \section2 QML Language Server - Qt 6.4 ships with the qmlls language server that provides completions and warnings for QML. - It can be set up as a \l {Generic StdIO Language Server}, selecting \c {text/x-qml} and - \c {application/x-qt.ui+qml} as MIME Types, and \c {/bin/qmlls} as executable. + Qt 6.4 ships with the \c qmlls language server that provides completion and + warnings for QML. To set it up as a \l {Generic StdIO Language Server}, + select \c {text/x-qml} and \c {application/x-qt.ui+qml} as MIME types, and + \c {/bin/qmlls} as executable. - If the language server is used together with the QmlJSEditor plugin duplicate suggestions and - warnings might be shown. To avoid this you might want to disable it as described in - \l {Enabling and Disabling Plugins}. + If the language server is used together with the \c QmlJSEditor plugin, + duplicate suggestions and warnings might be shown. To avoid this, disable + the editor plugin as described in \l {Enabling and Disabling Plugins}. \section1 Supported Locator Filters From bddac59a95bd9ca1333ac29a6e6b62d8bac66827 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Tue, 23 Aug 2022 09:02:29 +0200 Subject: [PATCH 13/35] Doc: Fix arguments to start debugging Qt Quick applications A dash was missing. Fixes: QTCREATORBUG-28093 Change-Id: Ic7fbf8fda8d23fdc1eabf98b53240824a24aacc5 Reviewed-by: hjk --- doc/qtcreator/src/debugger/qtquick-debugging.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/qtcreator/src/debugger/qtquick-debugging.qdoc b/doc/qtcreator/src/debugger/qtquick-debugging.qdoc index 0934b94e3d7..2df38e2869e 100644 --- a/doc/qtcreator/src/debugger/qtquick-debugging.qdoc +++ b/doc/qtcreator/src/debugger/qtquick-debugging.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2021 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Creator documentation. @@ -154,7 +154,7 @@ \li Start the application with the following arguments: - \c {qmljsdebugger=port:[,host:][,block]} + \c {-qmljsdebugger=port:[,host:][,block]} Where \c port (mandatory) specifies the debugging port, \c {ip address} (optional) specifies the IP address of the host From f4c6bf0179d4a29f869612d99de9e993019c854b Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 22 Aug 2022 17:10:00 +0200 Subject: [PATCH 14/35] QmlDesigner: Move QmlVisualNode::states to QmlObjectNode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is required for StateGroup support. Change-Id: I25d8f94c2a0fa9140ce8af3032bc92a7b858b9d8 Reviewed-by: Qt CI Bot Reviewed-by: Henning Gründl --- .../qmldesigner/designercore/include/qmlobjectnode.h | 2 ++ .../qmldesigner/designercore/include/qmlvisualnode.h | 3 +-- .../qmldesigner/designercore/model/qmlobjectnode.cpp | 7 +++++++ .../qmldesigner/designercore/model/qmlvisualnode.cpp | 8 -------- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h b/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h index 7b1cfbe86e1..3b83420325d 100644 --- a/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h +++ b/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h @@ -131,6 +131,8 @@ public: QList allDefinedStates() const; QList allInvalidStateOperations() const; + QmlModelStateGroup states() const; + protected: NodeInstance nodeInstance() const; QmlObjectNode nodeForInstance(const NodeInstance &instance) const; diff --git a/src/plugins/qmldesigner/designercore/include/qmlvisualnode.h b/src/plugins/qmldesigner/designercore/include/qmlvisualnode.h index af209245479..da925e4f110 100644 --- a/src/plugins/qmldesigner/designercore/include/qmlvisualnode.h +++ b/src/plugins/qmldesigner/designercore/include/qmlvisualnode.h @@ -71,7 +71,6 @@ public: static bool isValidQmlVisualNode(const ModelNode &modelNode); bool isRootNode() const; - QmlModelStateGroup states() const; QList children() const; QList resources() const; QList allDirectSubNodes() const; @@ -121,7 +120,7 @@ private: class QMLDESIGNERCORE_EXPORT QmlModelStateGroup { - friend class QmlVisualNode; + friend class QmlObjectNode; friend class StatesEditorView; public: diff --git a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp index 5e137b06b87..a7a88245d13 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp @@ -582,6 +582,13 @@ QList QmlObjectNode::allInvalidStateOperations() const return result; } +QmlModelStateGroup QmlObjectNode::states() const +{ + if (isValid()) + return QmlModelStateGroup(modelNode()); + else + return QmlModelStateGroup(); +} /*! Removes a variant property of the object specified by \a name from the diff --git a/src/plugins/qmldesigner/designercore/model/qmlvisualnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlvisualnode.cpp index cc7ab776152..04fee0327c3 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlvisualnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlvisualnode.cpp @@ -191,14 +191,6 @@ void QmlVisualNode::initializePosition(const QmlVisualNode::Position &position) } } -QmlModelStateGroup QmlVisualNode::states() const -{ - if (isValid()) - return QmlModelStateGroup(modelNode()); - else - return QmlModelStateGroup(); -} - QmlObjectNode QmlVisualNode::createQmlObjectNode(AbstractView *view, const ItemLibraryEntry &itemLibraryEntry, const Position &position, From 179713ed5cfd2a1b5f9cee0ba865789e4b6fb2d7 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 22 Aug 2022 17:11:08 +0200 Subject: [PATCH 15/35] QmlDesigner: Use QmlObjectNode instead of QmlVisualNode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit StateGroups are no visual items. Change-Id: Ia081c303aea6c79c750b44388a81f4b10cc1837d Reviewed-by: Qt CI Bot Reviewed-by: Henning Gründl --- src/plugins/qmldesigner/designercore/model/qmlstate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/designercore/model/qmlstate.cpp b/src/plugins/qmldesigner/designercore/model/qmlstate.cpp index f08d36d8503..da69695fefa 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlstate.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlstate.cpp @@ -298,7 +298,7 @@ QmlModelState QmlModelState::duplicate(const QString &name) const QmlModelStateGroup QmlModelState::stateGroup() const { - QmlVisualNode parentNode(modelNode().parentProperty().parentModelNode()); + QmlObjectNode parentNode(modelNode().parentProperty().parentModelNode()); return parentNode.states(); } From 3682ff76d295f037cb28ee6d1b401b3dc43919a8 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 22 Aug 2022 17:11:48 +0200 Subject: [PATCH 16/35] QmlDesigner: Do not require visual node for states MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit StateGroup is no visual node. Change-Id: Ia0ff297efe2b73f42eb24e193d8e832250d77237 Reviewed-by: Qt CI Bot Reviewed-by: Henning Gründl --- src/plugins/qmldesigner/designercore/model/qmlstate.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/model/qmlstate.cpp b/src/plugins/qmldesigner/designercore/model/qmlstate.cpp index da69695fefa..5a210fc13a7 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlstate.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlstate.cpp @@ -274,9 +274,6 @@ QmlModelState QmlModelState::duplicate(const QString &name) const if (!isValid()) throw new InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); - if (!QmlVisualNode::isValidQmlVisualNode(modelNode().parentProperty().parentModelNode())) - throw new InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); - // QmlModelState newState(stateGroup().addState(name)); QmlModelState newState(createQmlState(view(), {{PropertyName("name"), QVariant(name)}})); const QList nodes = modelNode().nodeListProperty("changes").toModelNodeList(); From 1fa2af4c87e010dd537850c47cd2ad9507574906 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 22 Aug 2022 17:12:27 +0200 Subject: [PATCH 17/35] QmlDesigner: use stateGroup() instead of hard coding the root node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I502c51f252fb8584c36a2bbd31faa7a130d19f5e Reviewed-by: Qt CI Bot Reviewed-by: Reviewed-by: Henning Gründl --- src/plugins/qmldesigner/designercore/model/qmlstate.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/model/qmlstate.cpp b/src/plugins/qmldesigner/designercore/model/qmlstate.cpp index 5a210fc13a7..a4ce30278e2 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlstate.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlstate.cpp @@ -316,15 +316,15 @@ ModelNode QmlModelState::createQmlState(AbstractView *view, const PropertyListTy void QmlModelState::setAsDefault() { if ((!isBaseState()) && (modelNode().isValid())) { - view()->rootModelNode().variantProperty("state").setValue(name()); + stateGroup().modelNode().variantProperty("state").setValue(name()); } } bool QmlModelState::isDefault() const { if ((!isBaseState()) && (modelNode().isValid())) { - if (view()->rootModelNode().hasProperty("state")) { - return (view()->rootModelNode().variantProperty("state").value() == name()); + if (stateGroup().modelNode().hasProperty("state")) { + return (stateGroup().modelNode().variantProperty("state").value() == name()); } } From 4bfdf9fc46c490d955bd2c4ea8ad1f2715824e23 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 22 Aug 2022 17:13:30 +0200 Subject: [PATCH 18/35] QmlDesigner: Do not assume that the active state group is the root node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ifd315a7e1d8c833f612e305127911634174a8e5b Reviewed-by: Qt CI Bot Reviewed-by: Reviewed-by: Henning Gründl --- .../stateseditor/stateseditorview.cpp | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp index eefde504948..b5e897ae2df 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp @@ -207,7 +207,8 @@ void StatesEditorView::createNewState() void StatesEditorView::addState() { // can happen when root node is e.g. a ListModel - if (!QmlVisualNode::isValidQmlVisualNode(acitveStatesGroupNode())) + if (!QmlVisualNode::isValidQmlVisualNode(acitveStatesGroupNode()) + && m_activeStatesGroupNode.type() != "QtQuick.StateGroup") return; QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_STATE_ADDED); @@ -508,7 +509,7 @@ void StatesEditorView::modelAboutToBeDetached(Model *model) void StatesEditorView::propertiesRemoved(const QList& propertyList) { for (const AbstractProperty &property : propertyList) { - if (property.name() == "states" && property.parentModelNode().isRootNode()) + if (property.name() == "states" && property.parentModelNode() == activeStateGroup().modelNode()) resetModel(); if (property.name() == "when" && QmlModelState::isValidQmlModelState(property.parentModelNode())) resetModel(); @@ -519,7 +520,7 @@ void StatesEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode) { if (removedNode.hasParentProperty()) { const NodeAbstractProperty propertyParent = removedNode.parentProperty(); - if (propertyParent.parentModelNode().isRootNode() && propertyParent.name() == "states") + if (propertyParent.parentModelNode() == activeStateGroup().modelNode() && propertyParent.name() == "states") m_lastIndex = propertyParent.indexOf(removedNode); } if (currentState().isValid() && removedNode == currentState()) @@ -528,7 +529,7 @@ void StatesEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode) void StatesEditorView::nodeRemoved(const ModelNode & /*removedNode*/, const NodeAbstractProperty &parentProperty, PropertyChangeFlags /*propertyChange*/) { - if (parentProperty.isValid() && parentProperty.parentModelNode().isRootNode() && parentProperty.name() == "states") { + if (parentProperty.isValid() && parentProperty.parentModelNode() == activeStateGroup().modelNode() && parentProperty.name() == "states") { m_statesEditorModel->removeState(m_lastIndex); m_lastIndex = -1; } @@ -536,19 +537,25 @@ void StatesEditorView::nodeRemoved(const ModelNode & /*removedNode*/, const Node void StatesEditorView::nodeAboutToBeReparented(const ModelNode &node, const NodeAbstractProperty &/*newPropertyParent*/, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags /*propertyChange*/) { - if (oldPropertyParent.isValid() && oldPropertyParent.parentModelNode().isRootNode() && oldPropertyParent.name() == "states") + if (oldPropertyParent.isValid() + && oldPropertyParent.parentModelNode() == activeStateGroup().modelNode() + && oldPropertyParent.name() == "states") m_lastIndex = oldPropertyParent.indexOf(node); } void StatesEditorView::nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags /*propertyChange*/) { - if (oldPropertyParent.isValid() && oldPropertyParent.parentModelNode().isRootNode() && oldPropertyParent.name() == "states") + if (oldPropertyParent.isValid() + && oldPropertyParent.parentModelNode() == activeStateGroup().modelNode() + && oldPropertyParent.name() == "states") m_statesEditorModel->removeState(m_lastIndex); m_lastIndex = -1; - if (newPropertyParent.isValid() && newPropertyParent.parentModelNode().isRootNode() && newPropertyParent.name() == "states") { + if (newPropertyParent.isValid() + && newPropertyParent.parentModelNode() == activeStateGroup().modelNode() + && newPropertyParent.name() == "states") { int index = newPropertyParent.indexOf(node); m_statesEditorModel->insertState(index); } @@ -556,7 +563,8 @@ void StatesEditorView::nodeReparented(const ModelNode &node, const NodeAbstractP void StatesEditorView::nodeOrderChanged(const NodeListProperty &listProperty) { - if (listProperty.isValid() && listProperty.parentModelNode().isRootNode() && listProperty.name() == "states") + if (listProperty.isValid() && listProperty.parentModelNode() == activeStateGroup().modelNode() + && listProperty.name() == "states") resetModel(); } @@ -582,7 +590,8 @@ void StatesEditorView::variantPropertiesChanged(const QList &pr for (const VariantProperty &property : propertyList) { if (property.name() == "name" && QmlModelState::isValidQmlModelState(property.parentModelNode())) resetModel(); - else if (property.name() == "state" && property.parentModelNode().isRootNode()) + else if (property.name() == "state" + && property.parentModelNode() == activeStateGroup().modelNode()) resetModel(); } } From 6a3933c87aad49c17c3dfb35edda0018863998ca Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 23 Aug 2022 12:25:55 +0200 Subject: [PATCH 19/35] StudioWelcome: Fix QTC_ASSERT Deleting QtcProcess instance directly from one of its signal handlers will lead to crash! I cannot confirm this crash actually happened, but we should play save and delete the archive from the event loop. Change-Id: Ie27291c9ac8b300478ed8396d25a76b343f238be Reviewed-by: Tim Jenssen --- src/plugins/studiowelcome/examplecheckout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/studiowelcome/examplecheckout.cpp b/src/plugins/studiowelcome/examplecheckout.cpp index 9131009f563..3263995af89 100644 --- a/src/plugins/studiowelcome/examplecheckout.cpp +++ b/src/plugins/studiowelcome/examplecheckout.cpp @@ -424,7 +424,7 @@ void FileExtractor::extract() }); QObject::connect(archive, &Utils::Archive::finished, this, [this, archive](bool ret) { - delete archive; + archive->deleteLater(); m_finished = ret; m_timer.stop(); From 9102452272767f652f4db9862b5b64c96887a1a0 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Mon, 22 Aug 2022 15:46:21 +0200 Subject: [PATCH 20/35] clangd: Use QtC system environment for environment variables Users would set QTC_CLANGD_COMPLETION_RESULTS in the Qt Creator system environment variable dialog and expect that clangd would the be configured with the corresponding --limit-results value. Task-number: QTCREATORBUG-28071 Change-Id: Ia7a9b6a96fabe7ba16906c547a15716f0b83f0ec Reviewed-by: Christian Kandeler Reviewed-by: Eike Ziller --- src/plugins/clangcodemodel/clangdclient.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp index 9e828900a7c..228126ef215 100644 --- a/src/plugins/clangcodemodel/clangdclient.cpp +++ b/src/plugins/clangcodemodel/clangdclient.cpp @@ -82,6 +82,7 @@ #include #include #include +#include #include #include #include @@ -275,7 +276,8 @@ static BaseClientInterface *clientInterface(Project *project, const Utils::FileP + (settings.autoIncludeHeaders() ? "iwyu" : "never"); bool ok = false; - const int userValue = qEnvironmentVariableIntValue("QTC_CLANGD_COMPLETION_RESULTS", &ok); + const int userValue + = Utils::Environment::systemEnvironment().value("QTC_CLANGD_COMPLETION_RESULTS").toInt(&ok); const QString limitResults = QString("--limit-results=%1").arg(ok ? userValue : 0); Utils::CommandLine cmd{settings.clangdFilePath(), {indexingOption, headerInsertionOption, From 275f2a3db8bbbde177512eeb3e06cd36217df8f1 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 23 Aug 2022 13:58:32 +0200 Subject: [PATCH 21/35] Tests: Do not use config mode when searching for Eigen3 Change-Id: I144481821267b80404473d821ac1048ff3adeac3 Reviewed-by: Cristian Adam --- tests/manual/debugger/simple/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/manual/debugger/simple/CMakeLists.txt b/tests/manual/debugger/simple/CMakeLists.txt index 9f5de0707ea..95e2169ae65 100644 --- a/tests/manual/debugger/simple/CMakeLists.txt +++ b/tests/manual/debugger/simple/CMakeLists.txt @@ -12,8 +12,8 @@ find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Gui Network Widgets) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Network Widgets) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Script Webkit WebkitWidgets QUIET) find_package(Boost QUIET) -find_package(Eigen2 NO_MODULE QUIET) -find_package(Eigen3 NO_MODULE QUIET) +find_package(Eigen2 QUIET) +find_package(Eigen3 QUIET) if (${QT_VERSION_MAJOR} LESS 6) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Xml) From 8310a2f0a9a4d15af589da948928181630d8f4bd Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Tue, 23 Aug 2022 16:27:14 +0200 Subject: [PATCH 22/35] qmljs: reduce used threads Change-Id: I8f27037d0cfefd65f1ac060e1505328ea705a670 Reviewed-by: Thomas Hartmann Reviewed-by: --- src/libs/qmljs/qmljsmodelmanagerinterface.cpp | 22 ++++++++++++++----- src/libs/qmljs/qmljsmodelmanagerinterface.h | 2 ++ src/libs/qmljs/qmljsplugindumper.cpp | 5 +++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp index 444d429a4bc..af0b9755420 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp @@ -111,6 +111,7 @@ ModelManagerInterface::ModelManagerInterface(QObject *parent) m_defaultImportPaths(environmentImportPaths()), m_pluginDumper(new PluginDumper(this)) { + m_threadPool.setMaxThreadCount(4); m_futureSynchronizer.setCancelOnWait(false); m_indexerDisabled = qEnvironmentVariableIsSet("QTC_NO_CODE_INDEXER"); @@ -326,6 +327,11 @@ Snapshot ModelManagerInterface::newestSnapshot() const return m_newestSnapshot; } +QThreadPool *ModelManagerInterface::threadPool() +{ + return &m_threadPool; +} + void ModelManagerInterface::updateSourceFiles(const QStringList &files, bool emitDocumentOnDiskChanged) { @@ -340,7 +346,8 @@ QFuture ModelManagerInterface::refreshSourceFiles(const QStringList &sourc if (sourceFiles.isEmpty()) return QFuture(); - QFuture result = Utils::runAsync(&ModelManagerInterface::parse, + QFuture result = Utils::runAsync(&m_threadPool, + &ModelManagerInterface::parse, workingCopyInternal(), sourceFiles, this, Dialect(Dialect::Qml), emitDocumentOnDiskChanged); @@ -368,9 +375,13 @@ QFuture ModelManagerInterface::refreshSourceFiles(const QStringList &sourc void ModelManagerInterface::fileChangedOnDisk(const QString &path) { - addFuture(Utils::runAsync(&ModelManagerInterface::parse, - workingCopyInternal(), QStringList(path), - this, Dialect(Dialect::AnyLanguage), true)); + addFuture(Utils::runAsync(&m_threadPool, + &ModelManagerInterface::parse, + workingCopyInternal(), + QStringList(path), + this, + Dialect(Dialect::AnyLanguage), + true)); } void ModelManagerInterface::removeFiles(const QStringList &files) @@ -1191,7 +1202,8 @@ void ModelManagerInterface::maybeScan(const PathsAndLanguages &importPaths) } if (pathToScan.length() >= 1) { - QFuture result = Utils::runAsync(&ModelManagerInterface::importScan, + QFuture result = Utils::runAsync(&m_threadPool, + &ModelManagerInterface::importScan, workingCopyInternal(), pathToScan, this, true, true, false); addFuture(result); diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h index 4ed02c2c96d..b0b28e8d1a6 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.h +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h @@ -133,6 +133,7 @@ public: QmlJS::Snapshot snapshot() const; QmlJS::Snapshot newestSnapshot() const; + QThreadPool *threadPool(); void activateScan(); void updateSourceFiles(const QStringList &files, @@ -287,6 +288,7 @@ private: Utils::FutureSynchronizer m_futureSynchronizer; bool m_indexerDisabled = false; + QThreadPool m_threadPool; }; } // namespace QmlJS diff --git a/src/libs/qmljs/qmljsplugindumper.cpp b/src/libs/qmljs/qmljsplugindumper.cpp index 56d444f9d9e..0a13fefba91 100644 --- a/src/libs/qmljs/qmljsplugindumper.cpp +++ b/src/libs/qmljs/qmljsplugindumper.cpp @@ -290,7 +290,8 @@ void PluginDumper::qmlPluginTypeDumpDone(QtcProcess *process) QStringList dependencies; }; - auto future = Utils::runAsync([output, libraryPath](QFutureInterface& future) + auto future = Utils::runAsync(m_modelManager->threadPool(), + [output, libraryPath](QFutureInterface& future) { CppQmlTypesInfo infos; CppQmlTypesLoader::parseQmlTypeDescriptions(output, &infos.objectsList, &infos.moduleApis, &infos.dependencies, @@ -343,7 +344,7 @@ void PluginDumper::pluginChanged(const QString &pluginLibrary) QFuture PluginDumper::loadQmlTypeDescription(const FilePaths &paths) const { - auto future = Utils::runAsync([=](QFutureInterface &future) + auto future = Utils::runAsync(m_modelManager->threadPool(), [=](QFutureInterface &future) { PluginDumper::QmlTypeDescription result; From daabcbbf7393a5c9eccebc6aa4495e1776d427f9 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 23 Aug 2022 17:27:30 +0200 Subject: [PATCH 23/35] QmlDesigner: Fix crash isBlocked seems to be called in rare cases if the model is null. Change-Id: Ie8fa6007a0891f4204c35600084025ca52f079e9 Reviewed-by: Tim Jenssen --- .../propertyeditor/propertyeditorcontextobject.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h index f5a2224c8b7..05ebe47ec28 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h @@ -28,12 +28,14 @@ #include #include -#include -#include -#include -#include #include +#include #include +#include +#include +#include +#include + #include namespace QmlDesigner { @@ -183,7 +185,7 @@ private: QPoint m_lastPos; - Model *m_model = nullptr; + QPointer m_model; bool m_aliasExport = false; From 83ce87a62588634f3a5033726cf48cb4e6776276 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 23 Aug 2022 16:11:20 +0200 Subject: [PATCH 24/35] StudioWelcome: Fix QTC_ASSERT Deleting QtcProcess instance directly from one of its signal handlers will lead to crash. Change-Id: Ida231f29dc6a717dfe4971da9743b1fb9b225495 Reviewed-by: Tim Jenssen Reviewed-by: --- src/plugins/studiowelcome/examplecheckout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/studiowelcome/examplecheckout.cpp b/src/plugins/studiowelcome/examplecheckout.cpp index 3263995af89..848d51beafb 100644 --- a/src/plugins/studiowelcome/examplecheckout.cpp +++ b/src/plugins/studiowelcome/examplecheckout.cpp @@ -503,7 +503,7 @@ bool DataModelDownloader::start() QTC_ASSERT(archive->isValid(), delete archive; return ); QObject::connect(archive, &Utils::Archive::finished, this, [this, archive](bool ret) { QTC_CHECK(ret); - delete archive; + archive->deleteLater(); emit finished(); }); archive->unarchive(); From 26e5e745618872433395f82d10970d189e6c0900 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 24 Aug 2022 06:36:37 +0200 Subject: [PATCH 25/35] QmlJS: Fix compile Amends 8310a2f0a9a4d. Change-Id: I062a377c9d6f1993f23c5b7e56cca93ad6c3eac5 Reviewed-by: David Schulz --- src/libs/qmljs/qmljsmodelmanagerinterface.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h index b0b28e8d1a6..b0a21dd84f6 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.h +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h @@ -41,6 +41,7 @@ #include #include #include +#include QT_FORWARD_DECLARE_CLASS(QTimer) From 83e1e4c2d63a9149b22db87996847f2ef0259ea0 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 23 Aug 2022 17:28:11 +0200 Subject: [PATCH 26/35] QmlDesigner: Ignore properties when making document as modified Change-Id: I659fc3e035c4b98500e700779e4e2a2627a18eb2 Reviewed-by: Reviewed-by: Mahmoud Badri --- src/plugins/qmldesigner/designercore/model/rewriterview.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp index 909c6483b1e..bb15a359b37 100644 --- a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp +++ b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp @@ -486,6 +486,9 @@ void RewriterView::auxiliaryDataChanged(const ModelNode &node, const PropertyNam return; } + if (name == "matPrevEnv" || name == "matPrevEnvValue" || name == "matPrevModel") + return; + m_textModifier->textDocument()->setModified(true); } From 0e238456180d412053e304b1fa65a426ba1ca8ee Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 23 Aug 2022 17:30:00 +0200 Subject: [PATCH 27/35] QmlDesigner: Always skip when condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no reason to set the when condition ever. Change-Id: I4c6b5ca04cdb7ba62f833225c6878da83a02abaf Reviewed-by: Henning Gründl Reviewed-by: Qt CI Bot --- .../qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.cpp index c07cc4bfcff..8a23a24f4cd 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.cpp @@ -89,8 +89,7 @@ void QmlStateNodeInstance::deactivateState() void QmlStateNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { - bool isStateOfTheRootModelNode = parentInstance() && parentInstance()->isRootNodeInstance(); - if (name == "when" && (isStateOfTheRootModelNode)) + if (name == "when") return; ObjectNodeInstance::setPropertyVariant(name, value); From f3e9fbd74899c6fa98d95ef82a11eab38b1a66a9 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 23 Aug 2022 17:30:51 +0200 Subject: [PATCH 28/35] QmlDesigner: Do not set state property on QQuickStateGroup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The state is determined by the state view. Change-Id: I3b76b25c618d4f860f13d2e005d88d93a660fbc0 Reviewed-by: Henning Gründl Reviewed-by: Qt CI Bot --- .../qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp index 9f3a1d6b3bc..d574d5f9792 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp @@ -456,6 +456,10 @@ QVariant ObjectNodeInstance::convertEnumToValue(const QVariant &value, const Pro void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { + if (name == "state" && object() && object()->metaObject() + && object()->metaObject()->className() == QByteArrayLiteral("QQuickStateGroup")) + return; + if (ignoredProperties().contains(name)) return; From 80922268abef161ed7e32dcc8e64d2b7bc63f1e8 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 23 Aug 2022 17:32:28 +0200 Subject: [PATCH 29/35] QmlDesigner: Implement ObjectNodeInstance::stateInstances() for StateGroup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ia6e239530d399da34ab63253762e3ebd2a79f4db Reviewed-by: Henning Gründl --- .../qml2puppet/instances/objectnodeinstance.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp index d574d5f9792..e5796a63410 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp @@ -46,6 +46,10 @@ #include #include +#include + +#include + static bool isSimpleExpression(const QString &expression) { if (expression.startsWith(QStringLiteral("{"))) @@ -656,8 +660,18 @@ QList ObjectNodeInstance::allItemsRecursive() const return QList(); } -QList ObjectNodeInstance::stateInstances() const +QList ObjectNodeInstance::stateInstances() const { + if (auto group = qobject_cast(object())) { + QList instanceList; + const QList stateList = group->states(); + for (QQuickState *state : stateList) { + if (state && nodeInstanceServer()->hasInstanceForObject(state)) + instanceList.append(nodeInstanceServer()->instanceForObject(state)); + } + return instanceList; + } + return QList(); } From 8e65e2815c2dc13bc8e62199a34d24825df4f4db Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 23 Aug 2022 17:32:48 +0200 Subject: [PATCH 30/35] QmlDesigner: Add NodeInstanceServer::allGroupStateInstances() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I26b20976746c3790d679a63db209fb535eb58382 Reviewed-by: Henning Gründl Reviewed-by: Qt CI Bot --- .../qml2puppet/instances/nodeinstanceserver.cpp | 15 +++++++++++++++ .../qml2puppet/instances/nodeinstanceserver.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp index 41c67f70b68..31a907c37fe 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp @@ -1061,6 +1061,21 @@ ServerNodeInstance NodeInstanceServer::rootNodeInstance() const return m_rootNodeInstance; } +QList NodeInstanceServer::allGroupStateInstances() const +{ + QList groups; + std::copy_if(nodeInstances().cbegin(), + nodeInstances().cend(), + std::back_inserter(groups), + [](const ServerNodeInstance &instance) { + return instance.isValid() && instance.internalObject()->metaObject() + && instance.internalObject()->metaObject()->className() + == QByteArrayLiteral("QQuickStateGroup"); + }); + + return groups; +} + void NodeInstanceServer::setStateInstance(const ServerNodeInstance &stateInstance) { m_activeStateInstance = stateInstance; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h index 42f345ee4e5..698c93fc60f 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h @@ -200,6 +200,8 @@ public: ServerNodeInstance rootNodeInstance() const; + QList allGroupStateInstances() const; + void notifyPropertyChange(qint32 instanceid, const PropertyName &propertyName); QByteArray importCode() const; From ae872359d00d746eaaa307c4d249ea271463f543 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 23 Aug 2022 17:33:25 +0200 Subject: [PATCH 31/35] QmlDesigner: Render state previews for StateGroup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Render previews for all state groups in the document. Change-Id: I89d9c43a53eb3d9844b863278395fd9098a07772 Reviewed-by: Reviewed-by: Henning Gründl Reviewed-by: Qt CI Bot --- .../qt5previewnodeinstanceserver.cpp | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5previewnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5previewnodeinstanceserver.cpp index f61ba1a3421..80233e65ffc 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5previewnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5previewnodeinstanceserver.cpp @@ -77,13 +77,23 @@ void Qt5PreviewNodeInstanceServer::collectItemChangesAndSendChangeCommands() QVector imageContainerVector; imageContainerVector.append(ImageContainer(0, renderPreviewImage(), -1)); - foreach (ServerNodeInstance instance, rootNodeInstance().stateInstances()) { - instance.activateState(); - QImage previewImage = renderPreviewImage(); - if (!previewImage.isNull()) - imageContainerVector.append(ImageContainer(instance.instanceId(), renderPreviewImage(), instance.instanceId())); - instance.deactivateState(); - } + QList stateInstances = rootNodeInstance().stateInstances(); + + const QList groupInstances = allGroupStateInstances(); + + for (ServerNodeInstance instance : groupInstances) { + stateInstances.append(instance.stateInstances()); + } + + for (ServerNodeInstance instance : qAsConst(stateInstances)) { + instance.activateState(); + QImage previewImage = renderPreviewImage(); + if (!previewImage.isNull()) + imageContainerVector.append(ImageContainer(instance.instanceId(), + renderPreviewImage(), + instance.instanceId())); + instance.deactivateState(); + } nodeInstanceClient()->statePreviewImagesChanged( StatePreviewImageChangedCommand(imageContainerVector)); From 1bfd078071f6a26d00a789c66ecd0aa77ef3d00b Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 24 Aug 2022 19:56:21 +0200 Subject: [PATCH 32/35] QmlDesigner: Fix crash Tracking the target with a QPointer in case the target gets deleted. Change-Id: I9cca4a5017b7fc77941fd46653847a00363c060e Reviewed-by: Qt CI Bot Reviewed-by: Tim Jenssen --- .../qmldesigner/designercore/include/nodeinstanceview.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h index d6e30746661..6209ff19d01 100644 --- a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h +++ b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -277,7 +278,7 @@ private: std::unique_ptr m_nodeInstanceServer; QImage m_baseStatePreviewImage; QElapsedTimer m_lastCrashTime; - ProjectExplorer::Target *m_currentTarget = nullptr; + QPointer m_currentTarget; int m_restartProcessTimerId; RewriterTransaction m_puppetTransaction; From f6e8b5f753e05f210979987dc3e9092cefb8b958 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 25 Aug 2022 12:05:24 +0300 Subject: [PATCH 33/35] QmlDesigner: Use actual material for model previews Fixes: QDS-7412 Change-Id: Iec020578460e417e602f832ed0d667fbdda4e96a Reviewed-by: Mahmoud Badri --- .../qml/qmlpuppet/mockfiles/qt6/ModelNodeView.qml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNodeView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNodeView.qml index ea2e23837fd..31228abc690 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNodeView.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNodeView.qml @@ -67,11 +67,6 @@ View3D { id: model source: _generalHelper.resolveAbsoluteSourceUrl(sourceModel) geometry: sourceModel.geometry - - materials: [ - DefaultMaterial { - diffuseColor: "#999999" - } - ] + materials: sourceModel.materials } } From 8656bafbd4051bb75fea398f68331c73d9d67cfb Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Tue, 23 Aug 2022 15:19:56 +0300 Subject: [PATCH 34/35] QmlDesigner: Add delete action to 3D Editor's context menu This entails selecting a model upon right-clicking if it is not selected. Also fixed a memory leak and small tweaks. Fixes: QDS-7401 Change-Id: I592acb3fff30ecc3236f3cf2fbe126de4fb389dc Reviewed-by: Reviewed-by: Miikka Heikkinen --- .../qmlpuppet/mockfiles/qt5/EditView3D.qml | 27 ++++++++++++------- .../qmlpuppet/mockfiles/qt6/EditView3D.qml | 27 ++++++++++++------- .../qt5informationnodeinstanceserver.cpp | 9 ++++--- .../components/edit3d/edit3dview.cpp | 4 +++ .../components/edit3d/edit3dwidget.cpp | 8 +++++- .../components/edit3d/edit3dwidget.h | 1 + 6 files changed, 51 insertions(+), 25 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/EditView3D.qml index 1376610984d..34090031897 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/EditView3D.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/EditView3D.qml @@ -363,7 +363,7 @@ Item { } } - function handleObjectClicked(object, multi) + function handleObjectClicked(object, button, multi) { if (object instanceof View3D) { // View3D can be the resolved pick target in case the 3D editor is showing content @@ -393,7 +393,14 @@ Item { // Null object always clears entire selection var newSelection = []; if (clickedObject) { - if (multi && selectedNodes.length > 0) { + if (button === Qt.RightButton) { + // Right-clicking does only single selection (when clickedObject is unselected) + // This is needed for selecting a target for the context menu + if (!selectedNodes.includes(clickedObject)) + newSelection[0] = clickedObject; + else + newSelection = selectedNodes; + } else if (multi && selectedNodes.length > 0) { var deselect = false; for (var i = 0; i < selectedNodes.length; ++i) { // Multiselecting already selected object clears that object from selection @@ -697,10 +704,10 @@ Item { view3D: overlayView dragHelper: gizmoDragHelper - onPropertyValueCommit: (propName)=> { + onPropertyValueCommit: (propName) => { viewRoot.commitObjectProperty([targetNode], [propName]); } - onPropertyValueChange: (propName)=> { + onPropertyValueChange: (propName) => { viewRoot.changeObjectProperty([targetNode], [propName]); } } @@ -772,17 +779,17 @@ Item { MouseArea { anchors.fill: parent - acceptedButtons: Qt.LeftButton + acceptedButtons: Qt.LeftButton | Qt.RightButton hoverEnabled: false property MouseArea3D freeDraggerArea property point pressPoint property bool initialMoveBlock: false - onPressed: (mouse)=> { + onPressed: (mouse) => { if (viewRoot.editView) { var pickResult = viewRoot.editView.pick(mouse.x, mouse.y); - handleObjectClicked(_generalHelper.resolvePick(pickResult.objectHit), + handleObjectClicked(_generalHelper.resolvePick(pickResult.objectHit), mouse.button, mouse.modifiers & Qt.ControlModifier); if (pickResult.objectHit && pickResult.objectHit instanceof Node) { @@ -800,7 +807,7 @@ Item { } } } - onPositionChanged: (mouse)=> { + onPositionChanged: (mouse) => { if (freeDraggerArea) { if (initialMoveBlock && Math.abs(pressPoint.x - mouse.x) + Math.abs(pressPoint.y - mouse.y) > 10) { // Don't force press event at actual press, as that puts the gizmo @@ -825,10 +832,10 @@ Item { } } - onReleased: (mouse)=> { + onReleased: (mouse) => { handleRelease(mouse); } - onCanceled: (mouse)=> { + onCanceled: (mouse) => { handleRelease(mouse); } } diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml index 721e74ac303..5fa269a916d 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml @@ -363,7 +363,7 @@ Item { } } - function handleObjectClicked(object, multi) + function handleObjectClicked(object, button, multi) { if (object instanceof View3D) { // View3D can be the resolved pick target in case the 3D editor is showing content @@ -393,7 +393,14 @@ Item { // Null object always clears entire selection var newSelection = []; if (clickedObject) { - if (multi && selectedNodes.length > 0) { + if (button === Qt.RightButton) { + // Right-clicking does only single selection (when clickedObject is unselected) + // This is needed for selecting a target for the context menu + if (!selectedNodes.includes(clickedObject)) + newSelection[0] = clickedObject; + else + newSelection = selectedNodes; + } else if (multi && selectedNodes.length > 0) { var deselect = false; for (var i = 0; i < selectedNodes.length; ++i) { // Multiselecting already selected object clears that object from selection @@ -841,10 +848,10 @@ Item { view3D: overlayView dragHelper: gizmoDragHelper - onPropertyValueCommit: (propName)=> { + onPropertyValueCommit: (propName) => { viewRoot.commitObjectProperty([targetNode], [propName]); } - onPropertyValueChange: (propName)=> { + onPropertyValueChange: (propName) => { viewRoot.changeObjectProperty([targetNode], [propName]); } } @@ -917,14 +924,14 @@ Item { MouseArea { anchors.fill: parent - acceptedButtons: Qt.LeftButton + acceptedButtons: Qt.LeftButton | Qt.RightButton hoverEnabled: false property MouseArea3D freeDraggerArea property point pressPoint property bool initialMoveBlock: false - onPressed: (mouse)=> { + onPressed: (mouse) => { if (viewRoot.editView) { // First pick overlay to check for hits there var pickResult = _generalHelper.pickViewAt(overlayView, mouse.x, mouse.y); @@ -935,7 +942,7 @@ Item { resolvedResult = _generalHelper.resolvePick(pickResult.objectHit); } - handleObjectClicked(resolvedResult, mouse.modifiers & Qt.ControlModifier); + handleObjectClicked(resolvedResult, mouse.button, mouse.modifiers & Qt.ControlModifier); if (pickResult.objectHit && pickResult.objectHit instanceof Node) { if (transformMode === EditView3D.TransformMode.Move) @@ -952,7 +959,7 @@ Item { } } } - onPositionChanged: (mouse)=> { + onPositionChanged: (mouse) => { if (freeDraggerArea) { if (initialMoveBlock && Math.abs(pressPoint.x - mouse.x) + Math.abs(pressPoint.y - mouse.y) > 10) { // Don't force press event at actual press, as that puts the gizmo @@ -977,10 +984,10 @@ Item { } } - onReleased: (mouse)=> { + onReleased: (mouse) => { handleRelease(mouse); } - onCanceled: (mouse)=> { + onCanceled: (mouse) => { handleRelease(mouse); } } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index b94fa31fc63..852572ebf13 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -285,12 +285,12 @@ void Qt5InformationNodeInstanceServer::handleInputEvents() continue; } } - auto me = new QMouseEvent(command.type(), command.pos(), command.button(), - command.buttons(), command.modifiers()); + QMouseEvent me(command.type(), command.pos(), command.button(), command.buttons(), + command.modifiers()); // We must use sendEvent in Qt 6, as using postEvent allows the associated position // data stored internally in QMutableEventPoint to potentially be updated by system // before the event is delivered. - QGuiApplication::sendEvent(m_editView3DData.window, me); + QGuiApplication::sendEvent(m_editView3DData.window, &me); // Context menu requested if (command.button() == Qt::RightButton && command.modifiers() == Qt::NoModifier) @@ -428,7 +428,8 @@ void Qt5InformationNodeInstanceServer::getModelAtPos(const QPointF &pos) QVariant instance = resolvedPick ? instanceForObject(resolvedPick).instanceId() : -1; nodeInstanceClient()->handlePuppetToCreatorCommand({PuppetToCreatorCommand::ModelAtPos, instance}); - return; +#else + Q_UNUSED(pos) #endif } diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp index fb844b1c858..5a598dbd0e5 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp +++ b/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp @@ -249,6 +249,10 @@ void Edit3DView::customNotification(const AbstractView *view, const QString &ide void Edit3DView::modelAtPosReady(const ModelNode &modelNode) { if (m_modelAtPosReqType == ModelAtPosReqType::ContextMenu) { + // Make sure right-clicked item is selected. Due to a bug in puppet side right-clicking an item + // while the context-menu is shown doesn't select the item. + if (modelNode.isValid() && !modelNode.isSelected()) + setSelectedModelNode(modelNode); m_edit3DWidget->showContextMenu(m_contextMenuPos, modelNode); } else if (m_modelAtPosReqType == ModelAtPosReqType::MaterialDrop) { if (m_droppedMaterial.isValid() && modelNode.isValid()) { diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp index 8643bc091b1..c7885996cec 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp +++ b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp @@ -185,7 +185,12 @@ void Edit3DWidget::createContextMenu() ModelNodeOperations::editMaterial(selCtx); }); - // TODO: add more actions: delete, create, etc + m_deleteAction = m_contextMenu->addAction(tr("Delete"), [&] { + view()->executeInTransaction("Edit3DWidget::createContextMenu", [&] { + for (ModelNode &node : m_view->selectedModelNodes()) + node.destroy(); + }); + }); } void Edit3DWidget::contextHelp(const Core::IContext::HelpCallback &callback) const @@ -241,6 +246,7 @@ void Edit3DWidget::showContextMenu(const QPoint &pos, const ModelNode &modelNode m_contextMenuTarget = modelNode; m_editMaterialAction->setEnabled(modelNode.isValid()); + m_deleteAction->setEnabled(modelNode.isValid()); m_contextMenu->popup(mapToGlobal(pos)); } diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.h b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.h index 6b3e773fdc4..7315f5a6b1d 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.h +++ b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.h @@ -76,6 +76,7 @@ private: QPointer m_backgroundColorMenu; QPointer m_contextMenu; QPointer m_editMaterialAction; + QPointer m_deleteAction; ModelNode m_contextMenuTarget; }; From 70343084badaca0ae8a05f2e4c150a893e929275 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 23 Aug 2022 18:57:39 +0200 Subject: [PATCH 35/35] Fix key deployment on Windows It looks like there is no way of setting a command line on Windows according to Linux rules when there is no Linux-associated device. Workaround it by using ProcessArgs explicitly. Fixes: QTCREATORBUG-28092 Change-Id: I5ce23d33547993ed7c7733809187027084ff4c3b Reviewed-by: Qt CI Bot Reviewed-by: Christian Kandeler Reviewed-by: --- src/plugins/remotelinux/publickeydeploymentdialog.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/remotelinux/publickeydeploymentdialog.cpp b/src/plugins/remotelinux/publickeydeploymentdialog.cpp index 3ba3f011d70..0fac561614c 100644 --- a/src/plugins/remotelinux/publickeydeploymentdialog.cpp +++ b/src/plugins/remotelinux/publickeydeploymentdialog.cpp @@ -119,11 +119,10 @@ PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const IDevice::ConstPtr &de args << params.host(); cmd.addArgs(args); - CommandLine execCmd; - execCmd.addArg("exec"); - execCmd.addCommandLineAsArgs({"/bin/sh", {"-c", command}}, CommandLine::Raw); + QString execCommandString("exec /bin/sh -c"); + ProcessArgs::addArg(&execCommandString, command, OsType::OsTypeLinux); + cmd.addArg(execCommandString); - cmd.addArg(execCmd.arguments()); d->m_process.setCommand(cmd); SshParameters::setupSshEnvironment(&d->m_process); d->m_process.start();