1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #ifndef ABSTRACTROPERTY_H
34 #define ABSTRACTROPERTY_H
36 #include <QtCore/QVariant>
37 #include <QWeakPointer>
38 #include <QSharedPointer>
39 #include "corelib_global.h"
45 namespace QmlDesigner {
48 class InternalProperty;
50 typedef QSharedPointer<InternalNode> InternalNodePointer;
51 typedef QSharedPointer<InternalProperty> InternalPropertyPointer;
52 typedef QWeakPointer<InternalNode> InternalNodeWeakPointer;
58 class CORESHARED_EXPORT VariantProperty;
59 class CORESHARED_EXPORT NodeListProperty;
60 class CORESHARED_EXPORT NodeAbstractProperty;
61 class CORESHARED_EXPORT BindingProperty;
62 class CORESHARED_EXPORT NodeProperty;
71 class CORESHARED_EXPORT AbstractProperty
73 friend class QmlDesigner::ModelNode;
74 friend class QmlDesigner::Internal::ModelPrivate;
76 friend CORESHARED_EXPORT bool operator ==(const AbstractProperty &property1, const AbstractProperty &property2);
77 friend CORESHARED_EXPORT bool operator !=(const AbstractProperty &property1, const AbstractProperty &property2);
78 friend CORESHARED_EXPORT uint qHash(const AbstractProperty& property);
83 AbstractProperty(const AbstractProperty &other);
84 AbstractProperty& operator=(const AbstractProperty &other);
85 AbstractProperty(const AbstractProperty &property, AbstractView *view);
90 ModelNode parentModelNode() const;
91 QmlObjectNode parentQmlObjectNode() const;
93 bool isDefaultProperty() const;
94 VariantProperty toVariantProperty() const;
95 NodeListProperty toNodeListProperty() const;
96 NodeAbstractProperty toNodeAbstractProperty() const;
97 BindingProperty toBindingProperty() const;
98 NodeProperty toNodeProperty() const;
100 bool isVariantProperty() const;
101 bool isNodeListProperty() const;
102 bool isNodeAbstractProperty() const;
103 bool isBindingProperty() const;
104 bool isNodeProperty() const;
106 bool isDynamic() const;
107 QString dynamicTypeName() const;
110 AbstractProperty(const QString &propertyName, const Internal::InternalNodePointer &internalNode, Model* model, AbstractView *view);
111 AbstractProperty(const Internal::InternalPropertyPointer &property, Model* model, AbstractView *view);
112 Internal::InternalNodePointer internalNode() const;
113 Model *model() const;
114 AbstractView *view() const;
117 QString m_propertyName;
118 Internal::InternalNodePointer m_internalNode;
119 QWeakPointer<Model> m_model;
120 QWeakPointer<AbstractView> m_view;
123 CORESHARED_EXPORT bool operator ==(const AbstractProperty &property1, const AbstractProperty &property2);
124 CORESHARED_EXPORT bool operator !=(const AbstractProperty &property1, const AbstractProperty &property2);
125 CORESHARED_EXPORT uint qHash(const AbstractProperty& property);
126 CORESHARED_EXPORT QTextStream& operator<<(QTextStream &stream, const AbstractProperty &property);
127 CORESHARED_EXPORT QDebug operator<<(QDebug debug, const AbstractProperty &AbstractProperty);
130 #endif //ABSTRACTPROPERTY_H