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 f9256ea592f..341a77a0d0d 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp @@ -549,6 +549,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 7d6c39e6f19..69128f0c3ab 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -861,8 +861,19 @@ void Qt5InformationNodeInstanceServer::updateActiveSceneToEditView3D([[maybe_unu 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); + } + } + } #endif } @@ -2163,6 +2174,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; @@ -2170,6 +2219,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); } } @@ -2268,6 +2321,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/git/gerrit/gerritserver.cpp b/src/plugins/git/gerrit/gerritserver.cpp index df8f7dcd370..253d2a3004a 100644 --- a/src/plugins/git/gerrit/gerritserver.cpp +++ b/src/plugins/git/gerrit/gerritserver.cpp @@ -122,7 +122,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; diff --git a/src/plugins/languageclient/languageclientoutline.cpp b/src/plugins/languageclient/languageclientoutline.cpp index 0da48f6e8ea..6928edeccfe 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 diff --git a/src/plugins/python/pythonsettings.cpp b/src/plugins/python/pythonsettings.cpp index 41709a74b18..66a86a4f880 100644 --- a/src/plugins/python/pythonsettings.cpp +++ b/src/plugins/python/pythonsettings.cpp @@ -928,7 +928,7 @@ QList PythonSettings::detectPythonVenvs(const FilePath &path) dir.cdUp(); } } - } while (dir.cdUp()); + } while (dir.cdUp() && !(dir.isRoot() && Utils::HostOsInfo::isAnyUnixHost())); } return result; } diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp index 99a6b6be991..768e121e6df 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp +++ b/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp @@ -332,6 +332,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 @@ -563,6 +578,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";