Qt 4.8
qdeclarativeproperty_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtDeclarative module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QDECLARATIVEPROPERTY_P_H
43 #define QDECLARATIVEPROPERTY_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include "qdeclarativeproperty.h"
57 
58 #include <private/qobject_p.h>
59 #include <private/qdeclarativeglobal_p.h>
60 #include <private/qdeclarativepropertycache_p.h>
61 #include <private/qdeclarativeguard_p.h>
62 
64 
69 {
70 public:
71  enum WriteFlag { BypassInterceptor = 0x01, DontRemoveBinding = 0x02, RemoveBindingOnAliasWrite = 0x04 };
72  Q_DECLARE_FLAGS(WriteFlags, WriteFlag)
73 
75  : context(0), engine(0), object(0), isNameCached(false) {}
76 
80 
81  bool isNameCached:1;
84 
85  // Describes the "virtual" value-type sub-property.
87 
88  void initProperty(QObject *obj, const QString &name);
89  void initDefault(QObject *obj);
90 
91  bool isValueType() const;
92  int propertyType() const;
94  QDeclarativeProperty::PropertyTypeCategory propertyTypeCategory() const;
95 
96  QVariant readValueProperty();
97  bool writeValueProperty(const QVariant &, WriteFlags);
98 
99  static const QMetaObject *rawMetaObjectForType(QDeclarativeEnginePrivate *, int);
100  static bool writeEnumProperty(const QMetaProperty &prop, int idx, QObject *object,
101  const QVariant &value, int flags);
102  static bool write(QObject *, const QDeclarativePropertyCache::Data &, const QVariant &,
103  QDeclarativeContextData *, WriteFlags flags = 0);
104  static void findAliasTarget(QObject *, int, QObject **, int *);
105  static QDeclarativeAbstractBinding *setBinding(QObject *, int coreIndex, int valueTypeIndex /* -1 */,
107  WriteFlags flags = DontRemoveBinding);
108  static QDeclarativeAbstractBinding *setBindingNoEnable(QObject *, int coreIndex, int valueTypeIndex /* -1 */,
110  static QDeclarativeAbstractBinding *binding(QObject *, int coreIndex, int valueTypeIndex /* -1 */);
111 
112  static QByteArray saveValueType(const QMetaObject *, int,
113  const QMetaObject *, int);
114  static QByteArray saveProperty(const QMetaObject *, int);
115 
116  static QDeclarativeProperty restore(const QByteArray &, QObject *, QDeclarativeContextData *);
119  QObject *,
121 
122  static bool equal(const QMetaObject *, const QMetaObject *);
123  static bool canConvert(const QMetaObject *from, const QMetaObject *to);
124 
125  // "Public" (to QML) methods
126  static QDeclarativeAbstractBinding *binding(const QDeclarativeProperty &that);
127  static QDeclarativeAbstractBinding *setBinding(const QDeclarativeProperty &that,
129  WriteFlags flags = DontRemoveBinding);
130  static QDeclarativeExpression *signalExpression(const QDeclarativeProperty &that);
131  static QDeclarativeExpression *setSignalExpression(const QDeclarativeProperty &that,
133  static bool write(const QDeclarativeProperty &that, const QVariant &, WriteFlags);
134  static int valueTypeCoreIndex(const QDeclarativeProperty &that);
135  static int bindingIndex(const QDeclarativeProperty &that);
136  static QMetaMethod findSignalByName(const QMetaObject *mo, const QByteArray &);
137  static bool connect(QObject *sender, int signal_index,
138  const QObject *receiver, int method_index,
139  int type = 0, int *types = 0);
140  static const QMetaObject *metaObjectForProperty(const QMetaObject *, int);
141 };
142 
143 Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativePropertyPrivate::WriteFlags)
144 
146 
147 #endif // QDECLARATIVEPROPERTY_P_H
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
The QMetaObject class contains meta-information about Qt objects.
Definition: qobjectdefs.h:304
int type
Definition: qmetatype.cpp:239
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
Definition: qglobal.h:2348
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QDeclarativePropertyCache::Data core
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QDeclarativeContextData * context
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
Definition: qglobal.h:2355
const char * name
#define Q_DECLARATIVE_PRIVATE_EXPORT
static const struct @32 types[]
The QDeclarativeEngine class provides an environment for instantiating QML components.
Type
This enum specifies a type of QML property.
The QDeclarativeContext class defines a context within a QML engine.
PropertyTypeCategory
This enum specifies a category of QML property.
QDeclarativeGuard< QObject > object
The QDeclarativeProperty class abstracts accessing properties on objects created from QML...
The QMetaProperty class provides meta-data about a property.
Definition: qmetaobject.h:176
The QDeclarativeExpression class evaluates JavaScript in a QML context.
The QMetaMethod class provides meta-data about a member function.
Definition: qmetaobject.h:56
static bool equal(const QChar *a, int l, const char *b)
Definition: qurl.cpp:3270
QDeclarativePropertyCache::ValueTypeData valueType