forked from qt-creator/qt-creator
Merge "Merge remote-tracking branch 'origin/8.0'"
This commit is contained in:
@@ -59,6 +59,7 @@ public:
|
||||
SelectBackgroundColor,
|
||||
SelectGridColor,
|
||||
ResetBackgroundColor,
|
||||
SyncBackgroundColor,
|
||||
GetModelAtPos
|
||||
};
|
||||
|
||||
|
@@ -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 }
|
||||
@@ -76,6 +77,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);
|
||||
@@ -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)
|
||||
|
@@ -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)
|
||||
|
@@ -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;
|
||||
|
@@ -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<QQuick3DNode *> &nodes);
|
||||
@@ -136,6 +139,7 @@ private:
|
||||
QTimer m_toolStateUpdateTimer;
|
||||
QHash<QString, QVariantMap> m_toolStates;
|
||||
QHash<QString, QVariantMap> m_toolStatesPending;
|
||||
QHash<QString, QColor> m_sceneEnvironmentColor;
|
||||
QSet<QQuick3DNode *> m_rotationBlockedNodes;
|
||||
|
||||
struct MultiSelData {
|
||||
|
@@ -861,8 +861,19 @@ void Qt5InformationNodeInstanceServer::updateActiveSceneToEditView3D([[maybe_unu
|
||||
updateView3DRect(m_active3DView);
|
||||
|
||||
auto helper = qobject_cast<QmlDesigner::Internal::GeneralHelper *>(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<QmlDesigner::Internal::GeneralHelper *>(m_3dHelper);
|
||||
if (!helper || !hasInstanceForId(container.instanceId()) || !m_active3DView)
|
||||
return;
|
||||
|
||||
ServerNodeInstance sceneEnvInstance = instanceForId(container.instanceId());
|
||||
if (!sceneEnvInstance.isSubclassOf("QQuick3DSceneEnvironment"))
|
||||
return;
|
||||
|
||||
auto activeView = qobject_cast<QQuick3DViewport *>(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<QColor>();
|
||||
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;
|
||||
|
@@ -154,6 +154,7 @@ private:
|
||||
void resetParticleSystem();
|
||||
void handleParticleSystemDeselected();
|
||||
#endif
|
||||
void setSceneEnvironmentColor(const PropertyValueContainer &container);
|
||||
|
||||
RenderViewData m_editView3DData;
|
||||
RenderViewData m_modelNode3DImageViewData;
|
||||
|
@@ -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;
|
||||
|
@@ -255,6 +255,7 @@ LanguageClientOutlineWidget::LanguageClientOutlineWidget(Client *client,
|
||||
if (m_sync)
|
||||
updateSelectionInTree(m_editor->textCursor());
|
||||
});
|
||||
setFocusProxy(&m_view);
|
||||
}
|
||||
|
||||
QList<QAction *> LanguageClientOutlineWidget::filterMenuActions() const
|
||||
|
@@ -928,7 +928,7 @@ QList<Interpreter> PythonSettings::detectPythonVenvs(const FilePath &path)
|
||||
dir.cdUp();
|
||||
}
|
||||
}
|
||||
} while (dir.cdUp());
|
||||
} while (dir.cdUp() && !(dir.isRoot() && Utils::HostOsInfo::isAnyUnixHost()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
|
@@ -88,6 +88,7 @@ private:
|
||||
Edit3DAction *createSelectBackgrounColorAction();
|
||||
Edit3DAction *createGridColorSelectionAction();
|
||||
Edit3DAction *createResetColorAction();
|
||||
Edit3DAction *createSyncBackgroundColorAction();
|
||||
|
||||
QPointer<Edit3DWidget> m_edit3DWidget;
|
||||
QVector<Edit3DAction *> m_leftActions;
|
||||
|
@@ -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";
|
||||
|
Reference in New Issue
Block a user