aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@qt.io>2024-04-24 17:37:48 +0200
committerTim Jenssen <tim.jenssen@qt.io>2024-04-24 17:37:48 +0200
commit72f82f420a908e543728aa87bc8fc47135fc81b4 (patch)
tree771d9e85638fb208b9a38d39b7086000fa3657f9 /src
parentfa54261ad383c55d0b2eeb00a7d09e3ed54b15e1 (diff)
parentfb4e1c5a8e96a876d5abf3b01a4841033da5078d (diff)
Merge remote-tracking branch 'origin/qds/dev'
Diffstat (limited to 'src')
-rw-r--r--src/plugins/qmldesigner/components/collectioneditor/collectiondatatypemodel.cpp3
-rw-r--r--src/plugins/qmldesigner/components/collectioneditor/collectiondetails.cpp33
-rw-r--r--src/plugins/qmldesigner/components/collectioneditor/collectiondetails.h2
-rw-r--r--src/plugins/qmldesigner/components/collectioneditor/collectiondetailsmodel.cpp2
-rw-r--r--src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp11
-rw-r--r--src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu_helper.h28
-rw-r--r--src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp29
-rw-r--r--src/plugins/qmldesigner/components/componentcore/theme.cpp7
-rw-r--r--src/plugins/qmldesigner/components/contentlibrary/contentlibraryusermodel.cpp1
-rw-r--r--src/plugins/qmldesigner/components/edit3d/edit3dview.cpp3
-rw-r--r--src/plugins/qmldesigner/components/edit3d/edit3dview.h1
-rw-r--r--src/plugins/qmldesigner/components/materialeditor/materialeditorqmlbackend.h5
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp2
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp6
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h9
-rw-r--r--src/plugins/qmldesigner/components/textureeditor/textureeditorqmlbackend.cpp18
-rw-r--r--src/plugins/qmldesigner/components/textureeditor/textureeditorqmlbackend.h9
-rw-r--r--src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp4
18 files changed, 111 insertions, 62 deletions
diff --git a/src/plugins/qmldesigner/components/collectioneditor/collectiondatatypemodel.cpp b/src/plugins/qmldesigner/components/collectioneditor/collectiondatatypemodel.cpp
index cb306c58cb..9a534ec88e 100644
--- a/src/plugins/qmldesigner/components/collectioneditor/collectiondatatypemodel.cpp
+++ b/src/plugins/qmldesigner/components/collectioneditor/collectiondatatypemodel.cpp
@@ -23,7 +23,6 @@ const QList<CollectionDataTypeModel::Details> CollectionDataTypeModel::m_ordered
{DataType::Color, "Color", "HEX value"},
{DataType::Url, "Url", "Resource locator"},
{DataType::Boolean, "Boolean", "True/false"},
- {DataType::Unknown, "Unknown", "Unknown data type"},
};
CollectionDataTypeModel::CollectionDataTypeModel(QObject *parent)
@@ -76,7 +75,7 @@ CollectionDetails::DataType CollectionDataTypeModel::dataTypeFromString(const QS
if (stringTypeHash.contains(dataType))
return stringTypeHash.value(dataType);
- return DataType::Unknown;
+ return DataType::String;
}
void CollectionDataTypeModel::registerDeclarativeType()
diff --git a/src/plugins/qmldesigner/components/collectioneditor/collectiondetails.cpp b/src/plugins/qmldesigner/components/collectioneditor/collectiondetails.cpp
index 8b506affc4..a391d9bb1f 100644
--- a/src/plugins/qmldesigner/components/collectioneditor/collectiondetails.cpp
+++ b/src/plugins/qmldesigner/components/collectioneditor/collectiondetails.cpp
@@ -64,7 +64,7 @@ inline static bool isValidColorName(const QString &colorName)
*
* @param value The input value to be evaluated
* @param dataType if the value is a valid url, the data type
- * will be stored to this parameter, otherwise, it will be Unknown
+ * will be stored to this parameter, otherwise, it will be String
* @param urlResult if the value is a valid url, the address
* will be stored in this parameter, otherwise it will be empty.
* @return true if the result is url
@@ -97,15 +97,15 @@ static bool getCustomUrl(const QString &value,
if (urlResult)
urlResult->clear();
- dataType = CollectionDetails::DataType::Unknown;
+ dataType = CollectionDetails::DataType::String;
return false;
}
/**
* @brief dataTypeFromString
* @param value The string value to be evaluated
- * @return Unknown if the string is empty, But returns Bool, Color, Integer,
- * Real, Url, Image if these types are detected within the non-empty string,
+ * @return Bool, Color, Integer, Real, Url,
+ * Image if these types are detected within the non-empty string,
* Otherwise it returns String.
* If the value is integer, but it's out of the int range, it will be
* considered as a Real.
@@ -131,7 +131,7 @@ static CollectionDetails::DataType dataTypeFromString(const QString &value)
}({boolIndex, colorIndex, integerIndex, realIndex});
if (value.isEmpty())
- return DataType::Unknown;
+ return DataType::String;
const QString trimmedValue = value.trimmed();
QRegularExpressionMatch match = validator.match(trimmedValue);
@@ -163,7 +163,7 @@ static CollectionProperty::DataType dataTypeFromJsonValue(const QJsonValue &valu
switch (value.type()) {
case JsonType::Null:
case JsonType::Undefined:
- return DataType::Unknown;
+ return DataType::String;
case JsonType::Bool:
return DataType::Boolean;
case JsonType::Double: {
@@ -174,7 +174,7 @@ static CollectionProperty::DataType dataTypeFromJsonValue(const QJsonValue &valu
case JsonType::String:
return dataTypeFromString(value.toString());
default:
- return DataType::Unknown;
+ return DataType::String;
}
}
@@ -195,9 +195,7 @@ static QList<CollectionProperty> getColumnsFromImportedJsonArray(const QJsonArra
const QString propertyName = element.key();
if (resultSet.contains(propertyName)) {
CollectionProperty &property = result[resultSet.value(propertyName)];
- if (property.type == DataType::Unknown) {
- property.type = dataTypeFromJsonValue(element.value());
- } else if (property.type == DataType::Integer) {
+ if (property.type == DataType::Integer) {
const DataType currentCellDataType = dataTypeFromJsonValue(element.value());
if (currentCellDataType == DataType::Real)
property.type = currentCellDataType;
@@ -239,21 +237,10 @@ static QVariant valueToVariant(const QJsonValue &value, CollectionDetails::DataT
}
static QJsonValue variantToJsonValue(
- const QVariant &variant, CollectionDetails::DataType type = CollectionDetails::DataType::Unknown)
+ const QVariant &variant, CollectionDetails::DataType type = CollectionDetails::DataType::String)
{
- using VariantType = QVariant::Type;
using DataType = CollectionDetails::DataType;
- if (type == CollectionDetails::DataType::Unknown) {
- static const QHash<VariantType, DataType> typeMap = {{VariantType::Bool, DataType::Boolean},
- {VariantType::Double, DataType::Real},
- {VariantType::Int, DataType::Integer},
- {VariantType::String, DataType::String},
- {VariantType::Color, DataType::Color},
- {VariantType::Url, DataType::Url}};
- type = typeMap.value(variant.type(), DataType::Unknown);
- }
-
switch (type) {
case DataType::Boolean:
return variant.toBool();
@@ -575,7 +562,7 @@ DataTypeWarning::Warning CollectionDetails::cellWarningCheck(int row, int column
const DataType columnType = typeAt(column);
const DataType cellType = typeAt(row, column);
- if (columnType == DataType::Unknown || isEmptyJsonValue(cellValue))
+ if (isEmptyJsonValue(cellValue))
return DataTypeWarning::Warning::None;
if ((columnType == DataType::String || columnType == DataType::Real) && cellType == DataType::Integer)
diff --git a/src/plugins/qmldesigner/components/collectioneditor/collectiondetails.h b/src/plugins/qmldesigner/components/collectioneditor/collectiondetails.h
index b84c214570..7243c585c6 100644
--- a/src/plugins/qmldesigner/components/collectioneditor/collectiondetails.h
+++ b/src/plugins/qmldesigner/components/collectioneditor/collectiondetails.h
@@ -90,7 +90,7 @@ public:
void insertColumn(const QString &propertyName,
int colIdx = -1,
const QVariant &defaultValue = {},
- DataType type = DataType::Unknown);
+ DataType type = DataType::String);
bool removeColumns(int colIdx, int count = 1);
void insertEmptyRows(int row = 0, int count = 1);
diff --git a/src/plugins/qmldesigner/components/collectioneditor/collectiondetailsmodel.cpp b/src/plugins/qmldesigner/components/collectioneditor/collectiondetailsmodel.cpp
index d2917ec302..fcd6d686ef 100644
--- a/src/plugins/qmldesigner/components/collectioneditor/collectiondetailsmodel.cpp
+++ b/src/plugins/qmldesigner/components/collectioneditor/collectiondetailsmodel.cpp
@@ -197,7 +197,7 @@ QVariant CollectionDetailsModel::headerData(int section, Qt::Orientation orienta
CollectionDetails::DataType CollectionDetailsModel::propertyDataType(int column) const
{
- QTC_ASSERT(m_currentCollection.hasValidReference(), return CollectionDetails::DataType::Unknown);
+ QTC_ASSERT(m_currentCollection.hasValidReference(), return CollectionDetails::DataType::String);
return m_currentCollection.typeAt(column);
}
diff --git a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp
index 4e32237ee9..8d2b2c43c2 100644
--- a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp
@@ -61,11 +61,6 @@ inline static QString captionForModelNode(const ModelNode &modelNode)
return modelNode.id();
}
-inline static bool contains(const QmlItemNode &node, const QPointF &position)
-{
- return node.isValid() && node.instanceSceneTransform().mapRect(node.instanceBoundingRect()).contains(position);
-}
-
DesignerActionManagerView *DesignerActionManager::view()
{
return m_designerActionManagerView;
@@ -438,8 +433,8 @@ public:
}
for (const ModelNode &node : selectionContext().view()->allModelNodes()) {
if (node != selectionContext().currentSingleSelectedNode() && node != parentNode
- && contains(node, selectionContext().scenePosition()) && !node.isRootNode()
- && !ModelUtils::isThisOrAncestorLocked(node)) {
+ && SelectionContextHelpers::contains(node, selectionContext().scenePosition())
+ && !node.isRootNode() && !ModelUtils::isThisOrAncestorLocked(node)) {
selectionContext().setTargetNode(node);
QString what = QString(QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Select: %1")).arg(captionForModelNode(node));
ActionTemplate *selectionAction = new ActionTemplate("SELECT", what, &ModelNodeOperations::select);
@@ -1971,7 +1966,7 @@ void DesignerActionManager::createDefaultDesignerActions()
QKeySequence(),
Priorities::ComponentActions + 1,
&editIn3dView,
- &singleSelectionView3D,
+ &SelectionContextFunctors::always, // If action is visible, it is usable
&singleSelectionView3D));
addDesignerAction(new ModelNodeContextMenuAction(
diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu_helper.h b/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu_helper.h
index eb4915b1d0..aec14e9d04 100644
--- a/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu_helper.h
+++ b/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu_helper.h
@@ -25,6 +25,16 @@ namespace QmlDesigner {
using SelectionContextPredicate = std::function<bool (const SelectionContext&)>;
using SelectionContextOperation = std::function<void (const SelectionContext&)>;
+namespace SelectionContextHelpers {
+
+inline bool contains(const QmlItemNode &node, const QPointF &position)
+{
+ return node.isValid()
+ && node.instanceSceneTransform().mapRect(node.instanceBoundingRect()).contains(position);
+}
+
+} // namespace SelectionContextHelpers
+
namespace SelectionContextFunctors {
inline bool always(const SelectionContext &)
@@ -99,8 +109,22 @@ inline bool singleSelectionNotRoot(const SelectionContext &selectionState)
inline bool singleSelectionView3D(const SelectionContext &selectionState)
{
- return selectionState.singleNodeIsSelected()
- && selectionState.currentSingleSelectedNode().metaInfo().isQtQuick3DView3D();
+ if (selectionState.singleNodeIsSelected()
+ && selectionState.currentSingleSelectedNode().metaInfo().isQtQuick3DView3D()) {
+ return true;
+ }
+
+ // If currently selected node is not View3D, check if there is a View3D under the cursor.
+ if (!selectionState.scenePosition().isNull()) {
+ // Assumption is that last match in allModelNodes() list is the topmost one.
+ const QList<ModelNode> allNodes = selectionState.view()->allModelNodes();
+ for (int i = allNodes.size() - 1; i >= 0; --i) {
+ if (SelectionContextHelpers::contains(allNodes[i], selectionState.scenePosition()))
+ return allNodes[i].metaInfo().isQtQuick3DView3D();
+ }
+ }
+
+ return false;
}
inline bool selectionHasProperty(const SelectionContext &selectionState, const char *property)
diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
index a5274c70e2..c24ec9aa3e 100644
--- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
@@ -1685,16 +1685,37 @@ void updateImported3DAsset(const SelectionContext &selectionContext)
void editIn3dView(const SelectionContext &selectionContext)
{
- if (selectionContext.view() && selectionContext.hasSingleSelectedModelNode()
+ if (!selectionContext.view())
+ return;
+
+ ModelNode targetNode;
+
+ if (selectionContext.hasSingleSelectedModelNode()
&& selectionContext.currentSingleSelectedNode().metaInfo().isQtQuick3DView3D()) {
+ targetNode = selectionContext.currentSingleSelectedNode();
+ }
+
+ const QPointF scenePos = selectionContext.scenePosition();
+ if (!targetNode.isValid() && !scenePos.isNull()) {
+ // If currently selected node is not View3D, check if there is a View3D under the cursor.
+ // Assumption is that last match in allModelNodes() list is the topmost one.
+ const QList<ModelNode> allNodes = selectionContext.view()->allModelNodes();
+ for (int i = allNodes.size() - 1; i >= 0; --i) {
+ if (SelectionContextHelpers::contains(allNodes[i], selectionContext.scenePosition())) {
+ if (allNodes[i].metaInfo().isQtQuick3DView3D())
+ targetNode = allNodes[i];
+ break;
+ }
+ }
+ }
+
+ if (targetNode.isValid()) {
QmlDesignerPlugin::instance()->mainWidget()->showDockWidget("Editor3D", true);
- const QPointF scenePos = selectionContext.scenePosition();
if (scenePos.isNull()) {
selectionContext.view()->emitView3DAction(View3DActionType::AlignViewToCamera, true);
} else {
selectionContext.view()->emitCustomNotification("pick_3d_node_from_2d_scene",
- {selectionContext.currentSingleSelectedNode()},
- {scenePos});
+ {targetNode}, {scenePos});
}
}
}
diff --git a/src/plugins/qmldesigner/components/componentcore/theme.cpp b/src/plugins/qmldesigner/components/componentcore/theme.cpp
index af495fd3b5..ef618447e7 100644
--- a/src/plugins/qmldesigner/components/componentcore/theme.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/theme.cpp
@@ -10,6 +10,7 @@
#include <utils/stylehelper.h>
+#include <qqml.h>
#include <QApplication>
#include <QMainWindow>
#include <QPointer>
@@ -18,7 +19,7 @@
#include <QQmlProperty>
#include <QRegularExpression>
#include <QScreen>
-#include <qqml.h>
+#include <QWindow>
static Q_LOGGING_CATEGORY(themeLog, "qtc.qmldesigner.theme", QtWarningMsg)
@@ -140,7 +141,9 @@ bool Theme::highPixelDensity() const
QWindow *Theme::mainWindowHandle() const
{
- return Core::ICore::mainWindow()->windowHandle();
+ QWindow *handle = Core::ICore::mainWindow()->windowHandle();
+ QQmlEngine::setObjectOwnership(handle, QJSEngine::CppOwnership);
+ return handle;
}
QPixmap Theme::getPixmap(const QString &id)
diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibraryusermodel.cpp b/src/plugins/qmldesigner/components/contentlibrary/contentlibraryusermodel.cpp
index 18d6e45fa8..ed9723a151 100644
--- a/src/plugins/qmldesigner/components/contentlibrary/contentlibraryusermodel.cpp
+++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibraryusermodel.cpp
@@ -4,6 +4,7 @@
#include "contentlibraryusermodel.h"
#include "contentlibrarybundleimporter.h"
+#include "contentlibraryeffect.h"
#include "contentlibrarymaterial.h"
#include "contentlibrarymaterialscategory.h"
#include "contentlibrarytexture.h"
diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp
index a20904b2e5..4712b048b1 100644
--- a/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp
+++ b/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp
@@ -462,6 +462,7 @@ void Edit3DView::customNotification([[maybe_unused]] const AbstractView *view,
self->emitView3DAction(View3DActionType::GetNodeAtMainScenePos,
QVariantList{data[0], nodeList[0].internalId()});
self->m_nodeAtPosReqType = NodeAtPosReqType::MainScenePick;
+ self->m_pickView3dNode = nodeList[0];
});
}
}
@@ -514,6 +515,8 @@ void Edit3DView::nodeAtPosReady(const ModelNode &modelNode, const QVector3D &pos
} else if (m_nodeAtPosReqType == NodeAtPosReqType::MainScenePick) {
if (modelNode.isValid())
setSelectedModelNode(modelNode);
+ else if (m_pickView3dNode.isValid() && !m_pickView3dNode.isSelected())
+ setSelectedModelNode(m_pickView3dNode);
emitView3DAction(View3DActionType::AlignViewToCamera, true);
}
diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dview.h b/src/plugins/qmldesigner/components/edit3d/edit3dview.h
index fad87aae1f..ade2ef6a8f 100644
--- a/src/plugins/qmldesigner/components/edit3d/edit3dview.h
+++ b/src/plugins/qmldesigner/components/edit3d/edit3dview.h
@@ -189,6 +189,7 @@ private:
QList<SplitToolState> m_splitToolStates;
QList<Edit3DAction *> m_flyModeDisabledActions;
ModelNode m_contextMenuPendingNode;
+ ModelNode m_pickView3dNode;
double m_previousCameraSpeed = -1.;
double m_previousCameraMultiplier = -1.;
diff --git a/src/plugins/qmldesigner/components/materialeditor/materialeditorqmlbackend.h b/src/plugins/qmldesigner/components/materialeditor/materialeditorqmlbackend.h
index 6f9d6014e9..0792a635ca 100644
--- a/src/plugins/qmldesigner/components/materialeditor/materialeditorqmlbackend.h
+++ b/src/plugins/qmldesigner/components/materialeditor/materialeditorqmlbackend.h
@@ -60,10 +60,13 @@ private:
MaterialEditorView *materialEditor);
PropertyName auxNamePostFix(const PropertyName &propertyName);
+ // to avoid a crash while destructing DesignerPropertyMap in the QQmlData
+ // this needs be destructed after m_quickWidget->engine() is destructed
+ DesignerPropertyMap m_backendValuesPropertyMap;
+
Utils::UniqueObjectPtr<QQuickWidget> m_quickWidget = nullptr;
QmlAnchorBindingProxy m_backendAnchorBinding;
QmlModelNodeProxy m_backendModelNode;
- DesignerPropertyMap m_backendValuesPropertyMap;
QScopedPointer<MaterialEditorTransaction> m_materialEditorTransaction;
QScopedPointer<MaterialEditorContextObject> m_contextObject;
QPointer<MaterialEditorImageProvider> m_materialEditorImageProvider;
diff --git a/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp
index fdd58c77a3..4898366619 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp
@@ -274,6 +274,8 @@ PropertyEditorValue *DynamicPropertyRow::createProxyBackendValue()
auto *newValue = new PropertyEditorValue(this);
m_proxyBackendValues.append(newValue);
+ QQmlEngine::setObjectOwnership(newValue, QJSEngine::CppOwnership);
+
return newValue;
}
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
index 6f3242a18e..eea53c3f5a 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
@@ -82,10 +82,10 @@ namespace QmlDesigner {
PropertyEditorQmlBackend::PropertyEditorQmlBackend(PropertyEditorView *propertyEditor,
AsynchronousImageCache &imageCache)
- : m_view(new Quick2PropertyEditorView(imageCache))
+ : m_view(Utils::makeUniqueObjectPtr<Quick2PropertyEditorView>(imageCache))
, m_propertyEditorTransaction(new PropertyEditorTransaction(propertyEditor))
, m_dummyPropertyEditorValue(new PropertyEditorValue())
- , m_contextObject(new PropertyEditorContextObject(m_view))
+ , m_contextObject(new PropertyEditorContextObject(m_view.get()))
{
m_view->engine()->setOutputWarningsToStandardError(QmlDesignerPlugin::instance()
->settings().value(DesignerSettingsKey::SHOW_PROPERTYEDITOR_WARNINGS).toBool());
@@ -407,7 +407,7 @@ PropertyEditorContextObject *PropertyEditorQmlBackend::contextObject()
QQuickWidget *PropertyEditorQmlBackend::widget()
{
- return m_view;
+ return m_view.get();
}
void PropertyEditorQmlBackend::setSource(const QUrl &url)
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h
index d4e158fca4..120b7b4abc 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h
@@ -10,6 +10,8 @@
#include "qmlmodelnodeproxy.h"
#include "quick2propertyeditorview.h"
+#include <utils/uniqueobjectptr.h>
+
#include <nodemetainfo.h>
#include <QQmlPropertyMap>
@@ -100,10 +102,13 @@ private:
static TypeName fixTypeNameForPanes(const TypeName &typeName);
private:
- Quick2PropertyEditorView *m_view;
+ // to avoid a crash while destructing DesignerPropertyMap in the QQmlData
+ // this needs be destructed after m_quickWidget->engine() is destructed
+ DesignerPropertyMap m_backendValuesPropertyMap;
+
+ Utils::UniqueObjectPtr<Quick2PropertyEditorView> m_view = nullptr;
QmlAnchorBindingProxy m_backendAnchorBinding;
QmlModelNodeProxy m_backendModelNode;
- DesignerPropertyMap m_backendValuesPropertyMap;
QScopedPointer<PropertyEditorTransaction> m_propertyEditorTransaction;
QScopedPointer<PropertyEditorValue> m_dummyPropertyEditorValue;
QScopedPointer<PropertyEditorContextObject> m_contextObject;
diff --git a/src/plugins/qmldesigner/components/textureeditor/textureeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/textureeditor/textureeditorqmlbackend.cpp
index 80cf5693d2..972574554b 100644
--- a/src/plugins/qmldesigner/components/textureeditor/textureeditorqmlbackend.cpp
+++ b/src/plugins/qmldesigner/components/textureeditor/textureeditorqmlbackend.cpp
@@ -43,17 +43,17 @@ static QObject *variantToQObject(const QVariant &value)
namespace QmlDesigner {
TextureEditorQmlBackend::TextureEditorQmlBackend(TextureEditorView *textureEditor, AsynchronousImageCache &imageCache)
- : m_view(new QQuickWidget)
+ : m_quickWidget(new QQuickWidget)
, m_textureEditorTransaction(new TextureEditorTransaction(textureEditor))
- , m_contextObject(new TextureEditorContextObject(m_view->rootContext()))
+ , m_contextObject(new TextureEditorContextObject(m_quickWidget->rootContext()))
{
QImage defaultImage;
defaultImage.load(Utils::StyleHelper::dpiSpecificImageFile(":/textureeditor/images/texture_default.png"));
m_textureEditorImageProvider = new AssetImageProvider(imageCache, defaultImage);
- m_view->setResizeMode(QQuickWidget::SizeRootObjectToView);
- m_view->setObjectName(Constants::OBJECT_NAME_TEXTURE_EDITOR);
- m_view->engine()->addImportPath(propertyEditorResourcesPath() + "/imports");
- m_view->engine()->addImageProvider("qmldesigner_thumbnails", m_textureEditorImageProvider);
+ m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
+ m_quickWidget->setObjectName(Constants::OBJECT_NAME_TEXTURE_EDITOR);
+ m_quickWidget->engine()->addImportPath(propertyEditorResourcesPath() + "/imports");
+ m_quickWidget->engine()->addImageProvider("qmldesigner_thumbnails", m_textureEditorImageProvider);
m_contextObject->setBackendValues(&m_backendValuesPropertyMap);
m_contextObject->setModel(textureEditor->model());
context()->setContextObject(m_contextObject.data());
@@ -154,7 +154,7 @@ void TextureEditorQmlBackend::setValue(const QmlObjectNode &, const PropertyName
QQmlContext *TextureEditorQmlBackend::context() const
{
- return m_view->rootContext();
+ return m_quickWidget->rootContext();
}
TextureEditorContextObject *TextureEditorQmlBackend::contextObject() const
@@ -164,12 +164,12 @@ TextureEditorContextObject *TextureEditorQmlBackend::contextObject() const
QQuickWidget *TextureEditorQmlBackend::widget() const
{
- return m_view;
+ return m_quickWidget.get();
}
void TextureEditorQmlBackend::setSource(const QUrl &url)
{
- m_view->setSource(url);
+ m_quickWidget->setSource(url);
}
QmlAnchorBindingProxy &TextureEditorQmlBackend::backendAnchorBinding()
diff --git a/src/plugins/qmldesigner/components/textureeditor/textureeditorqmlbackend.h b/src/plugins/qmldesigner/components/textureeditor/textureeditorqmlbackend.h
index b6d3fddf22..c8a113f7d3 100644
--- a/src/plugins/qmldesigner/components/textureeditor/textureeditorqmlbackend.h
+++ b/src/plugins/qmldesigner/components/textureeditor/textureeditorqmlbackend.h
@@ -7,6 +7,8 @@
#include "qmlanchorbindingproxy.h"
#include "qmlmodelnodeproxy.h"
+#include <utils/uniqueobjectptr.h>
+
#include <nodemetainfo.h>
class PropertyEditorValue;
@@ -58,10 +60,13 @@ private:
TextureEditorView *textureEditor);
PropertyName auxNamePostFix(const PropertyName &propertyName);
- QQuickWidget *m_view = nullptr;
+ // to avoid a crash while destructing DesignerPropertyMap in the QQmlData
+ // this needs be destructed after m_quickWidget->engine() is destructed
+ DesignerPropertyMap m_backendValuesPropertyMap;
+
+ Utils::UniqueObjectPtr<QQuickWidget> m_quickWidget = nullptr;
QmlAnchorBindingProxy m_backendAnchorBinding;
QmlModelNodeProxy m_backendModelNode;
- DesignerPropertyMap m_backendValuesPropertyMap;
QScopedPointer<TextureEditorTransaction> m_textureEditorTransaction;
QScopedPointer<TextureEditorContextObject> m_contextObject;
AssetImageProvider *m_textureEditorImageProvider = nullptr;
diff --git a/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
index c7cab45ed4..6cd39a5a85 100644
--- a/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
+++ b/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
@@ -490,9 +490,9 @@ void Qt5InformationNodeInstanceServer::getNodeAtMainScenePos(
auto viewObj = qobject_cast<QQuick3DViewport *>(view.internalObject());
if (viewObj) {
- // Render the main view to make sure everything is up to date
+ // Render the target View3D to make sure everything is up to date
updateNodesRecursive(viewObj);
- renderWindow();
+ grabItem(viewObj);
QPointF viewPos = viewObj->mapFromScene(pos);