blob: d8a49d7e10029e6306a9b5a1a920cd5005528c33 (
plain)
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
|
// 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 "propertyeditorvalue.h"
#include <qmlitemnode.h>
#include <QObject>
namespace QmlDesigner {
class QMLDESIGNERCORE_EXPORT QmlModelNodeProxy : public QObject
{
Q_OBJECT
Q_PROPERTY(QmlDesigner::ModelNode modelNode READ modelNode NOTIFY modelNodeChanged)
Q_PROPERTY(bool multiSelection READ multiSelection NOTIFY modelNodeChanged)
public:
explicit QmlModelNodeProxy(QObject *parent = nullptr);
void setup(const QmlObjectNode &objectNode);
static void registerDeclarativeType();
void emitSelectionToBeChanged();
void emitSelectionChanged();
QmlObjectNode qmlObjectNode() const;
ModelNode modelNode() const;
bool multiSelection() const;
QString nodeId() const;
QString simplifiedTypeName() const;
Q_INVOKABLE QList<int> allChildren(int internalId = -1) const;
Q_INVOKABLE QList<int> allChildrenOfType(const QString &typeName, int internalId = -1) const;
Q_INVOKABLE QString simplifiedTypeName(int internalId) const;
Q_INVOKABLE PropertyEditorSubSelectionWrapper *registerSubSelectionWrapper(int internalId);
Q_INVOKABLE void createModelNode(int internalIdParent,
const QString &property,
const QString &typeName,
const QString &requiredImport = {});
Q_INVOKABLE void moveNode(int internalIdParent,
const QString &propertyName,
int fromIndex,
int toIndex);
Q_INVOKABLE bool isInstanceOf(const QString &typeName, int internalId = -1) const;
Q_INVOKABLE void changeType(int internalId, const QString &typeName);
void handleInstancePropertyChanged(const ModelNode &modelNode, const PropertyName &propertyName);
void handleBindingPropertyChanged(const BindingProperty &property);
void handleVariantPropertyChanged(const VariantProperty &property);
void handlePropertiesRemoved(const AbstractProperty &property);
signals:
void modelNodeChanged();
void selectionToBeChanged();
void selectionChanged();
private:
QList<int> allChildren(const ModelNode &modelNode) const;
QList<int> allChildrenOfType(const ModelNode &modelNode, const QString &typeName) const;
PropertyEditorSubSelectionWrapper *findWrapper(int internalId) const;
QmlObjectNode m_qmlObjectNode;
QList<QSharedPointer<PropertyEditorSubSelectionWrapper>> m_subselection;
};
} //QmlDesigner
|