aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp')
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp115
1 files changed, 72 insertions, 43 deletions
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
index 48d3b0e236..7cf2784a7d 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
@@ -25,53 +25,57 @@
#include "nodeinstanceview.h"
-#include <model.h>
-#include <modelnode.h>
-#include <metainfo.h>
-#include <nodehints.h>
-#include <rewriterview.h>
#include "abstractproperty.h"
-#include "variantproperty.h"
#include "bindingproperty.h"
+#include "changeauxiliarycommand.h"
+#include "changebindingscommand.h"
+#include "changefileurlcommand.h"
+#include "changeidscommand.h"
+#include "changelanguagecommand.h"
+#include "changenodesourcecommand.h"
+#include "changepreviewimagesizecommand.h"
+#include "changeselectioncommand.h"
+#include "changestatecommand.h"
+#include "changevaluescommand.h"
+#include "childrenchangedcommand.h"
+#include "clearscenecommand.h"
+#include "completecomponentcommand.h"
+#include "componentcompletedcommand.h"
+#include "createinstancescommand.h"
+#include "createscenecommand.h"
+#include "debugoutputcommand.h"
+#include "informationchangedcommand.h"
+#include "inputeventcommand.h"
#include "nodeabstractproperty.h"
+#include "nodeinstanceserverproxy.h"
#include "nodelistproperty.h"
#include "nodeproperty.h"
+#include "pixmapchangedcommand.h"
+#include "puppettocreatorcommand.h"
#include "qmlchangeset.h"
+#include "qmldesignerconstants.h"
#include "qmlstate.h"
#include "qmltimeline.h"
#include "qmltimelinekeyframegroup.h"
#include "qmlvisualnode.h"
-#include "qmldesignerconstants.h"
-#include "createscenecommand.h"
-#include "createinstancescommand.h"
-#include "clearscenecommand.h"
-#include "changefileurlcommand.h"
-#include "reparentinstancescommand.h"
-#include "update3dviewstatecommand.h"
-#include "changevaluescommand.h"
-#include "changeauxiliarycommand.h"
-#include "changebindingscommand.h"
-#include "changeidscommand.h"
-#include "changeselectioncommand.h"
-#include "changenodesourcecommand.h"
#include "removeinstancescommand.h"
#include "removepropertiescommand.h"
-#include "valueschangedcommand.h"
-#include "pixmapchangedcommand.h"
-#include "informationchangedcommand.h"
-#include "changestatecommand.h"
-#include "childrenchangedcommand.h"
+#include "removesharedmemorycommand.h"
+#include "reparentinstancescommand.h"
#include "statepreviewimagechangedcommand.h"
-#include "completecomponentcommand.h"
-#include "componentcompletedcommand.h"
#include "tokencommand.h"
-#include "removesharedmemorycommand.h"
-#include "debugoutputcommand.h"
-#include "nodeinstanceserverproxy.h"
-#include "puppettocreatorcommand.h"
-#include "inputeventcommand.h"
+#include "update3dviewstatecommand.h"
+#include "valueschangedcommand.h"
+#include "variantproperty.h"
#include "view3dactioncommand.h"
+#include <designersettings.h>
+#include <metainfo.h>
+#include <model.h>
+#include <modelnode.h>
+#include <nodehints.h>
+#include <rewriterview.h>
+
#ifndef QMLDESIGNER_TEST
#include <qmldesignerplugin.h>
#include <coreplugin/actionmanager/actionmanager.h>
@@ -79,6 +83,10 @@
#include <coreplugin/documentmanager.h>
#endif
+#include <projectexplorer/target.h>
+
+#include <qmlprojectmanager/qmlmultilanguageaspect.h>
+
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
@@ -536,6 +544,17 @@ void NodeInstanceView::auxiliaryDataChanged(const ModelNode &node,
}
}
}
+ } else if (node.isRootNode() && name == "language@Internal") {
+ const QString languageAsString = value.toString();
+ if (m_currentTarget) {
+ if (auto rc = m_currentTarget->activeRunConfiguration()) {
+ if (auto multiLanguageAspect = rc->aspect<QmlProjectManager::QmlMultiLanguageAspect>())
+ multiLanguageAspect->setLastUsedLanguage(languageAsString);
+ }
+ }
+ nodeInstanceServer()->changeLanguage({languageAsString});
+ } else if (node.isRootNode() && name == "previewSize@Internal") {
+ nodeInstanceServer()->changePreviewImageSize(value.toSize());
}
}
@@ -939,7 +958,7 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand()
QVector<MockupTypeContainer> mockupTypesVector;
- for (const CppTypeData &cppTypeData : model()->rewriterView()->getCppTypes()) {
+ for (const QmlTypeData &cppTypeData : model()->rewriterView()->getQMLTypes()) {
const QString versionString = cppTypeData.versionString;
int majorVersion = -1;
int minorVersion = -1;
@@ -974,17 +993,27 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand()
}
}
+ QString lastUsedLanguage;
+ if (m_currentTarget) {
+ if (auto rc = m_currentTarget->activeRunConfiguration()) {
+ if (auto multiLanguageAspect = rc->aspect<QmlProjectManager::QmlMultiLanguageAspect>())
+ lastUsedLanguage = multiLanguageAspect->lastUsedLanguage();
+ }
+ }
- return CreateSceneCommand(instanceContainerList,
- reparentContainerList,
- idContainerList,
- valueContainerList,
- bindingContainerList,
- auxiliaryContainerVector,
- importVector,
- mockupTypesVector,
- model()->fileUrl(),
- m_edit3DToolStates[model()->fileUrl()]);
+ return CreateSceneCommand(
+ instanceContainerList,
+ reparentContainerList,
+ idContainerList,
+ valueContainerList,
+ bindingContainerList,
+ auxiliaryContainerVector,
+ importVector,
+ mockupTypesVector,
+ model()->fileUrl(),
+ m_edit3DToolStates[model()->fileUrl()],
+ lastUsedLanguage
+ );
}
ClearSceneCommand NodeInstanceView::createClearSceneCommand() const
@@ -1247,7 +1276,7 @@ void NodeInstanceView::valuesModified(const ValuesModifiedCommand &command)
if (instance.isValid()) {
// QmlVisualNode is needed so timeline and state are updated
QmlVisualNode node = instance.modelNode();
- if (node.instanceValue(container.name()) != container.value())
+ if (node.modelValue(container.name()) != container.value())
node.setVariantProperty(container.name(), container.value());
}
}