From 86f93b89499c63af5b011c8d832f01e195764465 Mon Sep 17 00:00:00 2001 From: Samuel Ghinet Date: Mon, 20 Jun 2022 16:06:28 +0300 Subject: [PATCH 1/4] Sync color between environment map and 3D Editor background Task-number: QDS-7097 Change-Id: I5f2c83bc43bd589d0d1f32e01e7512ab20a03bcf Reviewed-by: Miikka Heikkinen Reviewed-by: Mahmoud Badri --- .../qmlpuppet/commands/view3dactioncommand.h | 1 + .../qmlpuppet/mockfiles/qt5/EditView3D.qml | 31 +++++++--- .../qmlpuppet/mockfiles/qt6/EditView3D.qml | 13 ++++ .../qml2puppet/editor3d/generalhelper.cpp | 10 ++++ .../qml2puppet/editor3d/generalhelper.h | 4 ++ .../qt5informationnodeinstanceserver.cpp | 60 ++++++++++++++++++- .../qt5informationnodeinstanceserver.h | 1 + .../components/edit3d/edit3dview.cpp | 16 +++++ .../components/edit3d/edit3dview.h | 1 + .../qmldesigner/qmldesignerconstants.h | 1 + 10 files changed, 128 insertions(+), 10 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/commands/view3dactioncommand.h b/share/qtcreator/qml/qmlpuppet/commands/view3dactioncommand.h index 13d39739437..4373a1c9ddd 100644 --- a/share/qtcreator/qml/qmlpuppet/commands/view3dactioncommand.h +++ b/share/qtcreator/qml/qmlpuppet/commands/view3dactioncommand.h @@ -59,6 +59,7 @@ public: SelectBackgroundColor, SelectGridColor, ResetBackgroundColor, + SyncBackgroundColor, GetModelAtPos }; diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/EditView3D.qml index 09a4ebdc3f3..1376610984d 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/EditView3D.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/EditView3D.qml @@ -48,6 +48,7 @@ Item { property color backgroundGradientColorStart: "#222222" property color backgroundGradientColorEnd: "#999999" property color gridColor: "#aaaaaa" + property bool syncBackgroundColor: false enum SelectionMode { Item, Group } enum TransformMode { Move, Rotate, Scale } @@ -72,15 +73,16 @@ Item { signal changeObjectProperty(var objects, var propNames) signal notifyActiveSceneChange() - onUsePerspectiveChanged: _generalHelper.storeToolState(sceneId, "usePerspective", usePerspective) - onShowEditLightChanged: _generalHelper.storeToolState(sceneId, "showEditLight", showEditLight) - onGlobalOrientationChanged: _generalHelper.storeToolState(sceneId, "globalOrientation", globalOrientation) - onShowGridChanged: _generalHelper.storeToolState(sceneId, "showGrid", showGrid); - onShowSelectionBoxChanged: _generalHelper.storeToolState(sceneId, "showSelectionBox", showSelectionBox); - onShowIconGizmoChanged: _generalHelper.storeToolState(sceneId, "showIconGizmo", showIconGizmo); - onShowCameraFrustumChanged: _generalHelper.storeToolState(sceneId, "showCameraFrustum", showCameraFrustum); - onSelectionModeChanged: _generalHelper.storeToolState(sceneId, "selectionMode", selectionMode); - onTransformModeChanged: _generalHelper.storeToolState(sceneId, "transformMode", transformMode); + onUsePerspectiveChanged: _generalHelper.storeToolState(sceneId, "usePerspective", usePerspective) + onShowEditLightChanged: _generalHelper.storeToolState(sceneId, "showEditLight", showEditLight) + onGlobalOrientationChanged: _generalHelper.storeToolState(sceneId, "globalOrientation", globalOrientation) + onShowGridChanged: _generalHelper.storeToolState(sceneId, "showGrid", showGrid); + onSyncBackgroundColorChanged: _generalHelper.storeToolState(sceneId, "syncBackgroundColor", syncBackgroundColor); + onShowSelectionBoxChanged: _generalHelper.storeToolState(sceneId, "showSelectionBox", showSelectionBox); + onShowIconGizmoChanged: _generalHelper.storeToolState(sceneId, "showIconGizmo", showIconGizmo); + onShowCameraFrustumChanged: _generalHelper.storeToolState(sceneId, "showCameraFrustum", showCameraFrustum); + onSelectionModeChanged: _generalHelper.storeToolState(sceneId, "selectionMode", selectionMode); + onTransformModeChanged: _generalHelper.storeToolState(sceneId, "transformMode", transformMode); onActiveSceneChanged: updateActiveScene() @@ -249,6 +251,16 @@ Item { else if (resetToDefault) showGrid = true; + if ("syncBackgroundColor" in toolStates) { + syncBackgroundColor = toolStates.syncBackgroundColor; + if (syncBackgroundColor) { + var color = _generalHelper.sceneEnvironmentColor(sceneId); + updateViewStates({"selectBackgroundColor": color}) + } + } else if (resetToDefault) { + syncBackgroundColor = false; + } + if ("showSelectionBox" in toolStates) showSelectionBox = toolStates.showSelectionBox; else if (resetToDefault) @@ -294,6 +306,7 @@ Item { { _generalHelper.storeToolState(sceneId, "showEditLight", showEditLight) _generalHelper.storeToolState(sceneId, "showGrid", showGrid) + _generalHelper.storeToolState(sceneId, "syncBackgroundColor", syncBackgroundColor) _generalHelper.storeToolState(sceneId, "showSelectionBox", showSelectionBox) _generalHelper.storeToolState(sceneId, "showIconGizmo", showIconGizmo) _generalHelper.storeToolState(sceneId, "showCameraFrustum", showCameraFrustum) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml index a3f14e9d113..721e74ac303 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml @@ -49,6 +49,7 @@ Item { property color backgroundGradientColorStart: "#222222" property color backgroundGradientColorEnd: "#999999" property color gridColor: "#aaaaaa" + property bool syncBackgroundColor: false enum SelectionMode { Item, Group } enum TransformMode { Move, Rotate, Scale } @@ -79,6 +80,7 @@ Item { onShowEditLightChanged: _generalHelper.storeToolState(sceneId, "showEditLight", showEditLight) onGlobalOrientationChanged: _generalHelper.storeToolState(sceneId, "globalOrientation", globalOrientation) onShowGridChanged: _generalHelper.storeToolState(sceneId, "showGrid", showGrid); + onSyncBackgroundColorChanged: _generalHelper.storeToolState(sceneId, "syncBackgroundColor", syncBackgroundColor); onShowSelectionBoxChanged: _generalHelper.storeToolState(sceneId, "showSelectionBox", showSelectionBox); onShowIconGizmoChanged: _generalHelper.storeToolState(sceneId, "showIconGizmo", showIconGizmo); onShowCameraFrustumChanged: _generalHelper.storeToolState(sceneId, "showCameraFrustum", showCameraFrustum); @@ -243,6 +245,16 @@ Item { else if (resetToDefault) showGrid = true; + if ("syncBackgroundColor" in toolStates) { + syncBackgroundColor = toolStates.syncBackgroundColor; + if (syncBackgroundColor) { + var color = _generalHelper.sceneEnvironmentColor(sceneId); + updateViewStates({"selectBackgroundColor": color}) + } + } else if (resetToDefault) { + syncBackgroundColor = false; + } + if ("showSelectionBox" in toolStates) showSelectionBox = toolStates.showSelectionBox; else if (resetToDefault) @@ -293,6 +305,7 @@ Item { { _generalHelper.storeToolState(sceneId, "showEditLight", showEditLight) _generalHelper.storeToolState(sceneId, "showGrid", showGrid) + _generalHelper.storeToolState(sceneId, "syncBackgroundColor", syncBackgroundColor) _generalHelper.storeToolState(sceneId, "showSelectionBox", showSelectionBox) _generalHelper.storeToolState(sceneId, "showIconGizmo", showIconGizmo) _generalHelper.storeToolState(sceneId, "showCameraFrustum", showCameraFrustum) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp index 590785a30e3..f8ab464df23 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp @@ -547,6 +547,16 @@ void GeneralHelper::storeToolState(const QString &sceneId, const QString &tool, } } +void GeneralHelper::setSceneEnvironmentColor(const QString &sceneId, const QColor &color) +{ + m_sceneEnvironmentColor[sceneId] = color; +} + +QColor GeneralHelper::sceneEnvironmentColor(const QString &sceneId) const +{ + return m_sceneEnvironmentColor[sceneId]; +} + void GeneralHelper::initToolStates(const QString &sceneId, const QVariantMap &toolStates) { m_toolStates[sceneId] = toolStates; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h index 8014a711875..e3ae249755d 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h @@ -113,6 +113,9 @@ public: Q_INVOKABLE void scaleMultiSelection(bool commit); Q_INVOKABLE void rotateMultiSelection(bool commit); + void setSceneEnvironmentColor(const QString &sceneId, const QColor &color); + Q_INVOKABLE QColor sceneEnvironmentColor(const QString &sceneId) const; + bool isMacOS() const; void addRotationBlocks(const QSet &nodes); @@ -136,6 +139,7 @@ private: QTimer m_toolStateUpdateTimer; QHash m_toolStates; QHash m_toolStatesPending; + QHash m_sceneEnvironmentColor; QSet m_rotationBlockedNodes; struct MultiSelData { diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index 4448e2cee1f..c95a81641e0 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -867,8 +867,21 @@ void Qt5InformationNodeInstanceServer::updateActiveSceneToEditView3D(bool timerC updateView3DRect(m_active3DView); auto helper = qobject_cast(m_3dHelper); - if (helper) + if (helper) { helper->storeToolState(helper->globalStateId(), helper->lastSceneIdKey(), QVariant(sceneId), 0); + + QVariantMap toolStates = helper->getToolStates(sceneId); + if (toolStates.contains("syncBackgroundColor")) { + bool sync = toolStates["syncBackgroundColor"].toBool(); + if (sync) { + QColor color = helper->sceneEnvironmentColor(sceneId); + View3DActionCommand cmd(View3DActionCommand::SelectBackgroundColor, + QVariant::fromValue(color)); + view3DAction(cmd); + } + } + } + #else Q_UNUSED(timerCall) #endif @@ -2179,6 +2192,44 @@ void Qt5InformationNodeInstanceServer::changeSelection(const ChangeSelectionComm render3DEditView(2); } +void Qt5InformationNodeInstanceServer::setSceneEnvironmentColor(const PropertyValueContainer &container) +{ +#ifdef QUICK3D_MODULE + auto helper = qobject_cast(m_3dHelper); + if (!helper || !hasInstanceForId(container.instanceId()) || !m_active3DView) + return; + + ServerNodeInstance sceneEnvInstance = instanceForId(container.instanceId()); + if (!sceneEnvInstance.isSubclassOf("QQuick3DSceneEnvironment")) + return; + + auto activeView = qobject_cast(m_active3DView); + if (!activeView) + return; + + QQuick3DSceneEnvironment *activeEnv = activeView->environment(); + if (activeEnv != sceneEnvInstance.internalObject()) + return; + + ServerNodeInstance activeSceneInstance = active3DSceneInstance(); + const QString sceneId = activeSceneInstance.id(); + + QColor color = container.value().value(); + helper->setSceneEnvironmentColor(sceneId, color); + QVariantMap toolStates = helper->getToolStates(sceneId); + + if (toolStates.contains("syncBackgroundColor")) { + bool sync = toolStates["syncBackgroundColor"].toBool(); + if (sync) { + View3DActionCommand cmd(View3DActionCommand::SelectBackgroundColor, QVariant::fromValue(color)); + view3DAction(cmd); + } + } +#else + Q_UNUSED(container) +#endif +} + void Qt5InformationNodeInstanceServer::changePropertyValues(const ChangeValuesCommand &command) { bool hasDynamicProperties = false; @@ -2186,6 +2237,10 @@ void Qt5InformationNodeInstanceServer::changePropertyValues(const ChangeValuesCo for (const PropertyValueContainer &container : values) { if (!container.isReflected()) { hasDynamicProperties |= container.isDynamic(); + + if (container.name() == "clearColor") + setSceneEnvironmentColor(container); + setInstancePropertyVariant(container); } } @@ -2284,6 +2339,9 @@ void Qt5InformationNodeInstanceServer::view3DAction(const View3DActionCommand &c case View3DActionCommand::ShowCameraFrustum: updatedToolState.insert("showCameraFrustum", command.isEnabled()); break; + case View3DActionCommand::SyncBackgroundColor: + updatedToolState.insert("syncBackgroundColor", command.isEnabled()); + break; case View3DActionCommand::SelectBackgroundColor: updatedViewState.insert("selectBackgroundColor", command.value()); break; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h index c85a2730c46..f3448de4add 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h @@ -154,6 +154,7 @@ private: void resetParticleSystem(); void handleParticleSystemDeselected(); #endif + void setSceneEnvironmentColor(const PropertyValueContainer &container); RenderViewData m_editView3DData; RenderViewData m_modelNode3DImageViewData; diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp index bcce905b4fa..f848b58b3f0 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp +++ b/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp @@ -338,6 +338,21 @@ Edit3DAction *Edit3DView::createResetColorAction() tooltip); } +Edit3DAction *Edit3DView::createSyncBackgroundColorAction() +{ + QString description = QCoreApplication::translate("SyncEdit3DColorAction", + "Use Scene Environment Color"); + QString tooltip = QCoreApplication::translate("SyncEdit3DColorAction", + "Sets the 3D Editor to use the Scene Environment " + "color as background color."); + + return new Edit3DAction( + QmlDesigner::Constants::EDIT3D_EDIT_SYNC_BACKGROUND_COLOR, View3DActionCommand::SyncBackgroundColor, + description, + {}, true, false, {}, {}, {}, + tooltip); +} + void Edit3DView::createEdit3DActions() { m_selectionModeAction @@ -569,6 +584,7 @@ void Edit3DView::createEdit3DActions() m_backgroundColorActions << createSelectBackgrounColorAction(); m_backgroundColorActions << createGridColorSelectionAction(); + m_backgroundColorActions << createSyncBackgroundColorAction(); m_backgroundColorActions << createResetColorAction(); } diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dview.h b/src/plugins/qmldesigner/components/edit3d/edit3dview.h index 4d96a7549f3..8b242058efb 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dview.h +++ b/src/plugins/qmldesigner/components/edit3d/edit3dview.h @@ -88,6 +88,7 @@ private: Edit3DAction *createSelectBackgrounColorAction(); Edit3DAction *createGridColorSelectionAction(); Edit3DAction *createResetColorAction(); + Edit3DAction *createSyncBackgroundColorAction(); QPointer m_edit3DWidget; QVector m_leftActions; diff --git a/src/plugins/qmldesigner/qmldesignerconstants.h b/src/plugins/qmldesigner/qmldesignerconstants.h index cf657bca537..3cc0c3b8ae6 100644 --- a/src/plugins/qmldesigner/qmldesignerconstants.h +++ b/src/plugins/qmldesigner/qmldesignerconstants.h @@ -68,6 +68,7 @@ const char EDIT3D_EDIT_SHOW_GRID[] = "QmlDesigner.Editor3D.ToggleGrid"; const char EDIT3D_EDIT_SELECT_BACKGROUND_COLOR[] = "QmlDesigner.Editor3D.SelectBackgroundColor"; const char EDIT3D_EDIT_SELECT_GRID_COLOR[] = "QmlDesigner.Editor3D.SelectGridColor"; const char EDIT3D_EDIT_RESET_BACKGROUND_COLOR[] = "QmlDesigner.Editor3D.ResetBackgroundColor"; +const char EDIT3D_EDIT_SYNC_BACKGROUND_COLOR[] = "QmlDesigner.Editor3D.SyncBackgroundColor"; const char EDIT3D_EDIT_SHOW_SELECTION_BOX[] = "QmlDesigner.Editor3D.ToggleSelectionBox"; const char EDIT3D_EDIT_SHOW_ICON_GIZMO[] = "QmlDesigner.Editor3D.ToggleIconGizmo"; const char EDIT3D_EDIT_SHOW_CAMERA_FRUSTUM[] = "QmlDesigner.Editor3D.ToggleCameraFrustum"; From 5aa987b6a5226bd4071f6aa498e5db423cd754d8 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 3 Aug 2022 10:41:05 +0200 Subject: [PATCH 2/4] LanguageClient: fix outline focus Setting a focus proxy to the outline widget makes sure the tree view gets the focus whenever the oultine widget gets focus, so after opening the outline the user can directly use navigation keys to move the selection in the outline. Fixes: QTCREATORBUG-27595 Change-Id: I0771c99ccf5aa334f45065d58366b53f53bf75a5 Reviewed-by: Reviewed-by: Christian Stenger --- src/plugins/languageclient/languageclientoutline.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/languageclient/languageclientoutline.cpp b/src/plugins/languageclient/languageclientoutline.cpp index 9ac086493ca..abaea39f954 100644 --- a/src/plugins/languageclient/languageclientoutline.cpp +++ b/src/plugins/languageclient/languageclientoutline.cpp @@ -255,6 +255,7 @@ LanguageClientOutlineWidget::LanguageClientOutlineWidget(Client *client, if (m_sync) updateSelectionInTree(m_editor->textCursor()); }); + setFocusProxy(&m_view); } QList LanguageClientOutlineWidget::filterMenuActions() const From 0a2510edcbbae049c46a27c3b486214bbd493660 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 3 Aug 2022 12:02:37 +0200 Subject: [PATCH 3/4] Python: skip root on venv detection Virtual environments on the root level are uncommon and can cause issues on some linux distros. Fixes: QTCREATORBUG-27976 Change-Id: I266f1b321c1c2d2b4b416acf3f34ce8c1d686219 Reviewed-by: Christian Stenger --- src/plugins/python/pythonsettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/python/pythonsettings.cpp b/src/plugins/python/pythonsettings.cpp index ce6af38ef25..8f7537c8b77 100644 --- a/src/plugins/python/pythonsettings.cpp +++ b/src/plugins/python/pythonsettings.cpp @@ -930,7 +930,7 @@ QList PythonSettings::detectPythonVenvs(const FilePath &path) dir.cdUp(); } } - } while (dir.cdUp()); + } while (dir.cdUp() && !(dir.isRoot() && Utils::HostOsInfo::isAnyUnixHost())); } return result; } From f8c3d860fcd3853201e715e2f0c8aa3799b018da Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 3 Aug 2022 12:02:04 +0300 Subject: [PATCH 4/4] Gerrit: Do not pass username to curl for REST requests It is set in .netrc anyway, and there is a regression in curl that causes it to fail when passing the user name. See https://github.com/curl/curl/issues/8653 Change-Id: Ic7aa2d874884db71f71d162486acf4e054eab7e9 Reviewed-by: hjk --- src/plugins/git/gerrit/gerritserver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/git/gerrit/gerritserver.cpp b/src/plugins/git/gerrit/gerritserver.cpp index 7fc9ae4c7ef..9c891f457f3 100644 --- a/src/plugins/git/gerrit/gerritserver.cpp +++ b/src/plugins/git/gerrit/gerritserver.cpp @@ -120,7 +120,7 @@ QString GerritServer::url(UrlType urlType) const case Https: protocol = "https"; break; } QString res = protocol + "://"; - if (type == Ssh || urlType != DefaultUrl) + if (type == Ssh || urlType == UrlWithHttpUser) res += hostArgument(); else res += host;