1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "designerpropertymap.h"
#include "propertyeditorcontextobject.h"
#include "propertyeditorvalue.h"
#include "qmlanchorbindingproxy.h"
#include "qmlmodelnodeproxy.h"
#include "quick2propertyeditorview.h"
#include <utils/uniqueobjectptr.h>
#include <nodemetainfo.h>
#include <QQmlPropertyMap>
class PropertyEditorValue;
namespace QmlDesigner {
class PropertyEditorTransaction;
class PropertyEditorView;
class PropertyEditorQmlBackend
{
Q_DISABLE_COPY(PropertyEditorQmlBackend)
public:
PropertyEditorQmlBackend(PropertyEditorView *propertyEditor,
class AsynchronousImageCache &imageCache);
~PropertyEditorQmlBackend();
void setup(const QmlObjectNode &fxObjectNode, const QString &stateName, const QUrl &qmlSpecificsFile, PropertyEditorView *propertyEditor);
void initialSetup(const TypeName &typeName, const QUrl &qmlSpecificsFile, PropertyEditorView *propertyEditor);
void setValue(const QmlObjectNode &fxObjectNode, const PropertyName &name, const QVariant &value);
void setExpression(const PropertyName &propName, const QString &exp);
QQmlContext *context();
PropertyEditorContextObject* contextObject();
QQuickWidget *widget();
void setSource(const QUrl& url);
QmlAnchorBindingProxy &backendAnchorBinding();
DesignerPropertyMap &backendValuesPropertyMap();
PropertyEditorTransaction *propertyEditorTransaction();
PropertyEditorValue *propertyValueForName(const QString &propertyName);
static QString propertyEditorResourcesPath();
#ifndef QDS_USE_PROJECTSTORAGE
static QString templateGeneration(const NodeMetaInfo &type,
const NodeMetaInfo &superType,
const QmlObjectNode &node);
static QUrl getQmlFileUrl(const TypeName &relativeTypeName, const NodeMetaInfo &info);
static std::tuple<QUrl, NodeMetaInfo> getQmlUrlForMetaInfo(const NodeMetaInfo &modelNode);
#endif
static bool checkIfUrlExists(const QUrl &url);
void emitSelectionToBeChanged();
void emitSelectionChanged();
void setValueforLayoutAttachedProperties(const QmlObjectNode &qmlObjectNode,
const PropertyName &name);
void setValueforInsightAttachedProperties(const QmlObjectNode &qmlObjectNode,
const PropertyName &name);
void setValueforAuxiliaryProperties(const QmlObjectNode &qmlObjectNode, AuxiliaryDataKeyView key);
void setupLayoutAttachedProperties(const QmlObjectNode &qmlObjectNode,
PropertyEditorView *propertyEditor);
void setupInsightAttachedProperties(const QmlObjectNode &qmlObjectNode,
PropertyEditorView *propertyEditor);
void setupAuxiliaryProperties(const QmlObjectNode &qmlObjectNode,
PropertyEditorView *propertyEditor);
void handleInstancePropertyChangedInModelNodeProxy(const ModelNode &modelNode,
const PropertyName &propertyName);
void handleVariantPropertyChangedInModelNodeProxy(const VariantProperty &property);
void handleBindingPropertyChangedInModelNodeProxy(const BindingProperty &property);
void handlePropertiesRemovedInModelNodeProxy(const AbstractProperty &property);
static NodeMetaInfo findCommonAncestor(const ModelNode &node);
private:
void createPropertyEditorValue(const QmlObjectNode &qmlObjectNode,
const PropertyName &name, const QVariant &value,
PropertyEditorView *propertyEditor);
void setupPropertyEditorValue(const PropertyName &name,
PropertyEditorView *propertyEditor,
const NodeMetaInfo &type);
static QUrl fileToUrl(const QString &filePath);
static QString fileFromUrl(const QUrl &url);
#ifndef QDS_USE_PROJECTSTORAGE
static TypeName qmlFileName(const NodeMetaInfo &nodeInfo);
static QString locateQmlFile(const NodeMetaInfo &info, const QString &relativePath);
#endif
static TypeName fixTypeNameForPanes(const TypeName &typeName);
private:
// 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;
QScopedPointer<PropertyEditorTransaction> m_propertyEditorTransaction;
QScopedPointer<PropertyEditorValue> m_dummyPropertyEditorValue;
QScopedPointer<PropertyEditorContextObject> m_contextObject;
};
} //QmlDesigner
|