Qt 4.8
Public Types | Static Public Functions | List of all members
QDeclarativeMetaType Class Reference

#include <qdeclarativemetatype_p.h>

Public Types

typedef QVariant(* StringConverter) (const QString &)
 
enum  TypeCategory { Unknown, Object, List }
 

Static Public Functions

static QDeclarativeAttachedPropertiesFunc attachedPropertiesFuncById (int)
 
static int attachedPropertiesFuncId (const QMetaObject *)
 
static bool canCopy (int type)
 
static bool copy (int type, void *data, const void *copy=0)
 Copies copy into data, assuming they both are of type type. More...
 
static StringConverter customStringConverter (int)
 Return the custom string converter for type, previously installed through registerCustomStringConverter() More...
 
static QMetaMethod defaultMethod (const QMetaObject *)
 
static QMetaMethod defaultMethod (QObject *)
 
static QMetaProperty defaultProperty (const QMetaObject *)
 
static QMetaProperty defaultProperty (QObject *)
 
static const char * interfaceIId (int)
 
static bool isInterface (int)
 
static bool isList (int)
 
static bool isModule (const QByteArray &module, int versionMajor, int versionMinor)
 
static bool isQObject (int)
 
static int listType (int)
 
static QList< QDeclarativePrivate::AutoParentFunctionparentFunctions ()
 
static QDeclarativeDirComponents qmlComponents (const QByteArray &module, int version_major, int version_minor)
 Returns the component(s) that have been registered for the module specified by uri and the version specified by version_major and version_minor. More...
 
static QDeclarativeTypeqmlType (const QByteArray &, int, int)
 Returns the type (if any) of URI-qualified named name in version specified by version_major and version_minor. More...
 
static QDeclarativeTypeqmlType (const QMetaObject *)
 Returns the type (if any) that corresponds to the metaObject. More...
 
static QDeclarativeTypeqmlType (const QMetaObject *metaObject, const QByteArray &module, int version_major, int version_minor)
 Returns the type (if any) that corresponds to the metaObject in version specified by version_major and version_minor in module specified by uri. More...
 
static QDeclarativeTypeqmlType (int)
 Returns the type (if any) that corresponds to the QVariant::Type userType. More...
 
static QList< QByteArrayqmlTypeNames ()
 Returns the list of registered QML type names. More...
 
static QList< QDeclarativeType * > qmlTypes ()
 Returns the list of registered QML types. More...
 
static void registerCustomStringConverter (int, StringConverter)
 A custom string convertor allows you to specify a function pointer that returns a variant of type. More...
 
static QObjecttoQObject (const QVariant &, bool *ok=0)
 
static TypeCategory typeCategory (int)
 

Detailed Description

Definition at line 70 of file qdeclarativemetatype_p.h.

Typedefs

◆ StringConverter

typedef QVariant(* QDeclarativeMetaType::StringConverter) (const QString &)

Definition at line 105 of file qdeclarativemetatype_p.h.

Enumerations

◆ TypeCategory

Functions

◆ attachedPropertiesFuncById()

QDeclarativeAttachedPropertiesFunc QDeclarativeMetaType::attachedPropertiesFuncById ( int  id)
static

Definition at line 828 of file qdeclarativemetatype.cpp.

Referenced by qmlAttachedPropertiesObjectById().

829 {
830  if (id < 0)
831  return 0;
832  QReadLocker lock(metaTypeDataLock());
833  QDeclarativeMetaTypeData *data = metaTypeData();
834  return data->types.at(id)->attachedPropertiesFunction();
835 }
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QList< QDeclarativeType * > types
QDeclarativeAttachedPropertiesFunc attachedPropertiesFunction() const
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
static QReadWriteLock lock
Definition: proxyconf.cpp:399

◆ attachedPropertiesFuncId()

int QDeclarativeMetaType::attachedPropertiesFuncId ( const QMetaObject mo)
static

Definition at line 816 of file qdeclarativemetatype.cpp.

Referenced by qmlAttachedPropertiesObject().

817 {
818  QReadLocker lock(metaTypeDataLock());
819  QDeclarativeMetaTypeData *data = metaTypeData();
820 
822  if (type && type->attachedPropertiesFunction())
823  return type->attachedPropertiesId();
824  else
825  return -1;
826 }
int type
Definition: qmetatype.cpp:239
int attachedPropertiesId() const
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
QDeclarativeAttachedPropertiesFunc attachedPropertiesFunction() const
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
static QReadWriteLock lock
Definition: proxyconf.cpp:399

◆ canCopy()

bool QDeclarativeMetaType::canCopy ( int  type)
static

Definition at line 1112 of file qdeclarativemetatype.cpp.

Referenced by QDeclarativeBoundSignalParameters::QDeclarativeBoundSignalParameters().

1113 {
1114  switch(type) {
1115  case QMetaType::VoidStar:
1118  case QMetaType::Long:
1119  case QMetaType::Int:
1120  case QMetaType::Short:
1121  case QMetaType::Char:
1122  case QMetaType::ULong:
1123  case QMetaType::UInt:
1124  case QMetaType::LongLong:
1125  case QMetaType::ULongLong:
1126  case QMetaType::UShort:
1127  case QMetaType::UChar:
1128  case QMetaType::Bool:
1129  case QMetaType::Float:
1130  case QMetaType::Double:
1131  case QMetaType::QChar:
1135  case QMetaType::QByteArray:
1136  case QMetaType::QString:
1138  case QMetaType::QBitArray:
1139  case QMetaType::QDate:
1140  case QMetaType::QTime:
1141  case QMetaType::QDateTime:
1142  case QMetaType::QUrl:
1143  case QMetaType::QLocale:
1144  case QMetaType::QRect:
1145  case QMetaType::QRectF:
1146  case QMetaType::QSize:
1147  case QMetaType::QSizeF:
1148  case QMetaType::QLine:
1149  case QMetaType::QLineF:
1150  case QMetaType::QPoint:
1151  case QMetaType::QPointF:
1152  case QMetaType::QVector3D:
1153 #ifndef QT_NO_REGEXP
1154  case QMetaType::QRegExp:
1155 #endif
1156  case QMetaType::Void:
1157 #ifdef QT3_SUPPORT
1158  case QMetaType::QColorGroup:
1159 #endif
1160  case QMetaType::QFont:
1161  case QMetaType::QPixmap:
1162  case QMetaType::QBrush:
1163  case QMetaType::QColor:
1164  case QMetaType::QPalette:
1165  case QMetaType::QIcon:
1166  case QMetaType::QImage:
1167  case QMetaType::QPolygon:
1168  case QMetaType::QRegion:
1169  case QMetaType::QBitmap:
1170 #ifndef QT_NO_CURSOR
1171  case QMetaType::QCursor:
1172 #endif
1175  case QMetaType::QPen:
1178  case QMetaType::QMatrix:
1179  case QMetaType::QTransform:
1180  case QMetaType::QMatrix4x4:
1181  case QMetaType::QVector2D:
1182  case QMetaType::QVector4D:
1184  return true;
1185 
1186  default:
1187  if (type == qMetaTypeId<QVariant>() ||
1188  type == qMetaTypeId<QScriptValue>() ||
1189  typeCategory(type) != Unknown) {
1190  return true;
1191  }
1192  break;
1193  }
1194 
1195  return false;
1196 }
int type
Definition: qmetatype.cpp:239
static TypeCategory typeCategory(int)

◆ copy()

bool QDeclarativeMetaType::copy ( int  type,
void *  data,
const void *  copy = 0 
)
static

Copies copy into data, assuming they both are of type type.

If copy is zero, a default type is copied. Returns true if the copy was successful and false if not.

Note
This should move into QMetaType once complete

Definition at line 1206 of file qdeclarativemetatype.cpp.

Referenced by QDeclarativeBoundSignalParameters::metaCall().

1207 {
1208  if (copy) {
1209  switch(type) {
1210  case QMetaType::VoidStar:
1213  *static_cast<void **>(data) = *static_cast<void* const *>(copy);
1214  return true;
1215  case QMetaType::Long:
1216  *static_cast<long *>(data) = *static_cast<const long*>(copy);
1217  return true;
1218  case QMetaType::Int:
1219  *static_cast<int *>(data) = *static_cast<const int*>(copy);
1220  return true;
1221  case QMetaType::Short:
1222  *static_cast<short *>(data) = *static_cast<const short*>(copy);
1223  return true;
1224  case QMetaType::Char:
1225  *static_cast<char *>(data) = *static_cast<const char*>(copy);
1226  return true;
1227  case QMetaType::ULong:
1228  *static_cast<ulong *>(data) = *static_cast<const ulong*>(copy);
1229  return true;
1230  case QMetaType::UInt:
1231  *static_cast<uint *>(data) = *static_cast<const uint*>(copy);
1232  return true;
1233  case QMetaType::LongLong:
1234  *static_cast<qlonglong *>(data) = *static_cast<const qlonglong*>(copy);
1235  return true;
1236  case QMetaType::ULongLong:
1237  *static_cast<qulonglong *>(data) = *static_cast<const qulonglong*>(copy);
1238  return true;
1239  case QMetaType::UShort:
1240  *static_cast<ushort *>(data) = *static_cast<const ushort*>(copy);
1241  return true;
1242  case QMetaType::UChar:
1243  *static_cast<uchar *>(data) = *static_cast<const uchar*>(copy);
1244  return true;
1245  case QMetaType::Bool:
1246  *static_cast<bool *>(data) = *static_cast<const bool*>(copy);
1247  return true;
1248  case QMetaType::Float:
1249  *static_cast<float *>(data) = *static_cast<const float*>(copy);
1250  return true;
1251  case QMetaType::Double:
1252  *static_cast<double *>(data) = *static_cast<const double*>(copy);
1253  return true;
1254  case QMetaType::QChar:
1255  *static_cast<NS(QChar) *>(data) = *static_cast<const NS(QChar)*>(copy);
1256  return true;
1258  *static_cast<NS(QVariantMap) *>(data) = *static_cast<const NS(QVariantMap)*>(copy);
1259  return true;
1261  *static_cast<NS(QVariantHash) *>(data) = *static_cast<const NS(QVariantHash)*>(copy);
1262  return true;
1264  *static_cast<NS(QVariantList) *>(data) = *static_cast<const NS(QVariantList)*>(copy);
1265  return true;
1266  case QMetaType::QByteArray:
1267  *static_cast<NS(QByteArray) *>(data) = *static_cast<const NS(QByteArray)*>(copy);
1268  return true;
1269  case QMetaType::QString:
1270  *static_cast<NS(QString) *>(data) = *static_cast<const NS(QString)*>(copy);
1271  return true;
1273  *static_cast<NS(QStringList) *>(data) = *static_cast<const NS(QStringList)*>(copy);
1274  return true;
1275  case QMetaType::QBitArray:
1276  *static_cast<NS(QBitArray) *>(data) = *static_cast<const NS(QBitArray)*>(copy);
1277  return true;
1278  case QMetaType::QDate:
1279  *static_cast<NS(QDate) *>(data) = *static_cast<const NS(QDate)*>(copy);
1280  return true;
1281  case QMetaType::QTime:
1282  *static_cast<NS(QTime) *>(data) = *static_cast<const NS(QTime)*>(copy);
1283  return true;
1284  case QMetaType::QDateTime:
1285  *static_cast<NS(QDateTime) *>(data) = *static_cast<const NS(QDateTime)*>(copy);
1286  return true;
1287  case QMetaType::QUrl:
1288  *static_cast<NS(QUrl) *>(data) = *static_cast<const NS(QUrl)*>(copy);
1289  return true;
1290  case QMetaType::QLocale:
1291  *static_cast<NS(QLocale) *>(data) = *static_cast<const NS(QLocale)*>(copy);
1292  return true;
1293  case QMetaType::QRect:
1294  *static_cast<NS(QRect) *>(data) = *static_cast<const NS(QRect)*>(copy);
1295  return true;
1296  case QMetaType::QRectF:
1297  *static_cast<NS(QRectF) *>(data) = *static_cast<const NS(QRectF)*>(copy);
1298  return true;
1299  case QMetaType::QSize:
1300  *static_cast<NS(QSize) *>(data) = *static_cast<const NS(QSize)*>(copy);
1301  return true;
1302  case QMetaType::QSizeF:
1303  *static_cast<NS(QSizeF) *>(data) = *static_cast<const NS(QSizeF)*>(copy);
1304  return true;
1305  case QMetaType::QLine:
1306  *static_cast<NS(QLine) *>(data) = *static_cast<const NS(QLine)*>(copy);
1307  return true;
1308  case QMetaType::QLineF:
1309  *static_cast<NS(QLineF) *>(data) = *static_cast<const NS(QLineF)*>(copy);
1310  return true;
1311  case QMetaType::QPoint:
1312  *static_cast<NS(QPoint) *>(data) = *static_cast<const NS(QPoint)*>(copy);
1313  return true;
1314  case QMetaType::QPointF:
1315  *static_cast<NS(QPointF) *>(data) = *static_cast<const NS(QPointF)*>(copy);
1316  return true;
1317  case QMetaType::QVector3D:
1318  *static_cast<NS(QVector3D) *>(data) = *static_cast<const NS(QVector3D)*>(copy);
1319  return true;
1320 #ifndef QT_NO_REGEXP
1321  case QMetaType::QRegExp:
1322  *static_cast<NS(QRegExp) *>(data) = *static_cast<const NS(QRegExp)*>(copy);
1323  return true;
1324 #endif
1325  case QMetaType::Void:
1326  return true;
1327 
1328 
1329 #ifdef QT3_SUPPORT
1330  case QMetaType::QColorGroup:
1331  *static_cast<NS(QColorGroup) *>(data) = *static_cast<const NS(QColorGroup)*>(copy);
1332  return true;
1333 #endif
1334 
1335  case QMetaType::QFont:
1336  *static_cast<NS(QFont) *>(data) = *static_cast<const NS(QFont)*>(copy);
1337  return true;
1338  case QMetaType::QPixmap:
1339  *static_cast<NS(QPixmap) *>(data) = *static_cast<const NS(QPixmap)*>(copy);
1340  return true;
1341  case QMetaType::QBrush:
1342  *static_cast<NS(QBrush) *>(data) = *static_cast<const NS(QBrush)*>(copy);
1343  return true;
1344  case QMetaType::QColor:
1345  *static_cast<NS(QColor) *>(data) = *static_cast<const NS(QColor)*>(copy);
1346  return true;
1347  case QMetaType::QPalette:
1348  *static_cast<NS(QPalette) *>(data) = *static_cast<const NS(QPalette)*>(copy);
1349  return true;
1350  case QMetaType::QIcon:
1351  *static_cast<NS(QIcon) *>(data) = *static_cast<const NS(QIcon)*>(copy);
1352  return true;
1353  case QMetaType::QImage:
1354  *static_cast<NS(QImage) *>(data) = *static_cast<const NS(QImage)*>(copy);
1355  return true;
1356  case QMetaType::QPolygon:
1357  *static_cast<NS(QPolygon) *>(data) = *static_cast<const NS(QPolygon)*>(copy);
1358  return true;
1359  case QMetaType::QRegion:
1360  *static_cast<NS(QRegion) *>(data) = *static_cast<const NS(QRegion)*>(copy);
1361  return true;
1362  case QMetaType::QBitmap:
1363  *static_cast<NS(QBitmap) *>(data) = *static_cast<const NS(QBitmap)*>(copy);
1364  return true;
1365 #ifndef QT_NO_CURSOR
1366  case QMetaType::QCursor:
1367  *static_cast<NS(QCursor) *>(data) = *static_cast<const NS(QCursor)*>(copy);
1368  return true;
1369 #endif
1371  *static_cast<NS(QSizePolicy) *>(data) = *static_cast<const NS(QSizePolicy)*>(copy);
1372  return true;
1374  *static_cast<NS(QKeySequence) *>(data) = *static_cast<const NS(QKeySequence)*>(copy);
1375  return true;
1376  case QMetaType::QPen:
1377  *static_cast<NS(QPen) *>(data) = *static_cast<const NS(QPen)*>(copy);
1378  return true;
1380  *static_cast<NS(QTextLength) *>(data) = *static_cast<const NS(QTextLength)*>(copy);
1381  return true;
1383  *static_cast<NS(QTextFormat) *>(data) = *static_cast<const NS(QTextFormat)*>(copy);
1384  return true;
1385  case QMetaType::QMatrix:
1386  *static_cast<NS(QMatrix) *>(data) = *static_cast<const NS(QMatrix)*>(copy);
1387  return true;
1388  case QMetaType::QTransform:
1389  *static_cast<NS(QTransform) *>(data) = *static_cast<const NS(QTransform)*>(copy);
1390  return true;
1391  case QMetaType::QMatrix4x4:
1392  *static_cast<NS(QMatrix4x4) *>(data) = *static_cast<const NS(QMatrix4x4)*>(copy);
1393  return true;
1394  case QMetaType::QVector2D:
1395  *static_cast<NS(QVector2D) *>(data) = *static_cast<const NS(QVector2D)*>(copy);
1396  return true;
1397  case QMetaType::QVector4D:
1398  *static_cast<NS(QVector4D) *>(data) = *static_cast<const NS(QVector4D)*>(copy);
1399  return true;
1401  *static_cast<NS(QQuaternion) *>(data) = *static_cast<const NS(QQuaternion)*>(copy);
1402  return true;
1403 
1404  default:
1405  if (type == qMetaTypeId<QVariant>()) {
1406  *static_cast<NS(QVariant) *>(data) = *static_cast<const NS(QVariant)*>(copy);
1407  return true;
1408  } else if (type == qMetaTypeId<QScriptValue>()) {
1409  *static_cast<NS(QScriptValue) *>(data) = *static_cast<const NS(QScriptValue)*>(copy);
1410  return true;
1411  } else if (typeCategory(type) != Unknown) {
1412  *static_cast<void **>(data) = *static_cast<void* const *>(copy);
1413  return true;
1414  }
1415  break;
1416  }
1417  } else {
1418  switch(type) {
1419  case QMetaType::VoidStar:
1422  *static_cast<void **>(data) = 0;
1423  return true;
1424  case QMetaType::Long:
1425  *static_cast<long *>(data) = long(0);
1426  return true;
1427  case QMetaType::Int:
1428  *static_cast<int *>(data) = int(0);
1429  return true;
1430  case QMetaType::Short:
1431  *static_cast<short *>(data) = short(0);
1432  return true;
1433  case QMetaType::Char:
1434  *static_cast<char *>(data) = char(0);
1435  return true;
1436  case QMetaType::ULong:
1437  *static_cast<ulong *>(data) = ulong(0);
1438  return true;
1439  case QMetaType::UInt:
1440  *static_cast<uint *>(data) = uint(0);
1441  return true;
1442  case QMetaType::LongLong:
1443  *static_cast<qlonglong *>(data) = qlonglong(0);
1444  return true;
1445  case QMetaType::ULongLong:
1446  *static_cast<qulonglong *>(data) = qulonglong(0);
1447  return true;
1448  case QMetaType::UShort:
1449  *static_cast<ushort *>(data) = ushort(0);
1450  return true;
1451  case QMetaType::UChar:
1452  *static_cast<uchar *>(data) = uchar(0);
1453  return true;
1454  case QMetaType::Bool:
1455  *static_cast<bool *>(data) = bool(false);
1456  return true;
1457  case QMetaType::Float:
1458  *static_cast<float *>(data) = float(0);
1459  return true;
1460  case QMetaType::Double:
1461  *static_cast<double *>(data) = double(0);
1462  return true;
1463  case QMetaType::QChar:
1464  *static_cast<NS(QChar) *>(data) = NS(QChar)();
1465  return true;
1467  *static_cast<NS(QVariantMap) *>(data) = NS(QVariantMap)();
1468  return true;
1470  *static_cast<NS(QVariantHash) *>(data) = NS(QVariantHash)();
1471  return true;
1473  *static_cast<NS(QVariantList) *>(data) = NS(QVariantList)();
1474  return true;
1475  case QMetaType::QByteArray:
1476  *static_cast<NS(QByteArray) *>(data) = NS(QByteArray)();
1477  return true;
1478  case QMetaType::QString:
1479  *static_cast<NS(QString) *>(data) = NS(QString)();
1480  return true;
1482  *static_cast<NS(QStringList) *>(data) = NS(QStringList)();
1483  return true;
1484  case QMetaType::QBitArray:
1485  *static_cast<NS(QBitArray) *>(data) = NS(QBitArray)();
1486  return true;
1487  case QMetaType::QDate:
1488  *static_cast<NS(QDate) *>(data) = NS(QDate)();
1489  return true;
1490  case QMetaType::QTime:
1491  *static_cast<NS(QTime) *>(data) = NS(QTime)();
1492  return true;
1493  case QMetaType::QDateTime:
1494  *static_cast<NS(QDateTime) *>(data) = NS(QDateTime)();
1495  return true;
1496  case QMetaType::QUrl:
1497  *static_cast<NS(QUrl) *>(data) = NS(QUrl)();
1498  return true;
1499  case QMetaType::QLocale:
1500  *static_cast<NS(QLocale) *>(data) = NS(QLocale)();
1501  return true;
1502  case QMetaType::QRect:
1503  *static_cast<NS(QRect) *>(data) = NS(QRect)();
1504  return true;
1505  case QMetaType::QRectF:
1506  *static_cast<NS(QRectF) *>(data) = NS(QRectF)();
1507  return true;
1508  case QMetaType::QSize:
1509  *static_cast<NS(QSize) *>(data) = NS(QSize)();
1510  return true;
1511  case QMetaType::QSizeF:
1512  *static_cast<NS(QSizeF) *>(data) = NS(QSizeF)();
1513  return true;
1514  case QMetaType::QLine:
1515  *static_cast<NS(QLine) *>(data) = NS(QLine)();
1516  return true;
1517  case QMetaType::QLineF:
1518  *static_cast<NS(QLineF) *>(data) = NS(QLineF)();
1519  return true;
1520  case QMetaType::QPoint:
1521  *static_cast<NS(QPoint) *>(data) = NS(QPoint)();
1522  return true;
1523  case QMetaType::QPointF:
1524  *static_cast<NS(QPointF) *>(data) = NS(QPointF)();
1525  return true;
1526  case QMetaType::QVector3D:
1527  *static_cast<NS(QVector3D) *>(data) = NS(QVector3D)();
1528  return true;
1529 #ifndef QT_NO_REGEXP
1530  case QMetaType::QRegExp:
1531  *static_cast<NS(QRegExp) *>(data) = NS(QRegExp)();
1532  return true;
1533 #endif
1534  case QMetaType::Void:
1535  return true;
1536 
1537 #ifdef QT3_SUPPORT
1538  case QMetaType::QColorGroup:
1539  *static_cast<NS(QColorGroup) *>(data) = NS(QColorGroup)();
1540  return true;
1541 #endif
1542 
1543  case QMetaType::QFont:
1544  *static_cast<NS(QFont) *>(data) = NS(QFont)();
1545  return true;
1546  case QMetaType::QPixmap:
1547  *static_cast<NS(QPixmap) *>(data) = NS(QPixmap)();
1548  return true;
1549  case QMetaType::QBrush:
1550  *static_cast<NS(QBrush) *>(data) = NS(QBrush)();
1551  return true;
1552  case QMetaType::QColor:
1553  *static_cast<NS(QColor) *>(data) = NS(QColor)();
1554  return true;
1555  case QMetaType::QPalette:
1556  *static_cast<NS(QPalette) *>(data) = NS(QPalette)();
1557  return true;
1558  case QMetaType::QIcon:
1559  *static_cast<NS(QIcon) *>(data) = NS(QIcon)();
1560  return true;
1561  case QMetaType::QImage:
1562  *static_cast<NS(QImage) *>(data) = NS(QImage)();
1563  return true;
1564  case QMetaType::QPolygon:
1565  *static_cast<NS(QPolygon) *>(data) = NS(QPolygon)();
1566  return true;
1567  case QMetaType::QRegion:
1568  *static_cast<NS(QRegion) *>(data) = NS(QRegion)();
1569  return true;
1570  case QMetaType::QBitmap:
1571  *static_cast<NS(QBitmap) *>(data) = NS(QBitmap)();
1572  return true;
1573 #ifndef QT_NO_CURSOR
1574  case QMetaType::QCursor:
1575  *static_cast<NS(QCursor) *>(data) = NS(QCursor)();
1576  return true;
1577 #endif
1579  *static_cast<NS(QSizePolicy) *>(data) = NS(QSizePolicy)();
1580  return true;
1582  *static_cast<NS(QKeySequence) *>(data) = NS(QKeySequence)();
1583  return true;
1584  case QMetaType::QPen:
1585  *static_cast<NS(QPen) *>(data) = NS(QPen)();
1586  return true;
1588  *static_cast<NS(QTextLength) *>(data) = NS(QTextLength)();
1589  return true;
1591  *static_cast<NS(QTextFormat) *>(data) = NS(QTextFormat)();
1592  return true;
1593  case QMetaType::QMatrix:
1594  *static_cast<NS(QMatrix) *>(data) = NS(QMatrix)();
1595  return true;
1596  case QMetaType::QTransform:
1597  *static_cast<NS(QTransform) *>(data) = NS(QTransform)();
1598  return true;
1599  case QMetaType::QMatrix4x4:
1600  *static_cast<NS(QMatrix4x4) *>(data) = NS(QMatrix4x4)();
1601  return true;
1602  case QMetaType::QVector2D:
1603  *static_cast<NS(QVector2D) *>(data) = NS(QVector2D)();
1604  return true;
1605  case QMetaType::QVector4D:
1606  *static_cast<NS(QVector4D) *>(data) = NS(QVector4D)();
1607  return true;
1609  *static_cast<NS(QQuaternion) *>(data) = NS(QQuaternion)();
1610  return true;
1611  default:
1612  if (type == qMetaTypeId<QVariant>()) {
1613  *static_cast<NS(QVariant) *>(data) = NS(QVariant)();
1614  return true;
1615  } else if (type == qMetaTypeId<QScriptValue>()) {
1616  *static_cast<NS(QScriptValue) *>(data) = NS(QScriptValue)();
1617  return true;
1618  } else if (typeCategory(type) != Unknown) {
1619  *static_cast<void **>(data) = 0;
1620  return true;
1621  }
1622  break;
1623  }
1624  }
1625 
1626  return false;
1627 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
The QVector3D class represents a vector or vertex in 3D space.
Definition: qvector3d.h:60
int type
Definition: qmetatype.cpp:239
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition: qcursor.h:89
The QLine class provides a two-dimensional vector using integer precision.
Definition: qline.h:57
The QRegExp class provides pattern matching using regular expressions.
Definition: qregexp.h:61
The QMatrix class specifies 2D transformations of a coordinate system.
Definition: qmatrix.h:61
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
The QVector4D class represents a vector or vertex in 4D space.
Definition: qvector4d.h:60
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
static bool copy(int type, void *data, const void *copy=0)
Copies copy into data, assuming they both are of type type.
The QDate class provides date functions.
Definition: qdatetime.h:55
The QPolygon class provides a vector of points using integer precision.
Definition: qpolygon.h:60
The QUrl class provides a convenient interface for working with URLs.
Definition: qurl.h:61
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
static TypeCategory typeCategory(int)
The QLineF class provides a two-dimensional vector using floating point precision.
Definition: qline.h:212
#define NS(x)
unsigned char uchar
Definition: qglobal.h:994
The QBitmap class provides monochrome (1-bit depth) pixmaps.
Definition: qbitmap.h:55
The QTime class provides clock time functions.
Definition: qdatetime.h:148
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
The QTextFormat class provides formatting information for a QTextDocument.
Definition: qtextformat.h:129
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition: qmatrix4x4.h:63
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
The QVector2D class represents a vector or vertex in 2D space.
Definition: qvector2d.h:60
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
unsigned long ulong
Definition: qglobal.h:997
The QBitArray class provides an array of bits.
Definition: qbitarray.h:54
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
The QKeySequence class encapsulates a key sequence as used by shortcuts.
Definition: qkeysequence.h:72
The QDateTime class provides date and time functions.
Definition: qdatetime.h:216
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
unsigned short ushort
Definition: qglobal.h:995
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QTextLength class encapsulates the different types of length used in a QTextDocument.
Definition: qtextformat.h:84
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
The QColorGroup class contains color groups for each widget state.
The QQuaternion class represents a quaternion consisting of a vector and scalar.
Definition: qquaternion.h:59
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
quint64 qulonglong
Definition: qglobal.h:952
qint64 qlonglong
Definition: qglobal.h:951
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60

◆ customStringConverter()

QDeclarativeMetaType::StringConverter QDeclarativeMetaType::customStringConverter ( int  type)
static

Return the custom string converter for type, previously installed through registerCustomStringConverter()

Definition at line 961 of file qdeclarativemetatype.cpp.

Referenced by QDeclarativePropertyAnimationPrivate::convertVariant(), QDeclarativeCompiler::testLiteralAssignment(), and QDeclarativePropertyPrivate::write().

962 {
963  QReadLocker lock(metaTypeDataLock());
964 
965  QDeclarativeMetaTypeData *data = metaTypeData();
966  return data->stringConverters.value(type);
967 }
int type
Definition: qmetatype.cpp:239
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
static QReadWriteLock lock
Definition: proxyconf.cpp:399

◆ defaultMethod() [1/2]

QMetaMethod QDeclarativeMetaType::defaultMethod ( const QMetaObject metaObject)
static

Definition at line 863 of file qdeclarativemetatype.cpp.

864 {
865  int idx = metaObject->indexOfClassInfo("DefaultMethod");
866  if (-1 == idx)
867  return QMetaMethod();
868 
869  QMetaClassInfo info = metaObject->classInfo(idx);
870  if (!info.value())
871  return QMetaMethod();
872 
873  idx = metaObject->indexOfMethod(info.value());
874  if (-1 == idx)
875  return QMetaMethod();
876 
877  return metaObject->method(idx);
878 }
static mach_timebase_info_data_t info
QMetaClassInfo classInfo(int index) const
Returns the meta-data for the item of class information with the given index.
const char * value() const
Returns the value of this item.
The QMetaClassInfo class provides additional information about a class.
Definition: qmetaobject.h:224
int indexOfMethod(const char *method) const
Finds method and returns its index; otherwise returns -1.
QMetaMethod method(int index) const
Returns the meta-data for the method with the given index.
int indexOfClassInfo(const char *name) const
Finds class information item name and returns its index; otherwise returns -1.
The QMetaMethod class provides meta-data about a member function.
Definition: qmetaobject.h:56

◆ defaultMethod() [2/2]

QMetaMethod QDeclarativeMetaType::defaultMethod ( QObject obj)
static

Definition at line 880 of file qdeclarativemetatype.cpp.

881 {
882  if (!obj)
883  return QMetaMethod();
884 
885  const QMetaObject *metaObject = obj->metaObject();
886  return defaultMethod(metaObject);
887 }
The QMetaObject class contains meta-information about Qt objects.
Definition: qobjectdefs.h:304
static QMetaMethod defaultMethod(const QMetaObject *)
The QMetaMethod class provides meta-data about a member function.
Definition: qmetaobject.h:56
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.

◆ defaultProperty() [1/2]

QMetaProperty QDeclarativeMetaType::defaultProperty ( const QMetaObject metaObject)
static

Definition at line 837 of file qdeclarativemetatype.cpp.

Referenced by QDeclarativeCompiler::buildObject(), QDeclarativeCompiler::buildProperty(), QDeclarativeCompiler::doesPropertyExist(), and QDeclarativePropertyPrivate::initDefault().

838 {
839  int idx = metaObject->indexOfClassInfo("DefaultProperty");
840  if (-1 == idx)
841  return QMetaProperty();
842 
843  QMetaClassInfo info = metaObject->classInfo(idx);
844  if (!info.value())
845  return QMetaProperty();
846 
847  idx = metaObject->indexOfProperty(info.value());
848  if (-1 == idx)
849  return QMetaProperty();
850 
851  return metaObject->property(idx);
852 }
static mach_timebase_info_data_t info
QMetaClassInfo classInfo(int index) const
Returns the meta-data for the item of class information with the given index.
const char * value() const
Returns the value of this item.
int indexOfProperty(const char *name) const
Finds property name and returns its index; otherwise returns -1.
The QMetaClassInfo class provides additional information about a class.
Definition: qmetaobject.h:224
The QMetaProperty class provides meta-data about a property.
Definition: qmetaobject.h:176
int indexOfClassInfo(const char *name) const
Finds class information item name and returns its index; otherwise returns -1.
QMetaProperty property(int index) const
Returns the meta-data for the property with the given index.

◆ defaultProperty() [2/2]

QMetaProperty QDeclarativeMetaType::defaultProperty ( QObject obj)
static

Definition at line 854 of file qdeclarativemetatype.cpp.

855 {
856  if (!obj)
857  return QMetaProperty();
858 
859  const QMetaObject *metaObject = obj->metaObject();
860  return defaultProperty(metaObject);
861 }
The QMetaObject class contains meta-information about Qt objects.
Definition: qobjectdefs.h:304
The QMetaProperty class provides meta-data about a property.
Definition: qmetaobject.h:176
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
static QMetaProperty defaultProperty(const QMetaObject *)

◆ interfaceIId()

const char * QDeclarativeMetaType::interfaceIId ( int  userType)
static

Definition at line 913 of file qdeclarativemetatype.cpp.

914 {
915  QReadLocker lock(metaTypeDataLock());
916  QDeclarativeMetaTypeData *data = metaTypeData();
917  QDeclarativeType *type = data->idToType.value(userType);
918  lock.unlock();
919  if (type && type->isInterface() && type->typeId() == userType)
920  return type->interfaceIId();
921  else
922  return 0;
923 }
int type
Definition: qmetatype.cpp:239
void unlock()
Unlocks the lock.
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
const char * interfaceIId() const
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
static QReadWriteLock lock
Definition: proxyconf.cpp:399

◆ isInterface()

bool QDeclarativeMetaType::isInterface ( int  userType)
static

Definition at line 906 of file qdeclarativemetatype.cpp.

Referenced by QDeclarativeCompiler::buildListProperty(), QDeclarativeCompiler::buildPropertyObjectAssignment(), QDeclarativeCompiler::genListProperty(), and QDeclarativeCompiler::genPropertyAssignment().

907 {
908  QReadLocker lock(metaTypeDataLock());
909  QDeclarativeMetaTypeData *data = metaTypeData();
910  return userType >= 0 && userType < data->interfaces.size() && data->interfaces.testBit(userType);
911 }
bool testBit(int i) const
Returns true if the bit at index position i is 1; otherwise returns false.
Definition: qbitarray.h:124
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
static QReadWriteLock lock
Definition: proxyconf.cpp:399
int size() const
Returns the number of bits stored in the bit array.
Definition: qbitarray.h:73

◆ isList()

bool QDeclarativeMetaType::isList ( int  userType)
static

Definition at line 925 of file qdeclarativemetatype.cpp.

Referenced by QDeclarativeCompiler::buildBinding(), QDeclarativeEnginePrivate::isList(), QDeclarativeEngineDebugService::propertyData(), and QDeclarativeDomValue::type().

926 {
927  QReadLocker lock(metaTypeDataLock());
928  QDeclarativeMetaTypeData *data = metaTypeData();
929  return userType >= 0 && userType < data->lists.size() && data->lists.testBit(userType);
930 }
bool testBit(int i) const
Returns true if the bit at index position i is 1; otherwise returns false.
Definition: qbitarray.h:124
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
static QReadWriteLock lock
Definition: proxyconf.cpp:399
int size() const
Returns the number of bits stored in the bit array.
Definition: qbitarray.h:73

◆ isModule()

bool QDeclarativeMetaType::isModule ( const QByteArray module,
int  versionMajor,
int  versionMinor 
)
static

Definition at line 744 of file qdeclarativemetatype.cpp.

Referenced by QDeclarativeImportsPrivate::add().

745 {
746 #ifndef QT_NO_IMPORT_QT47_QML
747  // "import Qt 4.7" should have died off, but unfortunately, it was in a
748  // major release. We don't register 4.7 types by default, as it's a
749  // performance penalty. Instead, register them on-demand.
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;
759  }
760  }
761 #endif
762 
763  QDeclarativeMetaTypeData *data = metaTypeData();
765  return it != data->modules.end()
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))));
771 }
#define it(className, varName)
Q_CORE_EXPORT void qWarning(const char *,...)
static const char * data(const QByteArray &arr)
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
Definition: qhash.h:865
iterator Iterator
Qt-style synonym for QHash::iterator.
Definition: qhash.h:473
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ isQObject()

bool QDeclarativeMetaType::isQObject ( int  userType)
static

Definition at line 792 of file qdeclarativemetatype.cpp.

Referenced by QDeclarativeEnginePrivate::isQObject(), QDeclarativeEngineDebugService::propertyData(), QDeclarativeBoundSignalParameters::QDeclarativeBoundSignalParameters(), QDeclarativeListAccessor::setList(), and QDeclarativeEngineDebugService::valueContents().

793 {
794  if (userType == QMetaType::QObjectStar)
795  return true;
796 
797  QReadLocker lock(metaTypeDataLock());
798  QDeclarativeMetaTypeData *data = metaTypeData();
799  return userType >= 0 && userType < data->objects.size() && data->objects.testBit(userType);
800 }
bool testBit(int i) const
Returns true if the bit at index position i is 1; otherwise returns false.
Definition: qbitarray.h:124
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
static QReadWriteLock lock
Definition: proxyconf.cpp:399
int size() const
Returns the number of bits stored in the bit array.
Definition: qbitarray.h:73

◆ listType()

int QDeclarativeMetaType::listType ( int  id)
static

Definition at line 805 of file qdeclarativemetatype.cpp.

Referenced by QDeclarativeListReferencePrivate::init(), QDeclarativeEnginePrivate::listType(), QDeclarativeListReference::QDeclarativeListReference(), and QDeclarativePropertyPrivate::write().

806 {
807  QReadLocker lock(metaTypeDataLock());
808  QDeclarativeMetaTypeData *data = metaTypeData();
809  QDeclarativeType *type = data->idToType.value(id);
810  if (type && type->qListTypeId() == id)
811  return type->typeId();
812  else
813  return 0;
814 }
int type
Definition: qmetatype.cpp:239
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
static QReadWriteLock lock
Definition: proxyconf.cpp:399

◆ parentFunctions()

QList< QDeclarativePrivate::AutoParentFunction > QDeclarativeMetaType::parentFunctions ( )
static

Definition at line 773 of file qdeclarativemetatype.cpp.

Referenced by QDeclarativeComponentPrivate::createObject(), and QDeclarativeEnginePrivate::createQmlObject().

774 {
775  QReadLocker lock(metaTypeDataLock());
776  QDeclarativeMetaTypeData *data = metaTypeData();
777  return data->parentFunctions;
778 }
QList< QDeclarativePrivate::AutoParentFunction > parentFunctions
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
static QReadWriteLock lock
Definition: proxyconf.cpp:399

◆ qmlComponents()

QDeclarativeDirComponents QDeclarativeMetaType::qmlComponents ( const QByteArray module,
int  version_major,
int  version_minor 
)
static

Returns the component(s) that have been registered for the module specified by uri and the version specified by version_major and version_minor.

Returns an empty list if no such components were registered.

Definition at line 1040 of file qdeclarativemetatype.cpp.

Referenced by QDeclarativeImportsPrivate::add().

1041 {
1042  QReadLocker lock(registeredComponentDataLock());
1043  QDeclarativeRegisteredComponentData *data = registeredComponentData();
1044 
1045  QDeclarativeDirComponents* comps = data->registeredComponents.value(module, 0);
1046  if (!comps)
1047  return QDeclarativeDirComponents();
1048  QDeclarativeDirComponents ret = *comps;
1049  for (int i = ret.count() - 1; i >= 0; i--) {
1051  if (version_major >= 0 && (c.majorVersion != version_major || c.minorVersion > version_minor))
1052  ret.removeAt(i);
1053  }
1054 
1055  return ret;
1056 }
unsigned char c[8]
Definition: qnumeric_p.h:62
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QList< QDeclarativeDirParser::Component > QDeclarativeDirComponents
QMap< QByteArray, QDeclarativeDirComponents * > registeredComponents
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
static QReadWriteLock lock
Definition: proxyconf.cpp:399
void removeAt(int i)
Removes the item at index position i.
Definition: qlist.h:480

◆ qmlType() [1/4]

QDeclarativeType * QDeclarativeMetaType::qmlType ( const QByteArray name,
int  version_major,
int  version_minor 
)
static

Returns the type (if any) of URI-qualified named name in version specified by version_major and version_minor.

Definition at line 973 of file qdeclarativemetatype.cpp.

Referenced by QDeclarativeCompiler::componentTypeRef(), QDeclarativeEnginePrivate::createCache(), QDeclarativeImportedNamespace::find_helper(), QDeclarativeListReferencePrivate::init(), QDeclarativeEnginePrivate::metaObjectForType(), QDeclarativeEngineDebugService::objectData(), QDeclarativeListReference::QDeclarativeListReference(), qmlExecuteDeferred(), QDeclarativePropertyPrivate::rawMetaObjectForType(), QDeclarativeEnginePrivate::rawMetaObjectForType(), QDeclarativeEngineDebugService::resetBinding(), QDeclarativeType::superType(), QDeclarativeCompiler::toQmlType(), QDeclarativePropertyPrivate::write(), and QDeclarativeInfo::~QDeclarativeInfo().

974 {
975  QReadLocker lock(metaTypeDataLock());
976  QDeclarativeMetaTypeData *data = metaTypeData();
977 
979  foreach (QDeclarativeType *t, types) {
980  // XXX version_major<0 just a kludge for QDeclarativePropertyPrivate::initProperty
981  if (version_major<0 || t->availableInVersion(version_major,version_minor))
982  return t;
983  }
984  return 0;
985 }
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
static const struct @32 types[]
QList< T > values() const
Returns a list containing all the values in the hash, in an arbitrary order.
Definition: qhash.h:693
static QReadWriteLock lock
Definition: proxyconf.cpp:399
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ qmlType() [2/4]

QDeclarativeType * QDeclarativeMetaType::qmlType ( const QMetaObject metaObject)
static

Returns the type (if any) that corresponds to the metaObject.

Returns null if no type is registered.

Definition at line 991 of file qdeclarativemetatype.cpp.

992 {
993  QReadLocker lock(metaTypeDataLock());
994  QDeclarativeMetaTypeData *data = metaTypeData();
995 
996  return data->metaObjectToType.value(metaObject);
997 }
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
static QReadWriteLock lock
Definition: proxyconf.cpp:399

◆ qmlType() [3/4]

QDeclarativeType * QDeclarativeMetaType::qmlType ( const QMetaObject metaObject,
const QByteArray module,
int  version_major,
int  version_minor 
)
static

Returns the type (if any) that corresponds to the metaObject in version specified by version_major and version_minor in module specified by uri.

Returns null if no type is registered.

Definition at line 1004 of file qdeclarativemetatype.cpp.

1005 {
1006  QReadLocker lock(metaTypeDataLock());
1007  QDeclarativeMetaTypeData *data = metaTypeData();
1008 
1010  while (it != data->metaObjectToType.end() && it.key() == metaObject) {
1011  QDeclarativeType *t = *it;
1012  if (version_major < 0 || t->availableInVersion(module, version_major,version_minor))
1013  return t;
1014  ++it;
1015  }
1016 
1017  return 0;
1018 }
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
Definition: qhash.h:395
#define it(className, varName)
const Key & key() const
Returns the current item&#39;s key.
Definition: qhash.h:419
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
static QReadWriteLock lock
Definition: proxyconf.cpp:399
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
Definition: qhash.h:865

◆ qmlType() [4/4]

QDeclarativeType * QDeclarativeMetaType::qmlType ( int  userType)
static

Returns the type (if any) that corresponds to the QVariant::Type userType.

Returns null if no type is registered.

Definition at line 1024 of file qdeclarativemetatype.cpp.

1025 {
1026  QReadLocker lock(metaTypeDataLock());
1027  QDeclarativeMetaTypeData *data = metaTypeData();
1028 
1029  QDeclarativeType *type = data->idToType.value(userType);
1030  if (type && type->typeId() == userType)
1031  return type;
1032  else
1033  return 0;
1034 }
int type
Definition: qmetatype.cpp:239
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
static QReadWriteLock lock
Definition: proxyconf.cpp:399

◆ qmlTypeNames()

QList< QByteArray > QDeclarativeMetaType::qmlTypeNames ( )
static

Returns the list of registered QML type names.

Definition at line 1062 of file qdeclarativemetatype.cpp.

1063 {
1064  QReadLocker lock(metaTypeDataLock());
1065  QDeclarativeMetaTypeData *data = metaTypeData();
1066 
1067  return data->nameToType.keys();
1068 }
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
static QReadWriteLock lock
Definition: proxyconf.cpp:399
QList< Key > keys() const
Returns a list containing all the keys in the hash, in an arbitrary order.
Definition: qhash.h:648

◆ qmlTypes()

QList< QDeclarativeType * > QDeclarativeMetaType::qmlTypes ( )
static

Returns the list of registered QML types.

Definition at line 1073 of file qdeclarativemetatype.cpp.

Referenced by cacheForNamespace().

1074 {
1075  QReadLocker lock(metaTypeDataLock());
1076  QDeclarativeMetaTypeData *data = metaTypeData();
1077 
1078  return data->nameToType.values();
1079 }
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
QList< T > values() const
Returns a list containing all the values in the hash, in an arbitrary order.
Definition: qhash.h:693
static QReadWriteLock lock
Definition: proxyconf.cpp:399

◆ registerCustomStringConverter()

void QDeclarativeMetaType::registerCustomStringConverter ( int  type,
StringConverter  converter 
)
static

A custom string convertor allows you to specify a function pointer that returns a variant of type.

For example, if you have written your own icon class that you want to support as an object property assignable in QML:

int type = qRegisterMetaType<SuperIcon>("SuperIcon");
QML::addCustomStringConvertor(type, &SuperIcon::pixmapFromString);

The function pointer must be of the form:

Definition at line 947 of file qdeclarativemetatype.cpp.

948 {
949  QWriteLocker lock(metaTypeDataLock());
950 
951  QDeclarativeMetaTypeData *data = metaTypeData();
952  if (data->stringConverters.contains(type))
953  return;
954  data->stringConverters.insert(type, converter);
955 }
int type
Definition: qmetatype.cpp:239
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
Definition: qhash.h:872
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
static const char * data(const QByteArray &arr)
The QWriteLocker class is a convenience class that simplifies locking and unlocking read-write locks ...
static QReadWriteLock lock
Definition: proxyconf.cpp:399

◆ toQObject()

QObject * QDeclarativeMetaType::toQObject ( const QVariant v,
bool *  ok = 0 
)
static

Definition at line 780 of file qdeclarativemetatype.cpp.

Referenced by QDeclarativeEnginePrivate::scriptValueFromVariant(), QDeclarativeListAccessor::setList(), QDeclarativeEnginePrivate::toQObject(), QDeclarativeEngineDebugService::valueContents(), and QDeclarativePropertyPrivate::write().

781 {
782  if (!isQObject(v.userType())) {
783  if (ok) *ok = false;
784  return 0;
785  }
786 
787  if (ok) *ok = true;
788 
789  return *(QObject **)v.constData();
790 }
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
int userType() const
Returns the storage type of the value stored in the variant.
Definition: qvariant.cpp:1913
const void * constData() const
Definition: qvariant.cpp:3065

◆ typeCategory()

QDeclarativeMetaType::TypeCategory QDeclarativeMetaType::typeCategory ( int  userType)
static

Definition at line 889 of file qdeclarativemetatype.cpp.

Referenced by QDeclarativePropertyCache::Data::flagsForProperty(), and QDeclarativeEnginePrivate::typeCategory().

890 {
891  if (userType < 0)
892  return Unknown;
893  if (userType == QMetaType::QObjectStar)
894  return Object;
895 
896  QReadLocker lock(metaTypeDataLock());
897  QDeclarativeMetaTypeData *data = metaTypeData();
898  if (userType < data->objects.size() && data->objects.testBit(userType))
899  return Object;
900  else if (userType < data->lists.size() && data->lists.testBit(userType))
901  return List;
902  else
903  return Unknown;
904 }
bool testBit(int i) const
Returns true if the bit at index position i is 1; otherwise returns false.
Definition: qbitarray.h:124
static const char * data(const QByteArray &arr)
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
static QReadWriteLock lock
Definition: proxyconf.cpp:399

The documentation for this class was generated from the following files: