diff --git a/dist/changes-4.11.0.md b/dist/changes-4.11.0.md index 3b24537c3e0..fa43c4d0557 100644 --- a/dist/changes-4.11.0.md +++ b/dist/changes-4.11.0.md @@ -53,6 +53,8 @@ you can check out from the public Git repository. For example: ### Python * Simplified registration of language server +* Added python settings to configure multiple python interpreters +* Simplified switching python interpreters for python projects ## Help diff --git a/share/qtcreator/qml/qmlpuppet/commands/commands.pri b/share/qtcreator/qml/qmlpuppet/commands/commands.pri index ffd1ce6dea5..7985b259758 100644 --- a/share/qtcreator/qml/qmlpuppet/commands/commands.pri +++ b/share/qtcreator/qml/qmlpuppet/commands/commands.pri @@ -28,7 +28,8 @@ HEADERS += $$PWD/removesharedmemorycommand.h HEADERS += $$PWD/puppetalivecommand.h HEADERS += $$PWD/changeselectioncommand.h HEADERS += $$PWD/drop3dlibraryitemcommand.h -HEADERS += $$PWD/change3dviewcommand.h +HEADERS += $$PWD/update3dviewstatecommand.h +HEADERS += $$PWD/enable3dviewcommand.h SOURCES += $$PWD/synchronizecommand.cpp SOURCES += $$PWD/debugoutputcommand.cpp @@ -58,4 +59,5 @@ SOURCES += $$PWD/removesharedmemorycommand.cpp SOURCES += $$PWD/puppetalivecommand.cpp SOURCES += $$PWD/changeselectioncommand.cpp SOURCES += $$PWD/drop3dlibraryitemcommand.cpp -SOURCES += $$PWD/change3dviewcommand.cpp +SOURCES += $$PWD/update3dviewstatecommand.cpp +SOURCES += $$PWD/enable3dviewcommand.cpp diff --git a/share/qtcreator/qml/qmlpuppet/commands/change3dviewcommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.cpp similarity index 64% rename from share/qtcreator/qml/qmlpuppet/commands/change3dviewcommand.cpp rename to share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.cpp index ad4832d86b8..7fd3b3f350a 100644 --- a/share/qtcreator/qml/qmlpuppet/commands/change3dviewcommand.cpp +++ b/share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.cpp @@ -23,41 +23,43 @@ ** ****************************************************************************/ -#include "change3dviewcommand.h" +#include "enable3dviewcommand.h" #include +#include namespace QmlDesigner { -Change3DViewCommand::Change3DViewCommand() = default; - -Change3DViewCommand::Change3DViewCommand(const QVector &informationVector) - : m_informationVector(informationVector) +// open / close edit view 3D command +Enable3DViewCommand::Enable3DViewCommand(bool enable) + : m_enable(enable) { } -QVector Change3DViewCommand::informationVector() const +bool Enable3DViewCommand::isEnable() const { - return m_informationVector; + return m_enable; } -QDataStream &operator<<(QDataStream &out, const Change3DViewCommand &command) +QDataStream &operator<<(QDataStream &out, const Enable3DViewCommand &command) { - out << command.informationVector(); + out << qint32(command.isEnable()); return out; } -QDataStream &operator>>(QDataStream &in, Change3DViewCommand &command) +QDataStream &operator>>(QDataStream &in, Enable3DViewCommand &command) { - in >> command.m_informationVector; + qint32 enable; + in >> enable; + command.m_enable = enable; return in; } -QDebug operator <<(QDebug debug, const Change3DViewCommand &command) +QDebug operator<<(QDebug debug, const Enable3DViewCommand &command) { - return debug.nospace() << "Change3DViewCommand(auxiliaryChanges: " << command.m_informationVector << ")"; + return debug.nospace() << "Enable3DViewCommand(enable: " << command.m_enable << ")"; } } // namespace QmlDesigner diff --git a/share/qtcreator/qml/qmlpuppet/commands/change3dviewcommand.h b/share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.h similarity index 65% rename from share/qtcreator/qml/qmlpuppet/commands/change3dviewcommand.h rename to share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.h index 6b1b062da07..cd9529fbb5a 100644 --- a/share/qtcreator/qml/qmlpuppet/commands/change3dviewcommand.h +++ b/share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.h @@ -26,32 +26,29 @@ #pragma once #include -#include - -#include "informationcontainer.h" namespace QmlDesigner { -class Change3DViewCommand +class Enable3DViewCommand { - friend QDataStream &operator>>(QDataStream &in, Change3DViewCommand &command); - friend QDebug operator <<(QDebug debug, const Change3DViewCommand &command); + friend QDataStream &operator>>(QDataStream &in, Enable3DViewCommand &command); + friend QDebug operator<<(QDebug debug, const Enable3DViewCommand &command); public: - Change3DViewCommand(); - explicit Change3DViewCommand(const QVector &auxiliaryChangeVector); + explicit Enable3DViewCommand(bool enable); + Enable3DViewCommand() = default; - QVector informationVector() const; + bool isEnable() const; private: - QVector m_informationVector; + bool m_enable = true; }; -QDataStream &operator<<(QDataStream &out, const Change3DViewCommand &command); -QDataStream &operator>>(QDataStream &in, Change3DViewCommand &command); +QDataStream &operator<<(QDataStream &out, const Enable3DViewCommand &command); +QDataStream &operator>>(QDataStream &in, Enable3DViewCommand &command); -QDebug operator <<(QDebug debug, const Change3DViewCommand &command); +QDebug operator<<(QDebug debug, const Enable3DViewCommand &command); } // namespace QmlDesigner -Q_DECLARE_METATYPE(QmlDesigner::Change3DViewCommand) +Q_DECLARE_METATYPE(QmlDesigner::Enable3DViewCommand) diff --git a/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp new file mode 100644 index 00000000000..b387cf09f3d --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "update3dviewstatecommand.h" + +#include +#include + +namespace QmlDesigner { + +Update3dViewStateCommand::Update3dViewStateCommand(Qt::WindowStates previousStates, + Qt::WindowStates currentStates) + : m_previousStates(previousStates) + , m_currentStates(currentStates) + , m_type(Update3dViewStateCommand::StateChange) +{ +} + +Update3dViewStateCommand::Update3dViewStateCommand(bool active, bool hasPopup) + : m_active(active) + , m_hasPopup(hasPopup) + , m_type(Update3dViewStateCommand::ActiveChange) +{ +} + +Qt::WindowStates Update3dViewStateCommand::previousStates() const +{ + return m_previousStates; +} + +Qt::WindowStates Update3dViewStateCommand::currentStates() const +{ + return m_currentStates; +} + +bool Update3dViewStateCommand::isActive() const +{ + return m_active; +} + +bool Update3dViewStateCommand::hasPopup() const +{ + return m_hasPopup; +} + +Update3dViewStateCommand::Type Update3dViewStateCommand::type() const +{ + return m_type; +} + +QDataStream &operator<<(QDataStream &out, const Update3dViewStateCommand &command) +{ + out << command.previousStates(); + out << command.currentStates(); + out << qint32(command.isActive()); + out << qint32(command.hasPopup()); + out << qint32(command.type()); + + return out; +} + +QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command) +{ + in >> command.m_previousStates; + in >> command.m_currentStates; + qint32 active; + qint32 hasPopup; + qint32 type; + in >> active; + in >> hasPopup; + in >> type; + command.m_active = active; + command.m_hasPopup = hasPopup; + command.m_type = Update3dViewStateCommand::Type(type); + + return in; +} + +QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command) +{ + return debug.nospace() << "Update3dViewStateCommand(type: " << command.m_type << ")"; +} + +} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.h b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h similarity index 51% rename from src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.h rename to share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h index 717deca7f9e..de8511255d5 100644 --- a/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.h +++ b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h @@ -25,43 +25,45 @@ #pragma once -#include "abstractcustomtool.h" - -#include -#include +#include namespace QmlDesigner { -class FormEditorView; -class NodeInstanceView; - -class EditView3DProxyDialog : public QDialog +class Update3dViewStateCommand { - Q_OBJECT + friend QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command); + friend QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command); public: - explicit EditView3DProxyDialog(FormEditorView *view); + enum Type { StateChange, ActiveChange, Empty }; - void invalidate(); + explicit Update3dViewStateCommand(Qt::WindowStates previousStates, Qt::WindowStates currentStates); + explicit Update3dViewStateCommand(bool active, bool hasPopup); + Update3dViewStateCommand() = default; -protected: - void moveEvent(QMoveEvent *event) override; - void closeEvent(QCloseEvent *event) override; - void hideEvent(QHideEvent *event) override; - void focusOutEvent(QFocusEvent *event) override; - void focusInEvent(QFocusEvent *event) override; - void resizeEvent(QResizeEvent *event) override; - bool event(QEvent *event) override; + Qt::WindowStates previousStates() const; + Qt::WindowStates currentStates() const; + + bool isActive() const; + bool hasPopup() const; + + Type type() const; private: - QRect adjustedRect() const; - NodeInstanceView *nodeInstanceView() const; - void showView(); - void hideView(); + Qt::WindowStates m_previousStates = Qt::WindowNoState; + Qt::WindowStates m_currentStates = Qt::WindowNoState; - QPointer m_formEditorView; + bool m_active = false; + bool m_hasPopup = false; + Type m_type = Empty; }; -} //QmlDesigner +QDataStream &operator<<(QDataStream &out, const Update3dViewStateCommand &command); +QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command); +QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command); + +} // namespace QmlDesigner + +Q_DECLARE_METATYPE(QmlDesigner::Update3dViewStateCommand) diff --git a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp index 93520c2f7de..d12cfe327fd 100644 --- a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp +++ b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp @@ -41,7 +41,8 @@ #include "instancecontainer.h" #include "createinstancescommand.h" #include "createscenecommand.h" -#include "change3dviewcommand.h" +#include "update3dviewstatecommand.h" +#include "enable3dviewcommand.h" #include "changevaluescommand.h" #include "changebindingscommand.h" #include "changeauxiliarycommand.h" @@ -361,9 +362,14 @@ void NodeInstanceClientProxy::createScene(const CreateSceneCommand &command) nodeInstanceServer()->createScene(command); } -void NodeInstanceClientProxy::change3DView(const Change3DViewCommand &command) +void NodeInstanceClientProxy::update3DViewState(const Update3dViewStateCommand &command) { - nodeInstanceServer()->change3DView(command); + nodeInstanceServer()->update3DViewState(command); +} + +void NodeInstanceClientProxy::enable3DView(const Enable3DViewCommand &command) +{ + nodeInstanceServer()->enable3DView(command); } void NodeInstanceClientProxy::clearScene(const ClearSceneCommand &command) @@ -453,7 +459,8 @@ void NodeInstanceClientProxy::changeSelection(const ChangeSelectionCommand &comm void NodeInstanceClientProxy::dispatchCommand(const QVariant &command) { static const int createInstancesCommandType = QMetaType::type("CreateInstancesCommand"); - static const int change3DViewCommandType = QMetaType::type("Change3DViewCommand"); + static const int update3dViewStateCommand = QMetaType::type("Update3dViewStateCommand"); + static const int enable3DViewCommandType = QMetaType::type("Enable3DViewCommand"); static const int changeFileUrlCommandType = QMetaType::type("ChangeFileUrlCommand"); static const int createSceneCommandType = QMetaType::type("CreateSceneCommand"); static const int clearSceneCommandType = QMetaType::type("ClearSceneCommand"); @@ -477,8 +484,10 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command) if (commandType == createInstancesCommandType) createInstances(command.value()); - else if (commandType == change3DViewCommandType) - change3DView(command.value()); + else if (commandType == update3dViewStateCommand) + update3DViewState(command.value()); + else if (commandType == enable3DViewCommandType) + enable3DView(command.value()); else if (commandType == changeFileUrlCommandType) changeFileUrl(command.value()); else if (commandType == createSceneCommandType) diff --git a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h index e9044b63efd..5a742947d2d 100644 --- a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h +++ b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h @@ -45,7 +45,8 @@ class CreateSceneCommand; class CreateInstancesCommand; class ClearSceneCommand; class ReparentInstancesCommand; -class Change3DViewCommand; +class Update3dViewStateCommand; +class Enable3DViewCommand; class ChangeFileUrlCommand; class ChangeValuesCommand; class ChangeAuxiliaryCommand; @@ -96,7 +97,8 @@ protected: void changeFileUrl(const ChangeFileUrlCommand &command); void createScene(const CreateSceneCommand &command); void clearScene(const ClearSceneCommand &command); - void change3DView(const Change3DViewCommand &command); + void update3DViewState(const Update3dViewStateCommand &command); + void enable3DView(const Enable3DViewCommand &command); void removeInstances(const RemoveInstancesCommand &command); void removeProperties(const RemovePropertiesCommand &command); void changePropertyBindings(const ChangeBindingsCommand &command); diff --git a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp index 83c8c67ef72..bbd73e63caf 100644 --- a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp +++ b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp @@ -32,7 +32,8 @@ #include "instancecontainer.h" #include "createinstancescommand.h" #include "createscenecommand.h" -#include "change3dviewcommand.h" +#include "update3dviewstatecommand.h" +#include "enable3dviewcommand.h" #include "changevaluescommand.h" #include "changebindingscommand.h" #include "changeauxiliarycommand.h" @@ -91,8 +92,11 @@ void NodeInstanceServerInterface::registerCommands() qRegisterMetaType("CreateSceneCommand"); qRegisterMetaTypeStreamOperators("CreateSceneCommand"); - qRegisterMetaType("Change3DViewCommand"); - qRegisterMetaTypeStreamOperators("Change3DViewCommand"); + qRegisterMetaType("Update3dViewStateCommand"); + qRegisterMetaTypeStreamOperators("Update3dViewStateCommand"); + + qRegisterMetaType("Enable3DViewCommand"); + qRegisterMetaTypeStreamOperators("Enable3DViewCommand"); qRegisterMetaType("ChangeBindingsCommand"); qRegisterMetaTypeStreamOperators("ChangeBindingsCommand"); diff --git a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h index 3dc651ef2f3..e60d99b1e19 100644 --- a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h +++ b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h @@ -33,7 +33,8 @@ class PropertyAbstractContainer; class PropertyBindingContainer; class PropertyValueContainer; -class Change3DViewCommand; +class Update3dViewStateCommand; +class Enable3DViewCommand; class ChangeFileUrlCommand; class ChangeValuesCommand; class ChangeBindingsCommand; @@ -67,7 +68,8 @@ public: virtual void changeFileUrl(const ChangeFileUrlCommand &command) = 0; virtual void createScene(const CreateSceneCommand &command) = 0; virtual void clearScene(const ClearSceneCommand &command) = 0; - virtual void change3DView(const Change3DViewCommand &command) = 0; + virtual void update3DViewState(const Update3dViewStateCommand &command) = 0; + virtual void enable3DView(const Enable3DViewCommand &command) = 0; virtual void removeInstances(const RemoveInstancesCommand &command) = 0; virtual void removeProperties(const RemovePropertiesCommand &command) = 0; virtual void changePropertyBindings(const ChangeBindingsCommand &command) = 0; diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/DirectionalDraggable.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/DirectionalDraggable.qml index 081936d007f..217f29d7c43 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/DirectionalDraggable.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/DirectionalDraggable.qml @@ -35,6 +35,7 @@ Model { property Node targetNode: null property bool dragging: mouseAreaYZ.dragging || mouseAreaXZ.dragging property bool active: false + property MouseArea3D dragHelper: null readonly property bool hovering: mouseAreaYZ.hovering || mouseAreaXZ.hovering @@ -57,7 +58,7 @@ Model { return; var maskedPosition = Qt.vector3d(scenePos.x, 0, 0); - _pointerPosPressed = mouseArea.mapPositionToScene(maskedPosition); + _pointerPosPressed = mouseArea.dragHelper.mapPositionToScene(maskedPosition); if (targetNode.orientation === Node.RightHanded) _pointerPosPressed.z = -_pointerPosPressed.z; var sp = targetNode.scenePosition; @@ -68,7 +69,7 @@ Model { function calcRelativeDistance(mouseArea, scenePos) { var maskedPosition = Qt.vector3d(scenePos.x, 0, 0); - var scenePointerPos = mouseArea.mapPositionToScene(maskedPosition); + var scenePointerPos = mouseArea.dragHelper.mapPositionToScene(maskedPosition); if (targetNode.orientation === Node.RightHanded) scenePointerPos.z = -scenePointerPos.z; return scenePointerPos.minus(_pointerPosPressed); @@ -100,6 +101,8 @@ Model { rotation: Qt.vector3d(0, 0, 90) grabsMouse: targetNode active: rootModel.active + dragHelper: rootModel.dragHelper + onPressed: rootModel.handlePressed(mouseAreaYZ, scenePos) onDragged: rootModel.handleDragged(mouseAreaYZ, scenePos) onReleased: rootModel.handleReleased(mouseAreaYZ, scenePos) @@ -115,6 +118,8 @@ Model { rotation: Qt.vector3d(0, 90, 90) grabsMouse: targetNode active: rootModel.active + dragHelper: rootModel.dragHelper + onPressed: rootModel.handlePressed(mouseAreaXZ, scenePos) onDragged: rootModel.handleDragged(mouseAreaXZ, scenePos) onReleased: rootModel.handleReleased(mouseAreaXZ, scenePos) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml index f4ef3301de8..a30eb002227 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml @@ -28,19 +28,16 @@ import QtQuick.Window 2.12 import QtQuick3D 1.0 import QtQuick.Controls 2.0 import QtGraphicalEffects 1.0 +import MouseArea3D 1.0 Window { id: viewWindow width: 1024 height: 768 - visible: false - title: "3D" - flags: Qt.Widget | Qt.SplashScreen - - onActiveChanged: { - if (viewWindow.active) - cameraControl.forceActiveFocus() - } + visible: true + title: "3D Edit View" + // need all those flags otherwise the title bar disappears after setting WindowStaysOnTopHint flag later + flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint property alias scene: editView.importScene property alias showEditLight: btnEditViewLight.toggled @@ -126,6 +123,15 @@ Window { function addLightGizmo(obj) { + // Insert into first available gizmo + for (var i = 0; i < lightGizmos.length; ++i) { + if (!lightGizmos[i].targetNode) { + lightGizmos[i].targetNode = obj; + return; + } + } + + // No free gizmos available, create a new one var component = Qt.createComponent("LightGizmo.qml"); if (component.status === Component.Ready) { var gizmo = component.createObject(overlayScene, @@ -139,6 +145,14 @@ Window { function addCameraGizmo(obj) { + // Insert into first available gizmo + for (var i = 0; i < cameraGizmos.length; ++i) { + if (!cameraGizmos[i].targetNode) { + cameraGizmos[i].targetNode = obj; + return; + } + } + // No free gizmos available, create a new one var component = Qt.createComponent("CameraGizmo.qml"); if (component.status === Component.Ready) { var geometryName = _generalHelper.generateUniqueName("CameraGeometry"); @@ -183,6 +197,11 @@ Window { scale: editOrthoCamera.scale } + MouseArea3D { + id: gizmoDragHelper + view3D: overlayView + } + MoveGizmo { id: moveGizmo scale: autoScale.getScale(Qt.vector3d(5, 5, 5)) @@ -191,6 +210,7 @@ Window { globalOrientation: btnLocalGlobal.toggled visible: selectedNode && btnMove.selected view3D: overlayView + dragHelper: gizmoDragHelper onPositionCommit: viewWindow.commitObjectProperty(selectedNode, "position") onPositionMove: viewWindow.changeObjectProperty(selectedNode, "position") @@ -204,6 +224,7 @@ Window { globalOrientation: false visible: selectedNode && btnScale.selected view3D: overlayView + dragHelper: gizmoDragHelper onScaleCommit: viewWindow.commitObjectProperty(selectedNode, "scale") onScaleChange: viewWindow.changeObjectProperty(selectedNode, "scale") @@ -217,6 +238,7 @@ Window { globalOrientation: btnLocalGlobal.toggled visible: selectedNode && btnRotate.selected view3D: overlayView + dragHelper: gizmoDragHelper onRotateCommit: viewWindow.commitObjectProperty(selectedNode, "rotation") onRotateChange: viewWindow.changeObjectProperty(selectedNode, "rotation") @@ -457,48 +479,48 @@ Window { Rectangle { // top controls bar color: "#aa000000" - width: 265 + width: 290 height: btnPerspective.height + 10 anchors.top: parent.top anchors.right: parent.right anchors.rightMargin: 100 - ToggleButton { - id: btnPerspective - anchors.top: parent.top - anchors.topMargin: 5 - anchors.left: parent.left - anchors.leftMargin: 5 - tooltip: qsTr("Toggle Perspective / Orthographic Projection") - states: [{iconId: "ortho", text: qsTr("Orthographic")}, {iconId: "persp", text: qsTr("Perspective")}] + Row { + padding: 5 + anchors.fill: parent + ToggleButton { + id: btnPerspective + width: 105 + tooltip: qsTr("Toggle Perspective / Orthographic Projection") + states: [{iconId: "ortho", text: qsTr("Orthographic")}, {iconId: "persp", text: qsTr("Perspective")}] + } + + ToggleButton { + id: btnLocalGlobal + width: 65 + tooltip: qsTr("Toggle Global / Local Orientation") + states: [{iconId: "local", text: qsTr("Local")}, {iconId: "global", text: qsTr("Global")}] + } + + ToggleButton { + id: btnEditViewLight + width: 110 + toggleBackground: true + tooltip: qsTr("Toggle Edit Light") + states: [{iconId: "edit_light_off", text: qsTr("Edit Light Off")}, {iconId: "edit_light_on", text: qsTr("Edit Light On")}] + } } - ToggleButton { - id: btnLocalGlobal - anchors.top: parent.top - anchors.topMargin: 5 - anchors.left: parent.left - anchors.leftMargin: 100 - tooltip: qsTr("Toggle Global / Local Orientation") - states: [{iconId: "local", text: qsTr("Local")}, {iconId: "global", text: qsTr("Global")}] - } - - ToggleButton { - id: btnEditViewLight - anchors.top: parent.top - anchors.topMargin: 5 - anchors.left: parent.left - anchors.leftMargin: 165 - toggleBackground: true - tooltip: qsTr("Toggle Edit Light") - states: [{iconId: "edit_light_off", text: qsTr("Edit Light Off")}, {iconId: "edit_light_on", text: qsTr("Edit Light On")}] - } } Text { id: helpText + + property string modKey: _generalHelper.isMacOS ? qsTr("Option") : qsTr("Alt") + color: "white" - text: qsTr("Camera controls: ALT + mouse press and drag. Left: Rotate, Middle: Pan, Right/Wheel: Zoom.") + text: qsTr("Camera controls: ") + modKey + + qsTr(" + mouse press and drag. Left: Rotate, Middle: Pan, Right/Wheel: Zoom.") anchors.bottom: parent.bottom } } diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml index e84de0fbdeb..c5e7c5fc0fa 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml @@ -33,7 +33,7 @@ Node { property View3D view3D property bool highlightOnHover: true property Node targetNode: null - property var selectedNodes: null + property var selectedNodes: [] readonly property bool selected: { for (var i = 0; i < selectedNodes.length; ++i) { if (selectedNodes[i] === targetNode) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/MoveGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/MoveGizmo.qml index 37e7a17a2c4..fa6e844f0b1 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/MoveGizmo.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/MoveGizmo.qml @@ -37,6 +37,8 @@ Node { readonly property bool dragging: arrowX.dragging || arrowY.dragging || arrowZ.dragging || planeX.dragging || planeY.dragging || planeZ.dragging || centerBall.dragging + property MouseArea3D dragHelper: null + position: targetNode ? targetNode.scenePosition : Qt.vector3d(0, 0, 0) orientation: targetNode ? targetNode.orientation : Node.LeftHanded @@ -57,6 +59,7 @@ Node { : Qt.rgba(1, 0, 0, 1) view3D: moveGizmo.view3D active: moveGizmo.visible + dragHelper: moveGizmo.dragHelper onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() @@ -70,6 +73,7 @@ Node { : Qt.rgba(0, 0.6, 0, 1) view3D: moveGizmo.view3D active: moveGizmo.visible + dragHelper: moveGizmo.dragHelper onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() @@ -83,6 +87,7 @@ Node { : Qt.rgba(0, 0, 1, 1) view3D: moveGizmo.view3D active: moveGizmo.visible + dragHelper: moveGizmo.dragHelper onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() @@ -100,6 +105,7 @@ Node { : Qt.rgba(1, 0, 0, 1) view3D: moveGizmo.view3D active: moveGizmo.visible + dragHelper: moveGizmo.dragHelper onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() @@ -117,6 +123,7 @@ Node { : Qt.rgba(0, 0.6, 0, 1) view3D: moveGizmo.view3D active: moveGizmo.visible + dragHelper: moveGizmo.dragHelper onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() @@ -134,6 +141,7 @@ Node { : Qt.rgba(0, 0, 1, 1) view3D: moveGizmo.view3D active: moveGizmo.visible + dragHelper: moveGizmo.dragHelper onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() @@ -152,6 +160,7 @@ Node { view3D: moveGizmo.view3D active: moveGizmo.visible + dragHelper: moveGizmo.dragHelper onPositionCommit: moveGizmo.positionCommit() onPositionMove: moveGizmo.positionMove() diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarDraggable.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarDraggable.qml index 935175054e7..5c9ebe32700 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarDraggable.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarDraggable.qml @@ -36,11 +36,12 @@ Model { property Node targetNode: null property bool dragging: mouseArea.dragging property bool active: false + property MouseArea3D dragHelper: null readonly property bool hovering: mouseArea.hovering - property var _pointerPosPressed - property var _targetStartPos + property vector3d _pointerPosPressed + property vector3d _targetStartPos signal pressed(var mouseArea) signal dragged(var mouseArea, vector3d sceneRelativeDistance) @@ -62,7 +63,7 @@ Model { if (!targetNode) return; - _pointerPosPressed = mouseArea.mapPositionToScene(scenePos); + _pointerPosPressed = mouseArea.dragHelper.mapPositionToScene(scenePos); if (targetNode.orientation === Node.RightHanded) _pointerPosPressed.z = -_pointerPosPressed.z; var sp = targetNode.scenePosition; @@ -72,7 +73,7 @@ Model { function calcRelativeDistance(mouseArea, scenePos) { - var scenePointerPos = mouseArea.mapPositionToScene(scenePos); + var scenePointerPos = mouseArea.dragHelper.mapPositionToScene(scenePos); if (targetNode.orientation === Node.RightHanded) scenePointerPos.z = -scenePointerPos.z; return scenePointerPos.minus(_pointerPosPressed); @@ -103,6 +104,8 @@ Model { height: 120 grabsMouse: targetNode active: rootModel.active + dragHelper: rootModel.dragHelper + onPressed: rootModel.handlePressed(mouseArea, scenePos) onDragged: rootModel.handleDragged(mouseArea, scenePos) onReleased: rootModel.handleReleased(mouseArea, scenePos) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarScaleHandle.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarScaleHandle.qml index dfdfb7c1969..6a9881756f0 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarScaleHandle.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/PlanarScaleHandle.qml @@ -36,7 +36,7 @@ PlanarDraggable { signal scaleCommit() signal scaleChange() - property var _startScale + property vector3d _startScale onPressed: { // Recreate vector so we don't follow the changes in targetNode.sceneScale diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/RotateGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/RotateGizmo.qml index f481f7f4359..99e27332af8 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/RotateGizmo.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/RotateGizmo.qml @@ -36,6 +36,7 @@ Node { property bool globalOrientation: true readonly property bool dragging: cameraRing.dragging || rotRingX.dragging || rotRingY.dragging || rotRingZ.dragging + property MouseArea3D dragHelper: null property real currentAngle property point currentMousePos @@ -88,6 +89,7 @@ Node { priority: 40 view3D: rotateGizmo.view3D active: rotateGizmo.visible + dragHelper: rotateGizmo.dragHelper onRotateCommit: rotateGizmo.rotateCommit() onRotateChange: rotateGizmo.rotateChange() @@ -107,6 +109,7 @@ Node { priority: 30 view3D: rotateGizmo.view3D active: rotateGizmo.visible + dragHelper: rotateGizmo.dragHelper onRotateCommit: rotateGizmo.rotateCommit() onRotateChange: rotateGizmo.rotateChange() @@ -126,6 +129,7 @@ Node { priority: 20 view3D: rotateGizmo.view3D active: rotateGizmo.visible + dragHelper: rotateGizmo.dragHelper onRotateCommit: rotateGizmo.rotateCommit() onRotateChange: rotateGizmo.rotateChange() @@ -145,6 +149,7 @@ Node { priority: 10 view3D: rotateGizmo.view3D active: rotateGizmo.visible + dragHelper: rotateGizmo.dragHelper onRotateCommit: rotateGizmo.rotateCommit() onRotateChange: rotateGizmo.rotateChange() @@ -226,6 +231,8 @@ Node { circlePickArea: Qt.point(25, 50) grabsMouse: rotateGizmo.targetNode active: rotateGizmo.visible + dragHelper: rotateGizmo.dragHelper + onPressed: freeRotator.handlePressed(screenPos) onDragged: freeRotator.handleDragged(screenPos) onReleased: freeRotator.handleReleased(screenPos) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/RotateRing.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/RotateRing.qml index a026b49ba4c..393400c6923 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/RotateRing.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/RotateRing.qml @@ -39,6 +39,7 @@ Model { property alias priority: mouseAreaMain.priority property real currentAngle property point currentMousePos + property MouseArea3D dragHelper: null property vector3d _pointerPosPressed property vector3d _targetPosOnScreen @@ -132,6 +133,8 @@ Model { active: rotateRing.active pickNode: pickModel minAngle: 0.05 + dragHelper: rotateRing.dragHelper + onPressed: rotateRing.handlePressed(screenPos, angle) onDragged: rotateRing.handleDragged(screenPos) onReleased: rotateRing.handleReleased(screenPos) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleGizmo.qml index 5f4a6d1641f..2f2508538f4 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleGizmo.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleGizmo.qml @@ -37,6 +37,7 @@ Node { readonly property bool dragging: scaleRodX.dragging || scaleRodY.dragging || scaleRodZ.dragging || planeX.dragging || planeY.dragging || planeZ.dragging || centerMouseArea.dragging + property MouseArea3D dragHelper: null position: targetNode ? targetNode.scenePosition : Qt.vector3d(0, 0, 0) orientation: targetNode ? targetNode.orientation : Node.LeftHanded @@ -58,6 +59,7 @@ Node { view3D: scaleGizmo.view3D active: scaleGizmo.visible globalOrientation: scaleGizmo.globalOrientation + dragHelper: scaleGizmo.dragHelper onScaleCommit: scaleGizmo.scaleCommit() onScaleChange: scaleGizmo.scaleChange() @@ -72,6 +74,7 @@ Node { view3D: scaleGizmo.view3D active: scaleGizmo.visible globalOrientation: scaleGizmo.globalOrientation + dragHelper: scaleGizmo.dragHelper onScaleCommit: scaleGizmo.scaleCommit() onScaleChange: scaleGizmo.scaleChange() @@ -86,6 +89,7 @@ Node { view3D: scaleGizmo.view3D active: scaleGizmo.visible globalOrientation: scaleGizmo.globalOrientation + dragHelper: scaleGizmo.dragHelper onScaleCommit: scaleGizmo.scaleCommit() onScaleChange: scaleGizmo.scaleChange() @@ -104,6 +108,7 @@ Node { view3D: scaleGizmo.view3D active: scaleGizmo.visible globalOrientation: scaleGizmo.globalOrientation + dragHelper: scaleGizmo.dragHelper onScaleCommit: scaleGizmo.scaleCommit() onScaleChange: scaleGizmo.scaleChange() @@ -122,6 +127,7 @@ Node { view3D: scaleGizmo.view3D active: scaleGizmo.visible globalOrientation: scaleGizmo.globalOrientation + dragHelper: scaleGizmo.dragHelper onScaleCommit: scaleGizmo.scaleCommit() onScaleChange: scaleGizmo.scaleChange() @@ -140,6 +146,7 @@ Node { view3D: scaleGizmo.view3D active: scaleGizmo.visible globalOrientation: scaleGizmo.globalOrientation + dragHelper: scaleGizmo.dragHelper onScaleCommit: scaleGizmo.scaleCommit() onScaleChange: scaleGizmo.scaleChange() @@ -171,15 +178,16 @@ Node { grabsMouse: scaleGizmo.targetNode priority: 1 active: scaleGizmo.visible + dragHelper: scaleGizmo.dragHelper - property var _startScale - property var _startScreenPos + property vector3d _startScale + property point _startScreenPos function localScale(screenPos) { var yDelta = screenPos.y - _startScreenPos.y; if (yDelta === 0) - return; + return _startScale; var scaler = 1.0 + (yDelta * 0.025); if (scaler === 0) scaler = 0.0001; @@ -203,7 +211,6 @@ Node { onDragged: { if (!scaleGizmo.targetNode) return; - scaleGizmo.targetNode.scale = localScale(screenPos); scaleGizmo.scaleChange(); } diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleRod.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleRod.qml index 85fc39f900e..231a39f46f8 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleRod.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/ScaleRod.qml @@ -36,7 +36,7 @@ DirectionalDraggable { signal scaleCommit() signal scaleChange() - property var _startScale + property vector3d _startScale Model { source: "#Cube" diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp index 605a3dd08f6..0ffebc72463 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp @@ -148,16 +148,19 @@ void CameraGeometry::fillVertexData(QByteArray &vertexData, QByteArray &indexDat auto dataPtr = reinterpret_cast(vertexData.data()); auto indexPtr = reinterpret_cast(indexData.data()); + QMatrix4x4 m; QSSGRenderCamera *camera = m_camera->cameraNode(); - if (qobject_cast(m_camera)) { - // For some reason ortho cameras show double what projection suggests, - // so give them doubled viewport to match visualization to actual camera view - camera->calculateProjection(QRectF(0, 0, m_viewPortRect.width() * 2.0, - m_viewPortRect.height() * 2.0)); - } else { - camera->calculateProjection(m_viewPortRect); + if (camera) { + if (qobject_cast(m_camera)) { + // For some reason ortho cameras show double what projection suggests, + // so give them doubled viewport to match visualization to actual camera view + camera->calculateProjection(QRectF(0, 0, m_viewPortRect.width() * 2.0, + m_viewPortRect.height() * 2.0)); + } else { + camera->calculateProjection(m_viewPortRect); + } + m = camera->projection.inverted(); } - const QMatrix4x4 m = camera->projection.inverted(); const QVector3D farTopLeft = m * QVector3D(1.f, -1.f, 1.f); const QVector3D farBottomRight = m * QVector3D(-1.f, 1.f, 1.f); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp index 84e28ac4ece..74a74d4ba6e 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp @@ -222,6 +222,15 @@ QQuick3DNode *GeneralHelper::resolvePick(QQuick3DNode *pickNode) return pickNode; } +bool GeneralHelper::isMacOS() const +{ +#ifdef Q_OS_MACOS + return true; +#else + return false; +#endif +} + } } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h index 890b824aa69..92dc30e1828 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h @@ -45,6 +45,7 @@ namespace Internal { class GeneralHelper : public QObject { Q_OBJECT + Q_PROPERTY(bool isMacOS READ isMacOS CONSTANT) public: GeneralHelper(); @@ -70,6 +71,8 @@ public: Q_INVOKABLE QQuick3DNode *resolvePick(QQuick3DNode *pickNode); + bool isMacOS() const; + signals: void overlayUpdateNeeded(); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp index 71a67a95772..a0f54d1cc0f 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp @@ -83,6 +83,11 @@ QQuick3DNode *MouseArea3D::pickNode() const return m_pickNode; } +MouseArea3D *MouseArea3D::dragHelper() const +{ + return m_dragHelper; +} + qreal MouseArea3D::x() const { return m_x; @@ -179,6 +184,15 @@ void MouseArea3D::setPickNode(QQuick3DNode *node) emit pickNodeChanged(); } +void MouseArea3D::setDragHelper(MouseArea3D *dragHelper) +{ + if (m_dragHelper == dragHelper) + return; + + m_dragHelper = dragHelper; + emit dragHelperChanged(); +} + void MouseArea3D::setX(qreal x) { if (qFuzzyCompare(m_x, x)) @@ -344,6 +358,11 @@ qreal QmlDesigner::Internal::MouseArea3D::getNewRotationAngle( QQuick3DNode *node, const QVector3D &pressPos, const QVector3D ¤tPos, const QVector3D &nodePos, qreal prevAngle, bool trackBall) { + const QVector3D dragVector = currentPos - pressPos; + + if (dragVector.length() < 0.001f) + return prevAngle; + // Get camera to node direction in node orientation QVector3D cameraToNodeDir = getCameraToNodeDir(node); if (trackBall) { @@ -433,19 +452,22 @@ void MouseArea3D::applyFreeRotation(QQuick3DNode *node, const QVector3D &startRo node->rotate(degrees, finalAxis, QQuick3DNode::SceneSpace); } -QVector3D MouseArea3D::getMousePosInPlane(const QPointF &mousePosInView) const +QVector3D MouseArea3D::getMousePosInPlane(const MouseArea3D *helper, + const QPointF &mousePosInView) const { + if (!helper) + helper = this; const QVector3D mousePos1(float(mousePosInView.x()), float(mousePosInView.y()), 0); const QVector3D mousePos2(float(mousePosInView.x()), float(mousePosInView.y()), 1); const QVector3D rayPos0 = m_view3D->mapTo3DScene(mousePos1); const QVector3D rayPos1 = m_view3D->mapTo3DScene(mousePos2); - const QVector3D globalPlanePosition = mapPositionToScene(QVector3D(0, 0, 0)); + const QVector3D globalPlanePosition = helper->mapPositionToScene(QVector3D(0, 0, 0)); const QVector3D intersectGlobalPos = rayIntersectsPlane(rayPos0, rayPos1, globalPlanePosition, forward()); if (qFuzzyCompare(intersectGlobalPos.z(), -1)) return intersectGlobalPos; - return mapPositionFromScene(intersectGlobalPos); + return helper->mapPositionFromScene(intersectGlobalPos); } bool MouseArea3D::eventFilter(QObject *, QEvent *event) @@ -505,7 +527,13 @@ bool MouseArea3D::eventFilter(QObject *, QEvent *event) case QEvent::MouseButtonPress: { auto const mouseEvent = static_cast(event); if (mouseEvent->button() == Qt::LeftButton) { - m_mousePosInPlane = getMousePosInPlane(mouseEvent->pos()); + // Reset drag helper area to global transform of this area + if (m_dragHelper) { + m_dragHelper->setPosition(scenePosition()); + m_dragHelper->setRotation(sceneRotation()); + m_dragHelper->setScale(sceneScale()); + } + m_mousePosInPlane = getMousePosInPlane(m_dragHelper, mouseEvent->pos()); if (mouseOnTopOfMouseArea(m_mousePosInPlane, mouseEvent->pos())) { setDragging(true); emit pressed(m_mousePosInPlane, mouseEvent->pos(), pickAngle); @@ -527,7 +555,7 @@ bool MouseArea3D::eventFilter(QObject *, QEvent *event) auto const mouseEvent = static_cast(event); if (mouseEvent->button() == Qt::LeftButton) { if (m_dragging) { - QVector3D mousePosInPlane = getMousePosInPlane(mouseEvent->pos()); + QVector3D mousePosInPlane = getMousePosInPlane(m_dragHelper, mouseEvent->pos()); if (qFuzzyCompare(mousePosInPlane.z(), -1)) mousePosInPlane = m_mousePosInPlane; setDragging(false); @@ -554,7 +582,8 @@ bool MouseArea3D::eventFilter(QObject *, QEvent *event) case QEvent::MouseMove: case QEvent::HoverMove: { auto const mouseEvent = static_cast(event); - const QVector3D mousePosInPlane = getMousePosInPlane(mouseEvent->pos()); + const QVector3D mousePosInPlane = getMousePosInPlane(m_dragging ? m_dragHelper : this, + mouseEvent->pos()); const bool hasMouse = mouseOnTopOfMouseArea(mousePosInPlane, mouseEvent->pos()); setHovering(hasMouse); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.h index c824b92969d..2d8dbc14416 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.h @@ -55,6 +55,7 @@ class MouseArea3D : public QQuick3DNode Q_PROPERTY(QPointF circlePickArea READ circlePickArea WRITE setCirclePickArea NOTIFY circlePickAreaChanged) Q_PROPERTY(qreal minAngle READ minAngle WRITE setMinAngle NOTIFY minAngleChanged) Q_PROPERTY(QQuick3DNode *pickNode READ pickNode WRITE setPickNode NOTIFY pickNodeChanged) + Q_PROPERTY(MouseArea3D *dragHelper READ dragHelper WRITE setDragHelper NOTIFY dragHelperChanged) Q_INTERFACES(QQmlParserStatus) @@ -76,6 +77,7 @@ public: QPointF circlePickArea() const; qreal minAngle() const; QQuick3DNode *pickNode() const; + MouseArea3D *dragHelper() const; static qreal mouseDragMultiplier() { return .02; } @@ -86,6 +88,7 @@ public slots: void setCirclePickArea(const QPointF &pickArea); void setMinAngle(qreal angle); void setPickNode(QQuick3DNode *node); + void setDragHelper(MouseArea3D *dragHelper); void setX(qreal x); void setY(qreal y); @@ -126,6 +129,7 @@ signals: void circlePickAreaChanged(); void minAngleChanged(); void pickNodeChanged(); + void dragHelperChanged(); // angle parameter is only set if circlePickArea is specified void pressed(const QVector3D &scenePos, const QPoint &screenPos, qreal angle); @@ -156,7 +160,7 @@ private: bool m_dragging = false; bool m_active = false; - QVector3D getMousePosInPlane(const QPointF &mousePosInView) const; + QVector3D getMousePosInPlane(const MouseArea3D *helper, const QPointF &mousePosInView) const; static MouseArea3D *s_mouseGrab; bool m_grabsMouse = false; @@ -164,6 +168,7 @@ private: QPointF m_circlePickArea; qreal m_minAngle = 0.; QQuick3DNode *m_pickNode = nullptr; + MouseArea3D *m_dragHelper = nullptr; }; } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp index 17b101326e9..910501a9e4f 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp @@ -98,6 +98,10 @@ void SelectionBoxGeometry::setTargetNode(QQuick3DNode *targetNode) QObject::connect(model, &QQuick3DModel::geometryChanged, this, &SelectionBoxGeometry::update, Qt::QueuedConnection); } + if (m_targetNode) { + QObject::connect(m_targetNode, &QQuick3DNode::parentChanged, + this, &SelectionBoxGeometry::update, Qt::QueuedConnection); + } emit targetNodeChanged(); update(); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp index d19c0faea46..5f277bf6bb6 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp @@ -332,7 +332,11 @@ void NodeInstanceServer::clearScene(const ClearSceneCommand &/*command*/) m_fileUrl.clear(); } -void NodeInstanceServer::change3DView(const Change3DViewCommand &/*command*/) +void NodeInstanceServer::update3DViewState(const Update3dViewStateCommand &/*command*/) +{ +} + +void NodeInstanceServer::enable3DView(const Enable3DViewCommand &/*command*/) { } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h index c369882b419..861b674af9f 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h @@ -101,7 +101,8 @@ public: void changeIds(const ChangeIdsCommand &command) override; void createScene(const CreateSceneCommand &command) override; void clearScene(const ClearSceneCommand &command) override; - void change3DView(const Change3DViewCommand &command) override; + void update3DViewState(const Update3dViewStateCommand &command) override; + void enable3DView(const Enable3DViewCommand &command) override; void removeInstances(const RemoveInstancesCommand &command) override; void removeProperties(const RemovePropertiesCommand &command) override; void reparentInstances(const ReparentInstancesCommand &command) override; @@ -155,7 +156,7 @@ public slots: void emitParentChanged(QObject *child); protected: - QList createInstances(const QVector &container); + virtual QList createInstances(const QVector &container); void reparentInstances(const QVector &containerVector); Internal::ChildrenChangeEventFilter *childrenChangeEventFilter(); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index 6cdd9357951..e65b1b4b2da 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -40,7 +40,8 @@ #include "changefileurlcommand.h" #include "clearscenecommand.h" #include "reparentinstancescommand.h" -#include "change3dviewcommand.h" +#include "update3dviewstatecommand.h" +#include "enable3dviewcommand.h" #include "changevaluescommand.h" #include "changebindingscommand.h" #include "changeidscommand.h" @@ -59,7 +60,7 @@ #include "tokencommand.h" #include "removesharedmemorycommand.h" #include "objectnodeinstance.h" -#include +#include "drop3dlibraryitemcommand.h" #include "dummycontextobject.h" #include "../editor3d/generalhelper.h" @@ -119,7 +120,7 @@ QObject *Qt5InformationNodeInstanceServer::createEditView3D(QQmlEngine *engine) QWindow *window = qobject_cast(component.create()); if (!window) { - qWarning() << "Could not create edit view" << component.errors(); + qWarning() << "Could not create edit view 3D: " << component.errors(); return nullptr; } @@ -130,8 +131,6 @@ QObject *Qt5InformationNodeInstanceServer::createEditView3D(QQmlEngine *engine) this, SLOT(handleObjectPropertyCommit(QVariant, QVariant))); QObject::connect(window, SIGNAL(changeObjectProperty(QVariant, QVariant)), this, SLOT(handleObjectPropertyChange(QVariant, QVariant))); - QObject::connect(window, SIGNAL(activeChanged()), - this, SLOT(handleActiveChanged())); QObject::connect(&m_propertyChangeTimer, &QTimer::timeout, this, &Qt5InformationNodeInstanceServer::handleObjectPropertyChangeTimeout); QObject::connect(&m_selectionChangeTimer, &QTimer::timeout, @@ -150,7 +149,7 @@ QObject *Qt5InformationNodeInstanceServer::createEditView3D(QQmlEngine *engine) return window; } -// The selection has changed in the 3D edit view. Empty list indicates selection is cleared. +// The selection has changed in the edit view 3D. Empty list indicates selection is cleared. void Qt5InformationNodeInstanceServer::handleSelectionChanged(const QVariant &objs) { QList instanceList; @@ -231,65 +230,6 @@ void Qt5InformationNodeInstanceServer::modifyVariantValue( } } -void Qt5InformationNodeInstanceServer::showEditView(const QPoint &pos, const QSize &size) -{ - m_blockViewActivate = false; - auto window = qobject_cast(m_editView3D); - if (window) { - activateEditView(); - window->setPosition(pos); - window->resize(size); - } -} - -void Qt5InformationNodeInstanceServer::hideEditView() -{ - m_blockViewActivate = true; - auto window = qobject_cast(m_editView3D); - if (window) - window->hide(); -} - -void Qt5InformationNodeInstanceServer::activateEditView() -{ - auto window = qobject_cast(m_editView3D); - if (window) { - Qt::WindowFlags flags = window->flags(); - -#ifdef Q_OS_MACOS - window->setFlags(Qt::Popup); - window->show(); - window->setFlags(flags); -#else - window->raise(); - window->setFlags(flags | Qt::WindowStaysOnTopHint); - window->show(); - - window->requestActivate(); - window->raise(); - window->setFlags(flags); -#endif - } -} - -void Qt5InformationNodeInstanceServer::moveEditView(const QPoint &pos) -{ - auto window = qobject_cast(m_editView3D); - if (window) { - activateEditView(); - window->setPosition(pos); - } -} - -void Qt5InformationNodeInstanceServer::resizeEditView(const QSize &size) -{ - auto window = qobject_cast(m_editView3D); - if (window) { - activateEditView(); - window->resize(size); - } -} - void Qt5InformationNodeInstanceServer::handleObjectPropertyCommit(const QVariant &object, const QVariant &propName) { @@ -324,14 +264,6 @@ void Qt5InformationNodeInstanceServer::updateViewPortRect() viewPortProperty.write(viewPortrect); } -void Qt5InformationNodeInstanceServer::handleActiveChanged() -{ - if (m_blockViewActivate) - return; - - activateEditView(); -} - Qt5InformationNodeInstanceServer::Qt5InformationNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) : Qt5NodeInstanceServer(nodeInstanceClient) { @@ -409,6 +341,17 @@ void Qt5InformationNodeInstanceServer::modifyProperties( nodeInstanceClient()->valuesModified(createValuesModifiedCommand(properties)); } +QList Qt5InformationNodeInstanceServer::createInstances( + const QVector &container) +{ + const auto createdInstances = NodeInstanceServer::createInstances(container); + + if (m_editView3D) + createCameraAndLightGizmos(createdInstances); + + return createdInstances; +} + void Qt5InformationNodeInstanceServer::handleObjectPropertyChangeTimeout() { modifyVariantValue(m_changedNode, m_changedProperty, @@ -448,16 +391,27 @@ QObject *Qt5InformationNodeInstanceServer::findRootNodeOf3DViewport( return nullptr; } -void Qt5InformationNodeInstanceServer::findCamerasAndLights( - const QList &instanceList, - QObjectList &cameras, QObjectList &lights) const +void Qt5InformationNodeInstanceServer::createCameraAndLightGizmos( + const QList &instanceList) const { + QObjectList cameras; + QObjectList lights; + for (const ServerNodeInstance &instance : instanceList) { if (instance.isSubclassOf("QQuick3DCamera")) cameras << instance.internalObject(); else if (instance.isSubclassOf("QQuick3DAbstractLight")) lights << instance.internalObject(); } + + for (auto &obj : qAsConst(cameras)) { + QMetaObject::invokeMethod(m_editView3D, "addCameraGizmo", + Q_ARG(QVariant, objectToVariant(obj))); + } + for (auto &obj : qAsConst(lights)) { + QMetaObject::invokeMethod(m_editView3D, "addLightGizmo", + Q_ARG(QVariant, objectToVariant(obj))); + } } ServerNodeInstance Qt5InformationNodeInstanceServer::findViewPort( @@ -506,18 +460,7 @@ void Qt5InformationNodeInstanceServer::setup3DEditView(const QList(m_editView3D); + if (window) { + if (command.type() == Update3dViewStateCommand::StateChange) { + if (command.previousStates() & Qt::WindowMinimized) // main window expanded from minimize state + window->show(); + else if (command.currentStates() & Qt::WindowMinimized) // main window minimized + window->hide(); + } else if (command.type() == Update3dViewStateCommand::ActiveChange) { + window->setFlag(Qt::WindowStaysOnTopHint, command.isActive()); + + // main window has a popup open, lower the edit view 3D so that the pop up is visible + if (command.hasPopup()) + window->lower(); + } + } +} + +void Qt5InformationNodeInstanceServer::enable3DView(const Enable3DViewCommand &command) +{ + // TODO: this method is not currently in use as the 3D view is currently enabled by resetting the puppet. + // It should however be implemented here. + + auto window = qobject_cast(m_editView3D); + if (window && !command.isEnable()) { + // TODO: remove the 3D view + } else if (!window && command.isEnable()) { + // TODO: create the 3D view } } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h index 8a0f9837d54..079b811c054 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h @@ -38,12 +38,14 @@ namespace QmlDesigner { class Qt5InformationNodeInstanceServer : public Qt5NodeInstanceServer { Q_OBJECT + public: explicit Qt5InformationNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient); void reparentInstances(const ReparentInstancesCommand &command) override; void clearScene(const ClearSceneCommand &command) override; - void change3DView(const Change3DViewCommand &command) override; + void update3DViewState(const Update3dViewStateCommand &command) override; + void enable3DView(const Enable3DViewCommand &command) override; void createScene(const CreateSceneCommand &command) override; void completeComponent(const CompleteComponentCommand &command) override; void token(const TokenCommand &command) override; @@ -56,7 +58,6 @@ private slots: void handleObjectPropertyCommit(const QVariant &object, const QVariant &propName); void handleObjectPropertyChange(const QVariant &object, const QVariant &propName); void updateViewPortRect(); - void handleActiveChanged(); protected: void collectItemChangesAndSendChangeCommands() override; @@ -67,6 +68,7 @@ protected: bool isDirtyRecursiveForParentInstances(QQuickItem *item) const; void selectInstances(const QList &instanceList); void modifyProperties(const QVector &properties); + QList createInstances(const QVector &container) override; private: void handleObjectPropertyChangeTimeout(); @@ -74,8 +76,7 @@ private: QObject *createEditView3D(QQmlEngine *engine); void setup3DEditView(const QList &instanceList); QObject *findRootNodeOf3DViewport(const QList &instanceList) const; - void findCamerasAndLights( const QList &instanceList, - QObjectList &cameras, QObjectList &lights) const; + void createCameraAndLightGizmos(const QList &instanceList) const; ServerNodeInstance findViewPort(const QList &instanceList); QVector vectorToPropertyValue(const ServerNodeInstance &instance, const PropertyName &propertyName, @@ -84,12 +85,6 @@ private: const PropertyName &propertyName, ValuesModifiedCommand::TransactionOption option); - void showEditView(const QPoint &pos, const QSize &size); - void hideEditView(); - void activateEditView(); - void moveEditView(const QPoint &pos); - void resizeEditView(const QSize &size); - QObject *m_editView3D = nullptr; QSet m_parentChangedSet; QList m_completedComponentList; @@ -99,7 +94,6 @@ private: QVariant m_changedNode; PropertyName m_changedProperty; ServerNodeInstance m_viewPortInstance; - bool m_blockViewActivate = false; QObject *m_rootNode = nullptr; ChangeSelectionCommand m_pendingSelectionChangeCommand; }; diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/EditableListView.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/EditableListView.qml index 050f8f45ed3..5b0a61d5c0c 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/EditableListView.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/EditableListView.qml @@ -55,8 +55,6 @@ Rectangle { border.color: StudioTheme.Values.themeControlOutline border.width: StudioTheme.Values.border - property int numVisibleItems: myRepeater.count - Layout.preferredWidth: StudioTheme.Values.height * 10 Layout.preferredHeight: myColumn.height @@ -158,6 +156,13 @@ Rectangle { } } + Item { + id: dummyItem + visible: myRepeater.count === 0 + width: StudioTheme.Values.height + height: StudioTheme.Values.height + } + Row { id: row spacing: -StudioTheme.Values.border @@ -175,7 +180,7 @@ Rectangle { StudioControls.AbstractButton { buttonIcon: "+" iconFont: StudioTheme.Constants.font - enabled: !myRepeater.dirty + enabled: !myRepeater.dirty && !(editableListView.backendValue.isInModel && !editableListView.backendValue.isIdList) onClicked: { var idx = myRepeater.localModel.push("") - 1 myRepeater.model = myRepeater.localModel // trigger on change handler @@ -187,7 +192,7 @@ Rectangle { StudioControls.AbstractButton { buttonIcon: "-" iconFont: StudioTheme.Constants.font - enabled: myRepeater.model.length + enabled: myRepeater.model.length && !(editableListView.backendValue.isInModel && !editableListView.backendValue.isIdList) onClicked: { var lastItem = myColumn.currentIndex === myRepeater.localModel.length - 1 if (myColumn.currentItem.initialModelData === "") { diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index 14b5ef2050e..d883496e6cc 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -768,7 +768,7 @@ QProcess *AndroidManager::runAdbCommandDetached(const QStringList &args, QString { std::unique_ptr p(new QProcess); const QString adb = AndroidConfigurations::currentConfig().adbToolPath().toString(); - qCDebug(androidManagerLog) << "Running command:" << adb << args.join(' '); + qCDebug(androidManagerLog) << "Running command (async):" << CommandLine(adb, args).toUserOutput(); p->start(adb, args); if (p->waitForStarted(500) && p->state() == QProcess::Running) { if (deleteOnFinish) { @@ -779,7 +779,9 @@ QProcess *AndroidManager::runAdbCommandDetached(const QStringList &args, QString } QString errorStr = QString::fromUtf8(p->readAllStandardError()); - qCDebug(androidManagerLog) << "Running command failed" << adb << args.join(' ') << errorStr; + qCDebug(androidManagerLog) << "Running command (async) failed:" + << CommandLine(adb, args).toUserOutput() + << "Output:" << errorStr; if (err) *err = errorStr; return nullptr; @@ -791,12 +793,12 @@ SdkToolResult AndroidManager::runCommand(const CommandLine &command, Android::SdkToolResult cmdResult; Utils::SynchronousProcess cmdProc; cmdProc.setTimeoutS(timeoutS); - qCDebug(androidManagerLog) << "Running command: " << command.toUserOutput(); + qCDebug(androidManagerLog) << "Running command (sync):" << command.toUserOutput(); SynchronousProcessResponse response = cmdProc.run(command, writeData); cmdResult.m_stdOut = response.stdOut().trimmed(); cmdResult.m_stdErr = response.stdErr().trimmed(); cmdResult.m_success = response.result == Utils::SynchronousProcessResponse::Finished; - qCDebug(androidManagerLog) << "Running command finshed:" << command.toUserOutput() + qCDebug(androidManagerLog) << "Running command (sync) finshed:" << command.toUserOutput() << "Success:" << cmdResult.m_success << "Output:" << response.allRawOutput(); if (!cmdResult.success()) diff --git a/src/plugins/android/androidrunnerworker.cpp b/src/plugins/android/androidrunnerworker.cpp index c2464ee218e..6223d877927 100644 --- a/src/plugins/android/androidrunnerworker.cpp +++ b/src/plugins/android/androidrunnerworker.cpp @@ -596,7 +596,7 @@ void AndroidRunnerWorker::handleJdbWaiting() QStringList jdbArgs("-connect"); jdbArgs << QString("com.sun.jdi.SocketAttach:hostname=localhost,port=%1") .arg(m_localJdbServerPort.toString()); - qCDebug(androidRunWorkerLog) << "Starting JDB:" << jdbPath << jdbArgs.join(' '); + qCDebug(androidRunWorkerLog) << "Starting JDB:" << CommandLine(jdbPath, jdbArgs).toUserOutput(); std::unique_ptr jdbProcess(new QProcess, &deleter); jdbProcess->setProcessChannelMode(QProcess::MergedChannels); jdbProcess->start(jdbPath.toString(), jdbArgs); diff --git a/src/plugins/android/androidsdkmanager.cpp b/src/plugins/android/androidsdkmanager.cpp index 5fefc440969..022a2c42a46 100644 --- a/src/plugins/android/androidsdkmanager.cpp +++ b/src/plugins/android/androidsdkmanager.cpp @@ -132,6 +132,8 @@ void watcherDeleter(QFutureWatcher *watcher) static bool sdkManagerCommand(const AndroidConfig &config, const QStringList &args, QString *output, int timeout = sdkManagerCmdTimeoutS) { + qCDebug(sdkManagerLog) << "Running SDK Manager command (sync):" + << CommandLine(config.sdkManagerToolPath(), args).toUserOutput(); SynchronousProcess proc; proc.setProcessEnvironment(AndroidConfigurations::toolsEnvironment(config)); proc.setTimeoutS(timeout); @@ -153,6 +155,8 @@ static void sdkManagerCommand(const AndroidConfig &config, const QStringList &ar AndroidSdkManager::OperationOutput &output, double progressQuota, bool interruptible = true, int timeout = sdkManagerOperationTimeoutS) { + qCDebug(sdkManagerLog) << "Running SDK Manager command (async):" + << CommandLine(config.sdkManagerToolPath(), args).toUserOutput(); int offset = fi.progressValue(); SynchronousProcess proc; proc.setProcessEnvironment(AndroidConfigurations::toolsEnvironment(config)); diff --git a/src/plugins/boot2qt/qdbrunconfiguration.cpp b/src/plugins/boot2qt/qdbrunconfiguration.cpp index 97aa4a01e57..edf8a82c50c 100644 --- a/src/plugins/boot2qt/qdbrunconfiguration.cpp +++ b/src/plugins/boot2qt/qdbrunconfiguration.cpp @@ -86,15 +86,7 @@ QdbRunConfiguration::QdbRunConfiguration(Target *target, Core::Id id) addAspect(); addAspect(this); - setUpdater([this, target, exeAspect, symbolsAspect] { - const BuildTargetInfo bti = buildTargetInfo(); - const FilePath localExecutable = bti.targetFilePath; - const DeployableFile depFile = target->deploymentData().deployableForLocalFile(localExecutable); - - exeAspect->setExecutable(FilePath::fromString(depFile.remoteFilePath())); - symbolsAspect->setFilePath(localExecutable); - }); - + setUpdater([this] { updateTargetInformation(); }); connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update); setDefaultDisplayName(tr("Run on Boot2Qt Device")); @@ -110,6 +102,21 @@ Tasks QdbRunConfiguration::checkForIssues() const return tasks; } +void QdbRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &) +{ + updateTargetInformation(); +} + +void QdbRunConfiguration::updateTargetInformation() +{ + const BuildTargetInfo bti = buildTargetInfo(); + const FilePath localExecutable = bti.targetFilePath; + const DeployableFile depFile = target()->deploymentData().deployableForLocalFile(localExecutable); + + aspect()->setExecutable(FilePath::fromString(depFile.remoteFilePath())); + aspect()->setFilePath(localExecutable); +} + QString QdbRunConfiguration::defaultDisplayName() const { return RunConfigurationFactory::decoratedTargetName(buildKey(), target()); diff --git a/src/plugins/boot2qt/qdbrunconfiguration.h b/src/plugins/boot2qt/qdbrunconfiguration.h index f1a0bf0443d..72e5fa2eb42 100644 --- a/src/plugins/boot2qt/qdbrunconfiguration.h +++ b/src/plugins/boot2qt/qdbrunconfiguration.h @@ -47,7 +47,8 @@ public: private: ProjectExplorer::Tasks checkForIssues() const override; - + void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override; + void updateTargetInformation(); QString defaultDisplayName() const; }; diff --git a/src/plugins/coreplugin/coreconstants.h b/src/plugins/coreplugin/coreconstants.h index 89cb41d98b7..fd817379579 100644 --- a/src/plugins/coreplugin/coreconstants.h +++ b/src/plugins/coreplugin/coreconstants.h @@ -125,8 +125,6 @@ const char CLOSE_ALTERNATIVE[] = "QtCreator.Close_Alternative"; // temporary const char CLOSEALL[] = "QtCreator.CloseAll"; const char CLOSEOTHERS[] = "QtCreator.CloseOthers"; const char CLOSEALLEXCEPTVISIBLE[] = "QtCreator.CloseAllExceptVisible"; -const char GOTONEXT[] = "QtCreator.GotoNext"; -const char GOTOPREV[] = "QtCreator.GotoPrevious"; const char GOTONEXTINHISTORY[] = "QtCreator.GotoNextInHistory"; const char GOTOPREVINHISTORY[] = "QtCreator.GotoPreviousInHistory"; const char GO_BACK[] = "QtCreator.GoBack"; diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index 0cb75e3af1d..67d8a2bbffe 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -164,6 +164,8 @@ signals: void coreAboutToClose(); void contextAboutToChange(const QList &context); void contextChanged(const Core::Context &context); + void windowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates); + void windowActivationChanged(bool isActive, bool hasPopup); public: /* internal use */ diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 94e5aa78fea..da53dd75287 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -201,6 +201,19 @@ MainWindow::MainWindow() this, &MainWindow::openDroppedFiles); } +// Edit View 3D needs to know when the main windows's state or activation change +void MainWindow::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::WindowStateChange) { + emit m_coreImpl->windowStateChanged(m_previousWindowStates, windowState()); + m_previousWindowStates = windowState(); + } else if (event->type() == QEvent::ActivationChange) { + auto lastChild = qobject_cast(children().last()); + bool hasPopup = lastChild && lastChild->isActiveWindow(); + emit m_coreImpl->windowActivationChanged(isActiveWindow(), hasPopup); + } +} + NavigationWidget *MainWindow::navigationWidget(Side side) const { return side == Side::Left ? m_leftNavigationWidget : m_rightNavigationWidget; diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index 26dc607cbed..a3a537b231a 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -114,6 +114,7 @@ public slots: protected: void closeEvent(QCloseEvent *event) override; + void changeEvent(QEvent *event) override; private: void openFile(); @@ -192,6 +193,7 @@ private: QToolButton *m_toggleRightSideBarButton = nullptr; QColor m_overrideColor; QList> m_preCloseListeners; + Qt::WindowStates m_previousWindowStates = Qt::WindowNoState; }; } // namespace Internal diff --git a/src/plugins/cpptools/cpptoolsconstants.h b/src/plugins/cpptools/cpptoolsconstants.h index 33667b2ce8f..e4329ff84b4 100644 --- a/src/plugins/cpptools/cpptoolsconstants.h +++ b/src/plugins/cpptools/cpptoolsconstants.h @@ -100,7 +100,7 @@ const char SYMBOLS_FIND_FILTER_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("CppTools", "C // CLANG_VERSION here because it might denote a version that was not yet // released (e.g. 6.0.1, but only 6.0.0 was released). constexpr const char TIDY_DOCUMENTATION_URL_TEMPLATE[] - = "https://releases.llvm.org/8.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/%1.html"; + = "https://releases.llvm.org/8.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/%1.html"; constexpr const char CLAZY_DOCUMENTATION_URL_TEMPLATE[] = "https://github.com/KDE/clazy/blob/master/docs/checks/README-%1.md"; diff --git a/src/plugins/cpptools/cpptoolsreuse.cpp b/src/plugins/cpptools/cpptoolsreuse.cpp index 4769260d54b..4753053cdeb 100644 --- a/src/plugins/cpptools/cpptoolsreuse.cpp +++ b/src/plugins/cpptools/cpptoolsreuse.cpp @@ -355,6 +355,7 @@ static void addBuiltinConfigs(ClangDiagnosticConfigsModel &model) config.setClangOptions({ "-Wall", "-Wextra", + "-Wno-c++98-compat" }); model.appendOrUpdate(config); diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 29defad5739..211ccb67de2 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -1675,11 +1675,11 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor) if (key == "C" || key == "") triggerAction(Core::Constants::REMOVE_CURRENT_SPLIT); else if (key == "N" || key == "") - triggerAction(Core::Constants::GOTONEXT); + triggerAction(Core::Constants::GOTO_NEXT_SPLIT); else if (key == "O" || key == "") keepOnlyWindow(); else if (key == "P" || key == "") - triggerAction(Core::Constants::GOTOPREV); + triggerAction(Core::Constants::GOTO_PREV_SPLIT); else if (key == "S" || key == "") triggerAction(Core::Constants::SPLIT); else if (key == "V" || key == "") diff --git a/src/plugins/languageclient/client.cpp b/src/plugins/languageclient/client.cpp index a05063ef638..4fa092d0dec 100644 --- a/src/plugins/languageclient/client.cpp +++ b/src/plugins/languageclient/client.cpp @@ -818,6 +818,8 @@ bool Client::reset() m_project = nullptr; for (const DocumentUri &uri : m_diagnostics.keys()) removeDiagnostics(uri); + for (TextEditor::TextDocument *document : m_resetAssistProvider.keys()) + resetAssistProviders(document); return true; } diff --git a/src/plugins/projectexplorer/desktoprunconfiguration.cpp b/src/plugins/projectexplorer/desktoprunconfiguration.cpp index e6b3cff4df3..45fb09971f9 100644 --- a/src/plugins/projectexplorer/desktoprunconfiguration.cpp +++ b/src/plugins/projectexplorer/desktoprunconfiguration.cpp @@ -144,8 +144,7 @@ bool DesktopRunConfiguration::fromMap(const QVariantMap &map) if (!RunConfiguration::fromMap(map)) return false; - if (m_kind == Qmake || m_kind == Qbs) - updateTargetInformation(); + updateTargetInformation(); return true; } diff --git a/src/plugins/projectexplorer/projectmacro.cpp b/src/plugins/projectexplorer/projectmacro.cpp index 5d2824f01db..4a6ca945c97 100644 --- a/src/plugins/projectexplorer/projectmacro.cpp +++ b/src/plugins/projectexplorer/projectmacro.cpp @@ -166,12 +166,12 @@ QList Macro::tokenizeLine(const QByteArray &line) const auto begin = normalizedLine.begin(); auto first = std::find(normalizedLine.begin(), normalizedLine.end(), ' '); - auto second = std::find(std::next(first), normalizedLine.end(), ' '); const auto end = normalizedLine.end(); QList tokens; if (first != end) { + auto second = std::find(std::next(first), normalizedLine.end(), ' '); tokens.append(QByteArray(begin, int(std::distance(begin, first)))); std::advance(first, 1); diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp index dced51518b9..651510161c9 100644 --- a/src/plugins/python/pythonutils.cpp +++ b/src/plugins/python/pythonutils.cpp @@ -31,6 +31,7 @@ #include "pythonrunconfiguration.h" #include "pythonsettings.h" +#include #include #include @@ -446,7 +447,16 @@ void PyLSConfigureAssistant::resetEditorInfoBar(TextEditor::TextDocument *docume PyLSConfigureAssistant::PyLSConfigureAssistant(QObject *parent) : QObject(parent) -{} +{ + Core::EditorManager::instance(); + connect(Core::EditorManager::instance(), + &Core::EditorManager::documentClosed, + this, + [this](Core::IDocument *document) { + if (auto textDocument = qobject_cast(document)) + resetEditorInfoBar(textDocument); + }); +} } // namespace Internal } // namespace Python diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt index 1685aeaa792..6d3bca379c0 100644 --- a/src/plugins/qmldesigner/CMakeLists.txt +++ b/src/plugins/qmldesigner/CMakeLists.txt @@ -140,7 +140,8 @@ extend_qtc_plugin(QmlDesigner valueschangedcommand.cpp valueschangedcommand.h changeselectioncommand.cpp changeselectioncommand.h drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h - change3dviewcommand.cpp change3dviewcommand.h + update3dviewstatecommand.cpp update3dviewstatecommand.h + enable3dviewcommand.cpp enable3dviewcommand.h ) extend_qtc_plugin(QmlDesigner @@ -235,7 +236,6 @@ extend_qtc_plugin(QmlDesigner snappinglinecreator.cpp snappinglinecreator.h toolbox.cpp toolbox.h option3daction.cpp option3daction.h - editview3dproxydialog.cpp editview3dproxydialog.h ) extend_qtc_plugin(QmlDesigner diff --git a/src/plugins/qmldesigner/components/bindingeditor/actioneditor.cpp b/src/plugins/qmldesigner/components/bindingeditor/actioneditor.cpp index e21000a1715..65866ad324a 100644 --- a/src/plugins/qmldesigner/components/bindingeditor/actioneditor.cpp +++ b/src/plugins/qmldesigner/components/bindingeditor/actioneditor.cpp @@ -123,7 +123,7 @@ void ActionEditor::updateWindowName() { if (!m_dialog.isNull()) { - m_dialog->setWindowTitle(tr("Action Editor")); + m_dialog->setWindowTitle(tr("Connection Editor")); m_dialog->raise(); } } diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp index 87de1e5074f..1347c76045b 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp @@ -290,7 +290,28 @@ void ConnectionModel::abstractPropertyChanged(const AbstractProperty &abstractPr void ConnectionModel::deleteConnectionByRow(int currentRow) { - signalHandlerPropertyForRow(currentRow).parentModelNode().destroy(); + SignalHandlerProperty targetSignal = signalHandlerPropertyForRow(currentRow); + QmlDesigner::ModelNode node = targetSignal.parentModelNode(); + QList allSignals = node.signalProperties(); + if (allSignals.size() > 1) { + if (allSignals.contains(targetSignal)) + node.removeProperty(targetSignal.name()); + } + else { + node.destroy(); + } +} + +void ConnectionModel::removeRowFromTable(const SignalHandlerProperty &property) +{ + for (int currentRow = 0; currentRow < rowCount(); currentRow++) { + SignalHandlerProperty targetSignal = signalHandlerPropertyForRow(currentRow); + + if (targetSignal == property) { + removeRow(currentRow); + break; + } + } } void ConnectionModel::handleException() diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.h b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.h index 1ae3aa2a255..b60275f6da0 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.h +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.h @@ -63,6 +63,7 @@ public: void abstractPropertyChanged(const AbstractProperty &abstractProperty); void deleteConnectionByRow(int currentRow); + void removeRowFromTable(const SignalHandlerProperty &property); protected: void addModelNode(const ModelNode &modelNode); diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp index 08be13d7d54..0410ccf9089 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp @@ -108,6 +108,8 @@ void ConnectionView::propertiesAboutToBeRemoved(const QList & dynamicPropertiesModel()->bindingRemoved(property.toBindingProperty()); } else if (property.isVariantProperty()) { //### dynamicPropertiesModel->bindingRemoved(property.toVariantProperty()); + } else if (property.isSignalHandlerProperty()) { + connectionModel()->removeRowFromTable(property.toSignalHandlerProperty()); } } } @@ -180,6 +182,11 @@ bool ConnectionView::hasWidget() const return true; } +bool ConnectionView::isWidgetEnabled() +{ + return widgetInfo().widget->isEnabled(); +} + QTableView *ConnectionView::connectionTableView() const { return connectionViewWidget()->connectionTableView(); diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionview.h b/src/plugins/qmldesigner/components/connectioneditor/connectionview.h index 09b653072e3..905fa02a587 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionview.h +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionview.h @@ -74,6 +74,7 @@ public: WidgetInfo widgetInfo() override; bool hasWidget() const override; + bool isWidgetEnabled(); QTableView *connectionTableView() const; QTableView *bindingTableView() const; diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp index 60476903baa..3777de72910 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include @@ -57,11 +58,13 @@ ConnectionViewWidget::ConnectionViewWidget(QWidget *parent) : ui(new Ui::ConnectionViewWidget) { m_actionEditor = new QmlDesigner::ActionEditor(this); + m_deleteShortcut = new QShortcut(this); QObject::connect(m_actionEditor, &QmlDesigner::ActionEditor::accepted, [&]() { if (m_actionEditor->hasModelIndex()) { ConnectionModel *connectionModel = qobject_cast(ui->connectionView->model()); - if (connectionModel->rowCount() > m_actionEditor->modelIndex().row()) + if (connectionModel->connectionView()->isWidgetEnabled() + && (connectionModel->rowCount() > m_actionEditor->modelIndex().row())) { SignalHandlerProperty signalHandler = connectionModel->signalHandlerPropertyForRow(m_actionEditor->modelIndex().row()); @@ -123,6 +126,7 @@ ConnectionViewWidget::~ConnectionViewWidget() { delete m_actionEditor; delete ui; + delete m_deleteShortcut; } void ConnectionViewWidget::setBindingModel(BindingModel *model) @@ -163,7 +167,7 @@ void ConnectionViewWidget::contextMenuEvent(QContextMenuEvent *event) QMenu menu(this); - menu.addAction(tr("Open Action Editor"), [&]() { + menu.addAction(tr("Open Connection Editor"), [&]() { if (index.isValid()) { m_actionEditor->showWidget(mapToGlobal(event->pos()).x(), mapToGlobal(event->pos()).y()); m_actionEditor->setBindingValue(index.data().toString()); @@ -212,6 +216,10 @@ QList ConnectionViewWidget::createToolBarWidgets() connect(buttons.constLast(), &QAbstractButton::clicked, this, &ConnectionViewWidget::removeButtonClicked); connect(this, &ConnectionViewWidget::setEnabledRemoveButton, buttons.constLast(), &QWidget::setEnabled); + m_deleteShortcut->setKey(Qt::Key_Delete); + m_deleteShortcut->setContext(Qt::WidgetWithChildrenShortcut); + connect(m_deleteShortcut, &QShortcut::activated, this, &ConnectionViewWidget::removeButtonClicked); + return buttons; } diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h index 09cc4f6c53f..c1f1271fcac 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h @@ -29,6 +29,7 @@ #include QT_BEGIN_NAMESPACE +class QShortcut; class QToolButton; class QTableView; class QListView; @@ -101,6 +102,7 @@ private: private: Ui::ConnectionViewWidget *ui; QmlDesigner::ActionEditor *m_actionEditor; + QShortcut *m_deleteShortcut; }; } // namespace Internal diff --git a/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.cpp b/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.cpp deleted file mode 100644 index 505eeacd1ff..00000000000 --- a/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "editview3dproxydialog.h" -#include "formeditorview.h" - -#include - -#include - -#include - -#include -#include -#include -#include - -namespace QmlDesigner { - -const int borderOffset = 8; - -static int titleBarHeight() { - return QApplication::style()->pixelMetric(QStyle::PM_TitleBarHeight); -} - -EditView3DProxyDialog::EditView3DProxyDialog(FormEditorView *view) : - QDialog(Core::ICore::dialogParent()) - ,m_formEditorView(view) -{ - setFocusPolicy(Qt::ClickFocus); - setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - - if (Utils::HostOsInfo::isMacHost()) { - setWindowFlag(Qt::Tool); - setAttribute(Qt::WA_MacAlwaysShowToolWindow); - } - - resize(1024, 768); -} - -void EditView3DProxyDialog::invalidate() -{ - if (nodeInstanceView() && isVisible()) - nodeInstanceView()->show3DView(adjustedRect()); -} - -void EditView3DProxyDialog::moveEvent(QMoveEvent *event) -{ - if (nodeInstanceView()) - nodeInstanceView()->move3DView(pos() + QPoint(borderOffset, titleBarHeight() + 2 * borderOffset)); - - QDialog::moveEvent(event); -} - -void EditView3DProxyDialog::closeEvent(QCloseEvent *event) -{ - if (m_formEditorView) { - m_formEditorView->toggle3DViewEnabled(false); - m_formEditorView->setupOption3DAction(); - } - - nodeInstanceView()->hide3DView(); - - QDialog::closeEvent(event); -} - -void EditView3DProxyDialog::hideEvent(QHideEvent *event) -{ - if (m_formEditorView) { - m_formEditorView->toggle3DViewEnabled(false); - m_formEditorView->setupOption3DAction(); - } - - nodeInstanceView()->hide3DView(); - - QDialog::hideEvent(event); -} - -void EditView3DProxyDialog::focusOutEvent(QFocusEvent *event) -{ - if (isVisible()) - showView(); - - QDialog::focusOutEvent(event); -} - -void EditView3DProxyDialog::focusInEvent(QFocusEvent *event) -{ - showView(); - - QDialog::focusInEvent(event); -} - -void EditView3DProxyDialog::resizeEvent(QResizeEvent *event) -{ - if (nodeInstanceView()) - nodeInstanceView()->show3DView(adjustedRect()); - - QDialog::resizeEvent(event); -} - -bool EditView3DProxyDialog::event(QEvent *event) -{ - if (event->type() == QEvent::WindowActivate) { - showView(); - } else if (event->type() == QEvent::NonClientAreaMouseButtonPress) { - auto mouseMoveEvent = static_cast(event); - if (mouseMoveEvent->buttons() & Qt::LeftButton) - hideView(); - } else if (event->type() == QEvent::NonClientAreaMouseButtonRelease) { - auto mouseMoveEvent = static_cast(event); - if (mouseMoveEvent->buttons() & Qt::LeftButton) - showView(); - } - - return QDialog::event(event); -} - -QRect EditView3DProxyDialog::adjustedRect() const -{ - return QRect(pos(), size()).adjusted(borderOffset, - titleBarHeight() + 2 * borderOffset, - -borderOffset, titleBarHeight()); -} - -NodeInstanceView *EditView3DProxyDialog::nodeInstanceView() const -{ - if (m_formEditorView) - return m_formEditorView->nodeInstanceView(); - - return nullptr; -} - -void EditView3DProxyDialog::showView() -{ - if (nodeInstanceView()) - nodeInstanceView()->show3DView(adjustedRect()); -} - -void EditView3DProxyDialog::hideView() -{ - if (nodeInstanceView()) - nodeInstanceView()->hide3DView(); -} - -} //QmlDesigner diff --git a/src/plugins/qmldesigner/components/formeditor/formeditor.pri b/src/plugins/qmldesigner/components/formeditor/formeditor.pri index 15de28f5041..5bff19e664c 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditor.pri +++ b/src/plugins/qmldesigner/components/formeditor/formeditor.pri @@ -1,6 +1,5 @@ VPATH += $$PWD SOURCES += formeditoritem.cpp \ - editview3dproxydialog.cpp \ formeditorview.cpp \ formeditorscene.cpp \ formeditorwidget.cpp \ @@ -41,7 +40,6 @@ SOURCES += formeditoritem.cpp \ option3daction.cpp HEADERS += formeditorscene.h \ - editview3dproxydialog.h \ formeditorwidget.h \ formeditoritem.h \ formeditorview.h \ diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp index 90707a58876..ee7b3f18a9a 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp @@ -24,6 +24,7 @@ ****************************************************************************/ #include "formeditorview.h" +#include "nodeinstanceview.h" #include "selectiontool.h" #include "movetool.h" #include "option3daction.h" @@ -475,8 +476,6 @@ void FormEditorView::instancesCompleted(const QVector &completedNodeL itemNodeList.append(item); } } - if (node.isRootNode()) - formEditorWidget()->invalidate3DEditor(); } currentTool()->instancesCompleted(itemNodeList); } @@ -598,7 +597,7 @@ void FormEditorView::toggle3DViewEnabled(bool enabled) else rootModelNode().setAuxiliaryData("3d-view", false); - formEditorWidget()->set3dEditorVisibility(enabled); + nodeInstanceView()->enable3DView(enabled); } QmlItemNode findRecursiveQmlItemNode(const QmlObjectNode &firstQmlObjectNode) diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp index fdad23a8802..f5970dc0e06 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp @@ -24,7 +24,6 @@ ****************************************************************************/ #include "designeractionmanager.h" -#include "editview3dproxydialog.h" #include "formeditorwidget.h" #include "formeditorscene.h" #include "qmldesignerplugin.h" @@ -174,14 +173,11 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) : fillLayout->addWidget(m_graphicsView.data()); m_graphicsView.data()->setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))))); - - m_editView3DProxyDialog = new EditView3DProxyDialog(view); } void FormEditorWidget::changeTransformTool(bool checked) { if (checked) - m_formEditorView->changeToTransformTools(); } @@ -397,17 +393,6 @@ FormEditorGraphicsView *FormEditorWidget::graphicsView() const return m_graphicsView; } -void FormEditorWidget::set3dEditorVisibility(bool b) -{ - m_editView3DProxyDialog->setVisible(b); -} - -void FormEditorWidget::invalidate3DEditor() -{ - if (m_editView3DProxyDialog) - m_editView3DProxyDialog->invalidate(); -} - DocumentWarningWidget *FormEditorWidget::errorWidget() { if (m_documentErrorWidget.isNull()) { diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h index d1c55885288..f7e0d8a92d2 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h +++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h @@ -37,7 +37,6 @@ QT_END_NAMESPACE namespace QmlDesigner { -class EditView3DProxyDialog; class ZoomAction; class LineEditAction; class BackgroundAction; @@ -87,9 +86,6 @@ public: FormEditorGraphicsView *graphicsView() const; - void set3dEditorVisibility(bool b); - void invalidate3DEditor(); - protected: void wheelEvent(QWheelEvent *event) override; QActionGroup *toolActionGroup() const; @@ -120,7 +116,6 @@ private: QPointer m_option3DAction; QPointer m_resetAction; QPointer m_documentErrorWidget; - QPointer m_editView3DProxyDialog; }; } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimporter.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimporter.cpp index d4f1d090baf..53cc813e0c1 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimporter.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimporter.cpp @@ -389,6 +389,7 @@ void ItemLibraryAssetImporter::parseQuick3DAsset(const QString &file, const QVar #else Q_UNUSED(file) + Q_UNUSED(options) #endif } diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp index 8c4bc832977..b1efd1af0e2 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp @@ -375,7 +375,9 @@ QStringList PropertyEditorValue::getExpressionAsList() const bool PropertyEditorValue::idListAdd(const QString &value) { - QTC_ASSERT(isIdList(), return false); + const QmlDesigner::QmlObjectNode objectNode(modelNode()); + if (!isIdList() && (objectNode.isValid() && objectNode.hasProperty(name()))) + return false; static const QRegExp rx("^[a-z_]\\w*|^[A-Z]\\w*\\.{1}([a-z_]\\w*\\.?)+"); if (!rx.exactMatch(value)) @@ -393,7 +395,6 @@ bool PropertyEditorValue::idListRemove(int idx) QTC_ASSERT(isIdList(), return false); auto stringList = generateStringList(expression()); - if (idx < 0 || idx >= stringList.size()) return false; @@ -438,6 +439,8 @@ QString PropertyEditorValue::generateString(const QStringList &stringList) const { if (stringList.size() > 1) return "[" + stringList.join(",") + "]"; + else if (stringList.isEmpty()) + return QString(); else return stringList.first(); } diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h index 481fbb3458f..a69bca8a739 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h @@ -83,6 +83,7 @@ class PropertyEditorValue : public QObject Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged FINAL) Q_PROPERTY(bool isTranslated READ isTranslated NOTIFY expressionChanged FINAL) + Q_PROPERTY(bool isIdList READ isIdList NOTIFY expressionChanged FINAL) Q_PROPERTY(QStringList expressionAsList READ getExpressionAsList NOTIFY expressionChanged FINAL) Q_PROPERTY(QString name READ nameAsQString FINAL) diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp index 1d0c165bdaf..d97d090f198 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp @@ -280,8 +280,10 @@ void PropertyEditorView::changeExpression(const QString &propertyName) } } - if (value->expression().isEmpty()) + if (value->expression().isEmpty()) { + value->resetValue(); return; + } if (qmlObjectNode.expression(name) != value->expression() || !qmlObjectNode.propertyAffectedByCurrentState(name)) qmlObjectNode.setBindingProperty(name, value->expression()); diff --git a/src/plugins/qmldesigner/designercore/include/modelnode.h b/src/plugins/qmldesigner/designercore/include/modelnode.h index 7f943dddd1c..1399e13e2d6 100644 --- a/src/plugins/qmldesigner/designercore/include/modelnode.h +++ b/src/plugins/qmldesigner/designercore/include/modelnode.h @@ -133,6 +133,7 @@ public: QList nodeProperties() const; QList nodeListProperties() const; QList bindingProperties() const; + QList signalProperties() const; PropertyNameList propertyNames() const; bool hasProperties() const; diff --git a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h index 7245c66399d..3a4b8c0f379 100644 --- a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h +++ b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h @@ -51,7 +51,6 @@ class CreateSceneCommand; class CreateInstancesCommand; class ClearSceneCommand; class ReparentInstancesCommand; -class Change3DViewCommand; class ChangeFileUrlCommand; class ChangeValuesCommand; class ChangeBindingsCommand; @@ -134,15 +133,14 @@ public: void selectedNodesChanged(const QList &selectedNodeList, const QList &lastSelectedNodeList) override; - void show3DView(const QRect &rect); - void move3DView(const QPoint &position); - void hide3DView(); + void mainWindowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates); + void mainWindowActiveChanged(bool active, bool hasPopup); + void enable3DView(bool enable); protected: void timerEvent(QTimerEvent *event) override; private: // functions - enum ViewAction { Show, Move, Hide }; void activateState(const NodeInstance &instance); void activateBaseState(); @@ -167,7 +165,6 @@ private: // functions CreateSceneCommand createCreateSceneCommand(); - Change3DViewCommand createChange3DViewCommand(ViewAction action, const QPoint &pos = {}, const QSize &size = {}) const; ClearSceneCommand createClearSceneCommand() const; CreateInstancesCommand createCreateInstancesCommand(const QList &instanceList) const; CompleteComponentCommand createComponentCompleteCommand(const QList &instanceList) const; diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp index 954724952ac..5dd19179a31 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp @@ -29,7 +29,8 @@ #include #include -#include +#include +#include #include #include #include @@ -651,7 +652,12 @@ void NodeInstanceServerProxy::clearScene(const ClearSceneCommand &command) writeCommand(QVariant::fromValue(command)); } -void NodeInstanceServerProxy::change3DView(const Change3DViewCommand &command) +void NodeInstanceServerProxy::update3DViewState(const Update3dViewStateCommand &command) +{ + writeCommand(QVariant::fromValue(command)); +} + +void NodeInstanceServerProxy::enable3DView(const Enable3DViewCommand &command) { writeCommand(QVariant::fromValue(command)); } diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h index 79af0de5285..5affc3fe448 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h @@ -67,7 +67,8 @@ public: void createInstances(const CreateInstancesCommand &command) override; void changeFileUrl(const ChangeFileUrlCommand &command) override; void createScene(const CreateSceneCommand &command) override; - void change3DView(const Change3DViewCommand &command) override; + void update3DViewState(const Update3dViewStateCommand &command) override; + void enable3DView(const Enable3DViewCommand &command) override; void clearScene(const ClearSceneCommand &command) override; void removeInstances(const RemoveInstancesCommand &command) override; void changeSelection(const ChangeSelectionCommand &command) override; diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp index 396d9c5bb80..4d43e522788 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp @@ -48,7 +48,8 @@ #include "clearscenecommand.h" #include "changefileurlcommand.h" #include "reparentinstancescommand.h" -#include "change3dviewcommand.h" +#include "update3dviewstatecommand.h" +#include "enable3dviewcommand.h" #include "changevaluescommand.h" #include "changeauxiliarycommand.h" #include "changebindingscommand.h" @@ -979,20 +980,6 @@ ClearSceneCommand NodeInstanceView::createClearSceneCommand() const return {}; } -Change3DViewCommand NodeInstanceView::createChange3DViewCommand(ViewAction action, const QPoint &pos, const QSize &size) const -{ - InformationName informationName = InformationName::ShowView; - - if (action == ViewAction::Move) - informationName = InformationName::MoveView; - else if (action == ViewAction::Hide) - informationName = InformationName::HideView; - - const qint32 instanceId = 0; - - return Change3DViewCommand({ InformationContainer(instanceId, informationName, pos, size) }); -} - CompleteComponentCommand NodeInstanceView::createComponentCompleteCommand(const QList &instanceList) const { QVector containerList; @@ -1465,21 +1452,22 @@ void NodeInstanceView::selectedNodesChanged(const QList &selectedNode nodeInstanceServer()->changeSelection(createChangeSelectionCommand(selectedNodeList)); } -void NodeInstanceView::move3DView(const QPoint &position) +void NodeInstanceView::mainWindowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates) { - nodeInstanceServer()->change3DView(createChange3DViewCommand(ViewAction::Move, position)); + if (nodeInstanceServer()) + nodeInstanceServer()->update3DViewState(Update3dViewStateCommand(previousStates, currentStates)); } -void NodeInstanceView::hide3DView() +void NodeInstanceView::mainWindowActiveChanged(bool active, bool hasPopup) { - nodeInstanceServer()->change3DView(createChange3DViewCommand(ViewAction::Hide)); + if (nodeInstanceServer()) + nodeInstanceServer()->update3DViewState(Update3dViewStateCommand(active, hasPopup)); } -void NodeInstanceView::show3DView(const QRect &rect) +// enable / disable 3D edit View +void NodeInstanceView::enable3DView(bool enable) { - nodeInstanceServer()->change3DView(createChange3DViewCommand(ViewAction::Show, - rect.topLeft(), - rect.size())); + nodeInstanceServer()->enable3DView(Enable3DViewCommand(enable)); } void NodeInstanceView::timerEvent(QTimerEvent *event) diff --git a/src/plugins/qmldesigner/designercore/model/modelnode.cpp b/src/plugins/qmldesigner/designercore/model/modelnode.cpp index 1fdc29aaa03..ab4bf9cca02 100644 --- a/src/plugins/qmldesigner/designercore/model/modelnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelnode.cpp @@ -644,6 +644,16 @@ QList ModelNode::bindingProperties() const return propertyList; } +QList ModelNode::signalProperties() const +{ + QList propertyList; + + foreach (const AbstractProperty &property, properties()) + if (property.isSignalHandlerProperty()) + propertyList.append(property.toSignalHandlerProperty()); + return propertyList; +} + /*! \brief removes a property from this node \param name name of the property diff --git a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp index c65a57d34f0..5e119a688ff 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp @@ -57,34 +57,6 @@ bool QmlItemNode::isItemOrWindow(const ModelNode &modelNode) return false; } -static QmlItemNode createQmlItemNodeFromSource(AbstractView *view, const QString &source, const QPointF &position) -{ - QScopedPointer inputModel(Model::create("QtQuick.Item", 1, 0, view->model())); - inputModel->setFileUrl(view->model()->fileUrl()); - QPlainTextEdit textEdit; - - textEdit.setPlainText(source); - NotIndentingTextEditModifier modifier(&textEdit); - - QScopedPointer rewriterView(new RewriterView(RewriterView::Amend, nullptr)); - rewriterView->setCheckSemanticErrors(false); - rewriterView->setTextModifier(&modifier); - inputModel->setRewriterView(rewriterView.data()); - - if (rewriterView->errors().isEmpty() && rewriterView->rootModelNode().isValid()) { - ModelNode rootModelNode = rewriterView->rootModelNode(); - inputModel->detachView(rewriterView.data()); - - rootModelNode.variantProperty("x").setValue(qRound(position.x())); - rootModelNode.variantProperty("y").setValue(qRound(position.y())); - - ModelMerger merger(view); - return merger.insertModel(rootModelNode); - } - - return QmlItemNode(); -} - QmlItemNode QmlItemNode::createQmlItemNode(AbstractView *view, const ItemLibraryEntry &itemLibraryEntry, const QPointF &position, diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp index 2dbf40a7bb9..e0f3b85c736 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.cpp +++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp @@ -31,6 +31,7 @@ #include "designmodecontext.h" #include "openuiqmlfiledialog.h" #include "generateresource.h" +#include "nodeinstanceview.h" #include #include @@ -249,6 +250,16 @@ void QmlDesignerPlugin::extensionsInitialized() connect(Core::ICore::instance(), &Core::ICore::coreAboutToOpen, this, [this] { integrateIntoQtCreator(&d->mainWidget); }); + + connect(Core::ICore::instance(), &Core::ICore::windowStateChanged, this, + [this] (Qt::WindowStates previousStates, Qt::WindowStates currentStates) { + d->viewManager.nodeInstanceView()->mainWindowStateChanged(previousStates, currentStates); + }); + + connect(Core::ICore::instance(), &Core::ICore::windowActivationChanged, this, + [this] (bool isActive, bool hasPopup) { + d->viewManager.nodeInstanceView()->mainWindowActiveChanged(isActive, hasPopup); + }); } static QStringList allUiQmlFilesforCurrentProject(const Utils::FilePath &fileName) diff --git a/src/plugins/qmldesigner/qmldesignerplugin.qbs b/src/plugins/qmldesigner/qmldesignerplugin.qbs index 7047ffa1b88..1ef8407d8e7 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.qbs +++ b/src/plugins/qmldesigner/qmldesignerplugin.qbs @@ -171,8 +171,10 @@ Project { "commands/changeselectioncommand.h", "commands/drop3dlibraryitemcommand.cpp", "commands/drop3dlibraryitemcommand.h", - "commands/change3dviewcommand.cpp", - "commands/change3dviewcommand.h", + "commands/update3dviewstatecommand.cpp", + "commands/update3dviewstatecommand.h", + "commands/enable3dviewcommand.cpp", + "commands/enable3dviewcommand.h", "container/addimportcontainer.cpp", "container/addimportcontainer.h", "container/idcontainer.cpp", @@ -454,8 +456,6 @@ Project { "formeditor/controlelement.h", "formeditor/dragtool.cpp", "formeditor/dragtool.h", - "formeditor/editview3dproxydialog.cpp", - "formeditor/editview3dproxydialog.h", "formeditor/formeditor.qrc", "formeditor/formeditorgraphicsview.cpp", "formeditor/formeditorgraphicsview.h", diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h index f0ad48cd5c4..f12da342fe3 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.h +++ b/src/plugins/qmlprojectmanager/qmlproject.h @@ -42,6 +42,8 @@ class QmlProjectItem; class QmlBuildSystem : public ProjectExplorer::BuildSystem { + Q_OBJECT + public: explicit QmlBuildSystem(ProjectExplorer::Target *target); ~QmlBuildSystem(); diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp index cb7293493df..1be8e33a2f2 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp @@ -384,7 +384,7 @@ QString QmlProjectRunConfiguration::commandLineArguments() const const OsType osType = device ? device->osType() : HostOsInfo::hostOs(); // arguments from .qmlproject file - const QmlBuildSystem *bs = static_cast(target()->buildSystem()); + const QmlBuildSystem *bs = qobject_cast(target()->buildSystem()); foreach (const QString &importPath, QmlBuildSystem::makeAbsolute(bs->targetDirectory(), bs->customImportPaths())) { QtcProcess::addArg(&args, "-I", osType); diff --git a/src/plugins/qnx/qnxrunconfiguration.cpp b/src/plugins/qnx/qnxrunconfiguration.cpp index 9e9707cbfc8..7ea647c3730 100644 --- a/src/plugins/qnx/qnxrunconfiguration.cpp +++ b/src/plugins/qnx/qnxrunconfiguration.cpp @@ -69,17 +69,7 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Core::Id id) libAspect->setLabelText(tr("Path to Qt libraries on device")); libAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay); - setUpdater([this, target, exeAspect, symbolsAspect] { - - const BuildTargetInfo bti = buildTargetInfo(); - const FilePath localExecutable = bti.targetFilePath; - const DeployableFile depFile = target->deploymentData().deployableForLocalFile(localExecutable); - - exeAspect->setExecutable(FilePath::fromString(depFile.remoteFilePath())); - symbolsAspect->setFilePath(localExecutable); - - emit enabledChanged(); - }); + setUpdater([this] { updateTargetInformation(); }); connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update); } @@ -98,6 +88,22 @@ Runnable QnxRunConfiguration::runnable() const return r; } +void QnxRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &) +{ + updateTargetInformation(); +} + +void QnxRunConfiguration::updateTargetInformation() +{ + const BuildTargetInfo bti = buildTargetInfo(); + const FilePath localExecutable = bti.targetFilePath; + const DeployableFile depFile = target()->deploymentData() + .deployableForLocalFile(localExecutable); + aspect()->setExecutable(FilePath::fromString(depFile.remoteFilePath())); + aspect()->setFilePath(localExecutable); + emit enabledChanged(); +} + // QnxRunConfigurationFactory QnxRunConfigurationFactory::QnxRunConfigurationFactory() diff --git a/src/plugins/qnx/qnxrunconfiguration.h b/src/plugins/qnx/qnxrunconfiguration.h index 75ec72a66c0..eaa0980d50c 100644 --- a/src/plugins/qnx/qnxrunconfiguration.h +++ b/src/plugins/qnx/qnxrunconfiguration.h @@ -48,6 +48,9 @@ public: private: ProjectExplorer::Runnable runnable() const override; + void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override; + + void updateTargetInformation(); }; class QnxRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp index 81a855d0304..020ac876917 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp @@ -69,21 +69,17 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Core::I if (HostOsInfo::isAnyUnixHost()) addAspect(); - setUpdater([this, target, exeAspect, symbolsAspect] { - BuildTargetInfo bti = buildTargetInfo(); - const FilePath localExecutable = bti.targetFilePath; - DeployableFile depFile = target->deploymentData().deployableForLocalFile(localExecutable); - - exeAspect->setExecutable(FilePath::fromString(depFile.remoteFilePath())); - symbolsAspect->setFilePath(localExecutable); - - emit enabledChanged(); - }); + setUpdater([this] { updateTargetInformation(); }); connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update); connect(target, &Target::kitChanged, this, &RunConfiguration::update); } +void RemoteLinuxRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &) +{ + updateTargetInformation(); +} + Runnable RemoteLinuxRunConfiguration::runnable() const { Runnable r = RunConfiguration::runnable(); @@ -93,6 +89,17 @@ Runnable RemoteLinuxRunConfiguration::runnable() const return r; } +void RemoteLinuxRunConfiguration::updateTargetInformation() +{ + BuildTargetInfo bti = buildTargetInfo(); + const FilePath localExecutable = bti.targetFilePath; + DeployableFile depFile = target()->deploymentData().deployableForLocalFile(localExecutable); + + aspect()->setExecutable(FilePath::fromString(depFile.remoteFilePath())); + aspect()->setFilePath(localExecutable); + + emit enabledChanged(); +} // RemoteLinuxRunConfigurationFactory diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.h b/src/plugins/remotelinux/remotelinuxrunconfiguration.h index ec08bf69636..ddf943d4914 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.h @@ -39,8 +39,10 @@ class RemoteLinuxRunConfiguration final : public ProjectExplorer::RunConfigurati public: RemoteLinuxRunConfiguration(ProjectExplorer::Target *target, Core::Id id); -protected: +private: + void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override; ProjectExplorer::Runnable runnable() const override; + void updateTargetInformation(); }; class RemoteLinuxRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory diff --git a/src/plugins/webassembly/webassemblyplugin.cpp b/src/plugins/webassembly/webassemblyplugin.cpp index 97b4ca4ebcb..497efeb7222 100644 --- a/src/plugins/webassembly/webassemblyplugin.cpp +++ b/src/plugins/webassembly/webassemblyplugin.cpp @@ -35,6 +35,7 @@ #include #include +#include using namespace ProjectExplorer; @@ -80,7 +81,9 @@ bool WebAssemblyPlugin::initialize(const QStringList& arguments, QString* errorS void WebAssemblyPlugin::extensionsInitialized() { - ProjectExplorer::DeviceManager::instance()->addDevice(WebAssemblyDevice::create()); + connect(KitManager::instance(), &KitManager::kitsLoaded, this, [] { + DeviceManager::instance()->addDevice(WebAssemblyDevice::create()); + }); } } // namespace Internal diff --git a/src/tools/qml2puppet/CMakeLists.txt b/src/tools/qml2puppet/CMakeLists.txt index 141c8ff4058..fc502b9e8ba 100644 --- a/src/tools/qml2puppet/CMakeLists.txt +++ b/src/tools/qml2puppet/CMakeLists.txt @@ -46,7 +46,8 @@ extend_qtc_executable(qml2puppet tokencommand.cpp tokencommand.h changeselectioncommand.cpp changeselectioncommand.h drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h - change3dviewcommand.cpp change3dviewcommand.h + update3dviewstatecommand.cpp update3dviewstatecommand.h + enable3dviewcommand.cpp enable3dviewcommand.h valueschangedcommand.cpp ) diff --git a/src/tools/qml2puppet/qml2puppet.qbs b/src/tools/qml2puppet/qml2puppet.qbs index 40719787498..fb73413038f 100644 --- a/src/tools/qml2puppet/qml2puppet.qbs +++ b/src/tools/qml2puppet/qml2puppet.qbs @@ -97,8 +97,10 @@ QtcTool { "commands/changeselectioncommand.h", "commands/drop3dlibraryitemcommand.cpp", "commands/drop3dlibraryitemcommand.h", - "commands/change3dviewcommand.cpp", - "commands/change3dviewcommand.h", + "commands/update3dviewstatecommand.cpp", + "commands/update3dviewstatecommand.h", + "commands/enable3dviewcommand.cpp", + "commands/enable3dviewcommand.h", "container/addimportcontainer.cpp", "container/addimportcontainer.h", "container/idcontainer.cpp",