nodeinstance.h 1.83 KB
Newer Older
1
2
#ifndef PROXYNODEINSTANCE_H
#define PROXYNODEINSTANCE_H
3
4

#include <QSharedPointer>
5
6
7
8
#include <QTransform>
#include <QPointF>
#include <QSizeF>
#include <QPair>
9

10
#include "commondefines.h"
11
12
13
14
15

namespace QmlDesigner {

class ModelNode;
class NodeInstanceView;
16
class ProxyNodeInstanceData;
17

18
class NodeInstance
19
{
20
    friend class NodeInstanceView;
21
public:
22
    static NodeInstance create(const ModelNode &node, qint32 instanceId);
23
24
25
26
27
28
29
30
    NodeInstance();
    ~NodeInstance();
    NodeInstance(const NodeInstance &other);
    NodeInstance& operator=(const NodeInstance &other);

    ModelNode modelNode() const;
    bool isValid() const;
    void makeInvalid();
31
    QRectF boundingRect() const;
32
    bool hasContent() const;
33
34
    bool isAnchoredBySibling() const;
    bool isAnchoredByChildren() const;
35
36
37
38
39
40
41
    bool isMovable() const;
    bool isResizable() const;
    QTransform transform() const;
    QTransform sceneTransform() const;
    bool isInPositioner() const;
    QPointF position() const;
    QSizeF size() const;
Marco Bubke's avatar
Marco Bubke committed
42
    int penWidth() const;
43
    void paint(QPainter *painter);
Marco Bubke's avatar
Marco Bubke committed
44

45
46
47
48
49
    QVariant property(const QString &name) const;
    bool hasBindingForProperty(const QString &name) const;
    QPair<QString, qint32> anchor(const QString &name) const;
    bool hasAnchor(const QString &name) const;
    QString instanceType(const QString &name) const;
50

51
    qint32 parentId() const;
52

53
54
55
56
57
58
59
60
61
protected:
    void setProperty(const QString &name, const QVariant &value);
    void setInformation(InformationName name,
                        const QVariant &information,
                        const QVariant &secondInformation,
                        const QVariant &thirdInformation);
    void setRenderImage(const QImage &image);
    NodeInstance(ProxyNodeInstanceData *d);
    qint32 instanceId() const;
62

63
64
private:
    QSharedPointer<ProxyNodeInstanceData> d;
65
66
67
68
};

}

69
#endif // PROXYNODEINSTANCE_H