42 #include <QtDeclarative/qdeclarativeprivate.h> 43 #include "private/qdeclarativemetatype_p.h" 45 #include "private/qdeclarativeproxymetaobject_p.h" 46 #include "private/qdeclarativecustomparser_p.h" 47 #include "private/qdeclarativeguard_p.h" 48 #include "private/qdeclarativeengine_p.h" 49 #include "private/qdeclarativeitemsmodule_p.h" 50 #include "private/qdeclarativeutilmodule_p.h" 52 #include <QtCore/qdebug.h> 53 #include <QtCore/qstringlist.h> 54 #include <QtCore/qmetaobject.h> 55 #include <QtCore/qbitarray.h> 56 #include <QtCore/qreadwritelock.h> 68 #include <QtCore/qcryptographichash.h> 69 #include <QtScript/qscriptvalue.h> 73 #ifdef QT_BOOTSTRAPPED 74 # ifndef QT_NO_GEOM_VARIANT 75 # define QT_NO_GEOM_VARIANT 83 #ifndef QT_NO_GEOM_VARIANT 90 #define NS(x) QT_PREPEND_NAMESPACE(x) 110 ModuleInfo(
int major_min,
int minor_min,
int major_max,
int minor_max)
160 void (*m_newFunc)(
void *);
184 : m_isInterface(false), m_iid(0), m_typeId(0), m_listId(0), m_revision(0), m_containsRevisionedAttributes(false),
185 m_superType(0), m_allocationSize(0), m_newFunc(0), m_baseMetaObject(0), m_attachedPropertiesFunc(0),
186 m_attachedPropertiesType(0), m_parserStatusCast(-1), m_propertyValueSourceCast(-1),
187 m_propertyValueInterceptorCast(-1), m_extFunc(0), m_extMetaObject(0), m_index(-1), m_customParser(0),
188 m_isSetup(false), m_haveSuperType(false)
211 if (type.
uri) name +=
'/';
321 for (
int ii = mo->methodOffset(); ii < mo->methodCount(); ++ii) {
326 int parenIdx = name.
indexOf(
'(');
327 if (parenIdx != -1) name = name.
left(parenIdx);
332 for (
int ii = ignoreStart->methodOffset() + ignoreStart->methodCount();
333 !found && ii < ignoreEnd->methodOffset() + ignoreEnd->methodCount();
338 int parenIdx = othername.
indexOf(
'(');
339 if (parenIdx != -1) othername = othername.
left(parenIdx);
341 found = name == othername;
350 for (
int ii = mo->enumeratorOffset(); ii < mo->enumeratorCount(); ++ii) {
351 QMetaEnum enumerator = mo->enumerator(ii);
353 int otherIndex = ignoreEnd->indexOfEnumerator(enumerator.
name());
354 if (otherIndex >= ignoreStart->enumeratorOffset() + ignoreStart->enumeratorCount()) {
357 builder.addEnumerator(enumerator);
364 if (m_isSetup)
return;
375 *mmo = *m_extMetaObject;
378 m_metaObjects <<
data;
390 if (!m_metaObjects.isEmpty())
391 m_metaObjects.last().metaObject->
d.
superdata = mmo;
393 m_metaObjects <<
data;
399 for (
int ii = 0; ii < m_metaObjects.count(); ++ii) {
401 m_metaObjects.at(ii).metaObject->propertyOffset();
402 m_metaObjects[ii].methodOffset =
403 m_metaObjects.at(ii).metaObject->methodOffset();
409 if (m_metaObjects.isEmpty())
410 mo = m_baseMetaObject;
412 mo = m_metaObjects.first().metaObject;
414 for (
int ii = 0; !m_containsRevisionedAttributes && ii < mo->
propertyCount(); ++ii) {
416 m_containsRevisionedAttributes =
true;
419 for (
int ii = 0; !m_containsRevisionedAttributes && ii < mo->
methodCount(); ++ii) {
421 m_containsRevisionedAttributes =
true;
602 qFatal(
"qmlRegisterType(): Cannot mix incompatible QML versions.");
682 for (
int ii = 0; data.
typeName[ii]; ++ii) {
725 return registerType(*reinterpret_cast<RegisterType *>(data));
746 #ifndef QT_NO_IMPORT_QT47_QML 750 if (strcmp(module.
constData(),
"Qt") == 0 && versionMajor == 4 && versionMinor == 7) {
751 static bool qt47Registered =
false;
752 if (!qt47Registered) {
753 qWarning() <<
Q_FUNC_INFO <<
"Qt 4.7 import detected; please note that Qt 4.7 is directly reusable as QtQuick 1.x with no code changes. Continuing, but startup time will be slower.";
754 qt47Registered =
true;
766 && ((versionMajor<0 && versionMinor<0) ||
767 (((*it).vmajor_max > versionMajor ||
768 ((*it).vmajor_max == versionMajor && (*it).vminor_max >= versionMinor))
769 && ((*it).vmajor_min < versionMajor ||
770 ((*it).vmajor_min == versionMajor && (*it).vminor_min <= versionMinor))));
860 return defaultProperty(metaObject);
877 return metaObject->
method(idx);
886 return defaultMethod(metaObject);
898 if (userType < data->objects.size() && data->
objects.
testBit(userType))
900 else if (userType < data->lists.size() && data->
lists.
testBit(userType))
1030 if (type && type->
typeId() == userType)
1049 for (
int i = ret.
count() - 1; i >= 0; i--) {
1083 #include <QtGui/qfont.h> 1084 #include <QtGui/qpixmap.h> 1085 #include <QtGui/qbrush.h> 1086 #include <QtGui/qcolor.h> 1087 #include <QtGui/qpalette.h> 1088 #include <QtGui/qicon.h> 1089 #include <QtGui/qimage.h> 1090 #include <QtGui/qpolygon.h> 1091 #include <QtGui/qregion.h> 1092 #include <QtGui/qbitmap.h> 1093 #include <QtGui/qcursor.h> 1094 #include <QtGui/qsizepolicy.h> 1095 #include <QtGui/qkeysequence.h> 1096 #include <QtGui/qpen.h> 1099 #include <QtGui/qtextformat.h> 1100 #include <QtGui/qmatrix.h> 1101 #include <QtGui/qtransform.h> 1102 #include <QtGui/qmatrix4x4.h> 1103 #include <QtGui/qvector2d.h> 1104 #include <QtGui/qvector3d.h> 1105 #include <QtGui/qvector4d.h> 1106 #include <QtGui/qquaternion.h> 1153 #ifndef QT_NO_REGEXP 1158 case QMetaType::QColorGroup:
1170 #ifndef QT_NO_CURSOR 1187 if (type == qMetaTypeId<QVariant>() ||
1188 type == qMetaTypeId<QScriptValue>() ||
1189 typeCategory(type) != Unknown) {
1213 *
static_cast<void **
>(
data) = *static_cast<void* const *>(copy);
1216 *
static_cast<long *
>(
data) = *static_cast<const long*>(copy);
1219 *
static_cast<int *
>(
data) = *static_cast<const int*>(copy);
1222 *
static_cast<short *
>(
data) = *static_cast<const short*>(copy);
1225 *
static_cast<char *
>(
data) = *static_cast<const char*>(copy);
1228 *
static_cast<ulong *
>(
data) = *static_cast<const ulong*>(copy);
1231 *
static_cast<uint *
>(
data) = *static_cast<const uint*>(copy);
1234 *
static_cast<qlonglong *
>(
data) = *static_cast<const qlonglong*>(copy);
1237 *
static_cast<qulonglong *
>(
data) = *static_cast<const qulonglong*>(copy);
1240 *
static_cast<ushort *
>(
data) = *static_cast<const ushort*>(copy);
1243 *
static_cast<uchar *
>(
data) = *static_cast<const uchar*>(copy);
1246 *
static_cast<bool *
>(
data) = *static_cast<const bool*>(copy);
1249 *
static_cast<float *
>(
data) = *static_cast<const float*>(copy);
1252 *
static_cast<double *
>(
data) = *static_cast<const double*>(copy);
1320 #ifndef QT_NO_REGEXP 1330 case QMetaType::QColorGroup:
1365 #ifndef QT_NO_CURSOR 1405 if (type == qMetaTypeId<QVariant>()) {
1408 }
else if (type == qMetaTypeId<QScriptValue>()) {
1411 }
else if (typeCategory(type) != Unknown) {
1412 *
static_cast<void **
>(
data) = *static_cast<void* const *>(copy);
1422 *
static_cast<void **
>(
data) = 0;
1425 *
static_cast<long *
>(
data) =
long(0);
1428 *
static_cast<int *
>(
data) =
int(0);
1431 *
static_cast<short *
>(
data) =
short(0);
1434 *
static_cast<char *
>(
data) =
char(0);
1455 *
static_cast<bool *
>(
data) =
bool(
false);
1458 *
static_cast<float *
>(
data) =
float(0);
1461 *
static_cast<double *
>(
data) =
double(0);
1529 #ifndef QT_NO_REGEXP 1538 case QMetaType::QColorGroup:
1573 #ifndef QT_NO_CURSOR 1612 if (type == qMetaTypeId<QVariant>()) {
1615 }
else if (type == qMetaTypeId<QScriptValue>()) {
1618 }
else if (typeCategory(type) != Unknown) {
1619 *
static_cast<void **
>(
data) = 0;
The QVariant class acts like a union for the most common Qt data types.
CreateFunc createFunction() const
The QColor class provides colors based on RGB, HSV or CMYK values.
QObject *(* QDeclarativeAttachedPropertiesFunc)(QObject *)
const QMetaObject * m_baseMetaObject
The QVector3D class represents a vector or vertex in 3D space.
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
QByteArray module() const
The QCursor class provides a mouse cursor with an arbitrary shape.
static mach_timebase_info_data_t info
void setBit(int i)
Sets the bit at index position i to 1.
#define QT_END_NAMESPACE
This macro expands to.
int propertyValueInterceptorCast() const
QDeclarativeAttachedPropertiesFunc m_attachedPropertiesFunc
static void defineModuleCompat()
QDeclarativeCustomParser * customParser
The QLine class provides a two-dimensional vector using integer precision.
The QRegExp class provides pattern matching using regular expressions.
void(* CreateFunc)(void *)
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
The QMatrix class specifies 2D transformations of a coordinate system.
#define it(className, varName)
const QMetaObject * m_attachedPropertiesType
The QByteArray class provides an array of bytes.
The QVector4D class represents a vector or vertex in 4D space.
The QPointF class defines a point in the plane using floating point precision.
QDeclarativeTypePrivate * d
static void registerValueTypesCompat()
QString m_noCreationReason
int parserStatusCast() const
friend int registerComponent(const QDeclarativePrivate::RegisterComponent &)
The QDate class provides date functions.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
const QMetaObject * baseMetaObject() const
int count(const T &t) const
Returns the number of occurrences of value in the list.
int attachedPropertiesId() const
The QPolygon class provides a vector of points using integer precision.
QDeclarativeType * superType() const
void unlock()
Unlocks the lock associated with this locker.
static QHash< const QMetaObject *, int > m_attachedPropertyIds
QList< QDeclarativeDirParser::Component > QDeclarativeDirComponents
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
static QString currentPath()
Returns the absolute path of the application's current directory.
bool testBit(int i) const
Returns true if the bit at index position i is 1; otherwise returns false.
bool isExtendedType() const
The QObject class is the base class of all Qt objects.
The QPen class defines how a QPainter should draw lines and outlines of shapes.
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
The QSizeF class defines the size of a two-dimensional object using floating point precision...
bool isRelative() const
Returns true if the URL is relative; otherwise returns false.
The QChar class provides a 16-bit Unicode character.
bool containsRevisionedAttributes() const
QMap< QByteArray, QDeclarativeDirComponents * > registeredComponents
const T value(const Key &key) const
Returns the value associated with the key.
const char * interfaceIId() const
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
int m_propertyValueSourceCast
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
The QLineF class provides a two-dimensional vector using floating point precision.
const Key & key() const
Returns the current item's key.
QDeclarativeType * m_superType
The QBitmap class provides monochrome (1-bit depth) pixmaps.
void append(const T &t)
Inserts value at the end of the list.
int metaObjectRevision() const
The QTime class provides clock time functions.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
AutoParentFunction function
QByteArray typeName() const
QDeclarativeCustomParser * m_customParser
The QTextFormat class provides formatting information for a QTextDocument.
friend int registerInterface(const QDeclarativePrivate::RegisterInterface &)
QDeclarativeType(int, const QDeclarativePrivate::RegisterInterface &)
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
void prepend(const T &t)
Inserts value at the beginning of the list.
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
int propertyValueSourceCast() const
QDeclarativeAttachedPropertiesFunc attachedPropertiesFunction() const
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
void resize(int size)
Resizes the bit array to size bits.
Q_CORE_EXPORT void qWarning(const char *,...)
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
The QImage class provides a hardware-independent image representation that allows direct access to th...
The QVector2D class represents a vector or vertex in 2D space.
static const char * data(const QByteArray &arr)
QByteArray qmlTypeName() const
The QRegion class specifies a clip region for a painter.
QString noCreationReason() const
static void defineModuleCompat()
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
int Q_DECLARATIVE_EXPORT qmlregister(RegistrationType, void *)
QByteArray left(int len) const
Returns a byte array that contains the leftmost len bytes of this byte array.
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
The QDeclarativeCustomParser class allows you to add new arbitrary types to QML.
int indexOf(char c, int from=0) const
Returns the index position of the first occurrence of the character ch in the byte array...
QObject *(* m_extFunc)(QObject *)
The QWriteLocker class is a convenience class that simplifies locking and unlocking read-write locks ...
The QBitArray class provides an array of bits.
T & first()
Returns a reference to the first item in the list.
const char * constData() const
Returns a pointer to the data stored in the byte array.
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Q_CORE_EXPORT void qFatal(const char *,...)
const QMetaObject * metaObject() const
QString scheme() const
Returns the scheme of the URL.
int userType() const
Returns the storage type of the value stored in the variant.
The QKeySequence class encapsulates a key sequence as used by shortcuts.
static void defineModuleCompat()
The QDateTime class provides date and time functions.
const QMetaObject * attachedPropertiesType() const
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
The QFont class specifies a font used for drawing text.
const QMetaObject * m_extMetaObject
const QMetaObject * attachedPropertiesMetaObject
The QReadWriteLock class provides read-write locking.
QObject *(* extensionObjectCreate)(QObject *)
QDeclarativeAttachedPropertiesFunc attachedPropertiesFunction
QList< T > values() const
Returns a list containing all the values in the hash, in an arbitrary order.
const void * constData() const
bool m_containsRevisionedAttributes
The QPoint class defines a point in the plane using integer precision.
The QTextLength class encapsulates the different types of length used in a QTextDocument.
QList< QDeclarativeProxyMetaObject::ProxyData > m_metaObjects
static QReadWriteLock lock
The QRect class defines a rectangle in the plane using integer precision.
The QColorGroup class contains color groups for each widget state.
The QQuaternion class represents a quaternion consisting of a vector and scalar.
QDeclarativeCustomParser * customParser() const
The QPixmap class is an off-screen image representation that can be used as a paint device...
int m_attachedPropertiesId
const QMetaObject * metaObject
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
The QSize class defines the size of a two-dimensional object using integer point precision.
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
void(* m_newFunc)(void *)
iterator insertMulti(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
int m_propertyValueInterceptorCast
void unlock()
Unlocks the lock associated with this locker.
friend int registerType(const QDeclarativePrivate::RegisterType &)
The QScriptValue class acts as a container for the Qt Script data types.
int size() const
Returns the number of bits stored in the bit array.
QList< Key > keys() const
Returns a list containing all the keys in the hash, in an arbitrary order.
bool availableInVersion(int vmajor, int vminor) const
const QMetaObject * extensionMetaObject
QDeclarativeTypePrivate()
iterator Iterator
Qt-style synonym for QHash::iterator.
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
The QMap class is a template class that provides a skip-list-based dictionary.
The QList class is a template class that provides lists.
The QPalette class contains color groups for each widget state.
The QIcon class provides scalable icons in different modes and states.
void removeAt(int i)
Removes the item at index position i.