Qt 4.8
Classes | Public Functions | Protected Functions | Private Functions | Static Private Functions | Properties | List of all members
QDeclarativeVMEMetaObject Class Reference

#include <qdeclarativevmemetaobject_p.h>

Inheritance diagram for QDeclarativeVMEMetaObject:
QAbstractDynamicMetaObject QMetaObject

Classes

class  List
 

Public Functions

bool aliasTarget (int index, QObject **target, int *coreIndex, int *valueTypeIndex) const
 
void connectAliasSignal (int index)
 
 QDeclarativeVMEMetaObject (QObject *obj, const QMetaObject *other, const QDeclarativeVMEMetaData *data, QDeclarativeCompiledData *compiledData)
 
void registerInterceptor (int index, int valueIndex, QDeclarativePropertyValueInterceptor *interceptor)
 
void setVmeMethod (int index, const QScriptValue &)
 
void setVMEProperty (int index, const QScriptValue &)
 
QScriptValue vmeMethod (int index)
 
int vmeMethodLineNumber (int index)
 
QScriptValue vmeProperty (int index)
 
 ~QDeclarativeVMEMetaObject ()
 
- Public Functions inherited from QAbstractDynamicMetaObject
virtual int createProperty (const char *, const char *)
 
virtual ~QAbstractDynamicMetaObject ()
 
- Public Functions inherited from QMetaObject
QObjectcast (QObject *obj) const
 Returns obj if object obj inherits from this meta-object; otherwise returns 0. More...
 
const QObjectcast (const QObject *obj) const
 Returns obj if object obj inherits from this meta-object; otherwise returns 0. More...
 
QMetaClassInfo classInfo (int index) const
 Returns the meta-data for the item of class information with the given index. More...
 
int classInfoCount () const
 Returns the number of items of class information in this class. More...
 
int classInfoOffset () const
 Returns the class information offset for this class; i.e. More...
 
const char * className () const
 Returns the class name. More...
 
QMetaMethod constructor (int index) const
 Returns the meta-data for the constructor with the given index. More...
 
int constructorCount () const
 Returns the number of constructors in this class. More...
 
QMetaEnum enumerator (int index) const
 Returns the meta-data for the enumerator with the given index. More...
 
int enumeratorCount () const
 Returns the number of enumerators in this class. More...
 
int enumeratorOffset () const
 Returns the enumerator offset for this class; i.e. More...
 
int indexOfClassInfo (const char *name) const
 Finds class information item name and returns its index; otherwise returns -1. More...
 
int indexOfConstructor (const char *constructor) const
 Finds constructor and returns its index; otherwise returns -1. More...
 
int indexOfEnumerator (const char *name) const
 Finds enumerator name and returns its index; otherwise returns -1. More...
 
int indexOfMethod (const char *method) const
 Finds method and returns its index; otherwise returns -1. More...
 
int indexOfProperty (const char *name) const
 Finds property name and returns its index; otherwise returns -1. More...
 
int indexOfSignal (const char *signal) const
 Finds signal and returns its index; otherwise returns -1. More...
 
int indexOfSlot (const char *slot) const
 Finds slot and returns its index; otherwise returns -1. More...
 
QMetaMethod method (int index) const
 Returns the meta-data for the method with the given index. More...
 
int methodCount () const
 Returns the number of methods known to the meta-object system in this class, including the number of properties provided by each base class. More...
 
int methodOffset () const
 Returns the method offset for this class; i.e. More...
 
QObjectnewInstance (QGenericArgument val0=QGenericArgument(0), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument()) const
 Constructs a new instance of this class. More...
 
QMetaProperty property (int index) const
 Returns the meta-data for the property with the given index. More...
 
int propertyCount () const
 Returns the number of properties in this class, including the number of properties provided by each base class. More...
 
int propertyOffset () const
 Returns the property offset for this class; i.e. More...
 
int static_metacall (Call, int, void **) const
 
const QMetaObjectsuperClass () const
 Returns the meta-object of the superclass, or 0 if there is no such object. More...
 
QString tr (const char *s, const char *c) const
 
QString tr (const char *s, const char *c, int n) const
 
QString trUtf8 (const char *s, const char *c) const
 
QString trUtf8 (const char *s, const char *c, int n) const
 
QMetaProperty userProperty () const
 Returns the property that has the USER flag set to true. More...
 

Protected Functions

virtual int metaCall (QMetaObject::Call _c, int _id, void **_a)
 

Private Functions

void connectAlias (int aliasId)
 
void listChanged (int)
 
QScriptValue method (int)
 
QScriptValue readVarProperty (int)
 
QVariant readVarPropertyAsVariant (int)
 
void writeVarProperty (int, const QScriptValue &)
 
void writeVarProperty (int, const QVariant &)
 

Static Private Functions

static void list_append (QDeclarativeListProperty< QObject > *, QObject *)
 
static QObjectlist_at (QDeclarativeListProperty< QObject > *, int)
 
static void list_clear (QDeclarativeListProperty< QObject > *)
 
static int list_count (QDeclarativeListProperty< QObject > *)
 

Properties

QBitArray aConnected
 
QBitArray aInterceptors
 
QDeclarativeCompiledDatacompiledData
 
QDeclarativeGuardedContextData ctxt
 
QDeclarativeVMEVariantdata
 
QHash< int, QPair< int, QDeclarativePropertyValueInterceptor * > > interceptors
 
QList< ListlistProperties
 
const QDeclarativeVMEMetaDatametaData
 
int methodOffset
 
QScriptValuemethods
 
QObjectobject
 
QAbstractDynamicMetaObjectparent
 
int propOffset
 

Additional Inherited Members

- Public Types inherited from QMetaObject
enum  Call {
  InvokeMetaMethod, ReadProperty, WriteProperty, ResetProperty,
  QueryPropertyDesignable, QueryPropertyScriptable, QueryPropertyStored, QueryPropertyEditable,
  QueryPropertyUser, CreateInstance
}
 
- Static Public Functions inherited from QMetaObject
static void activate (QObject *sender, int signal_index, void **argv)
 
static void activate (QObject *sender, int from_signal_index, int to_signal_index, void **argv)
 
static void activate (QObject *sender, const QMetaObject *, int local_signal_index, void **argv)
 
static void activate (QObject *sender, const QMetaObject *, int from_local_signal_index, int to_local_signal_index, void **argv)
 
static void addGuard (QObject **ptr)
 
static void changeGuard (QObject **ptr, QObject *o)
 
static bool checkConnectArgs (const char *signal, const char *method)
 Returns true if the signal and method arguments are compatible; otherwise returns false. More...
 
static bool connect (const QObject *sender, int signal_index, const QObject *receiver, int method_index, int type=0, int *types=0)
 
static void connectSlotsByName (QObject *o)
 Searches recursively for all child objects of the given object, and connects matching signals from them to slots of object that follow the following form: More...
 
static bool disconnect (const QObject *sender, int signal_index, const QObject *receiver, int method_index)
 
static bool disconnectOne (const QObject *sender, int signal_index, const QObject *receiver, int method_index)
 
static bool invokeMethod (QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(0), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
 Invokes the member (a signal or a slot name) on the object obj. More...
 
static bool invokeMethod (QObject *obj, const char *member, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(0), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
 
static bool invokeMethod (QObject *obj, const char *member, Qt::ConnectionType type, QGenericArgument val0=QGenericArgument(0), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
 
static bool invokeMethod (QObject *obj, const char *member, QGenericArgument val0=QGenericArgument(0), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
 
static int metacall (QObject *, Call, int, void **)
 
static QByteArray normalizedSignature (const char *method)
 Normalizes the signature of the given method. More...
 
static QByteArray normalizedType (const char *type)
 Normalizes a type. More...
 
static void removeGuard (QObject **ptr)
 
- Public Variables inherited from QMetaObject
struct {
   const uint *   data
 
   const void *   extradata
 
   const char *   stringdata
 
   const QMetaObject *   superdata
 
d
 

Detailed Description

Definition at line 134 of file qdeclarativevmemetaobject_p.h.

Constructors and Destructors

◆ QDeclarativeVMEMetaObject()

QDeclarativeVMEMetaObject::QDeclarativeVMEMetaObject ( QObject obj,
const QMetaObject other,
const QDeclarativeVMEMetaData data,
QDeclarativeCompiledData compiledData 
)

Definition at line 381 of file qdeclarativevmemetaobject.cpp.

385 : object(obj), compiledData(cdata), ctxt(QDeclarativeData::get(obj, true)->outerContext),
386  metaData(meta), data(0), methods(0), parent(0)
387 {
388  compiledData->addref();
389 
390  *static_cast<QMetaObject *>(this) = *other;
391  this->d.superdata = obj->metaObject();
392 
394  if (op->metaObject)
395  parent = static_cast<QAbstractDynamicMetaObject*>(op->metaObject);
396  op->metaObject = this;
397 
400 
402 
404  int list_type = qMetaTypeId<QDeclarativeListProperty<QObject> >();
405 
406  // ### Optimize
407  for (int ii = 0; ii < metaData->propertyCount; ++ii) {
408  int t = (metaData->propertyData() + ii)->propertyType;
409  if (t == list_type) {
410  listProperties.append(List(methodOffset + ii));
411  data[ii].setValue(listProperties.count() - 1);
412  }
413  }
414 }
QDeclarativeCompiledData * compiledData
The QMetaObject class contains meta-information about Qt objects.
Definition: qobjectdefs.h:304
static QDeclarativeData * get(const QObject *object, bool create=false)
QAbstractDynamicMetaObject * parent
PropertyData * propertyData() const
static QObjectPrivate * get(QObject *o)
Definition: qobject_p.h:177
const QDeclarativeVMEMetaData * metaData
int methodOffset() const
Returns the method offset for this class; i.e.
void resize(int size)
Resizes the bit array to size bits.
Definition: qbitarray.cpp:214
QMetaObject * metaObject
Definition: qobject.h:107
struct QMetaObject::@38 d
int propertyOffset() const
Returns the property offset for this class; i.e.
QDeclarativeGuardedContextData ctxt
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.

◆ ~QDeclarativeVMEMetaObject()

QDeclarativeVMEMetaObject::~QDeclarativeVMEMetaObject ( )

Definition at line 416 of file qdeclarativevmemetaobject.cpp.

417 {
419  delete parent;
420  delete [] data;
421  delete [] methods;
422 }
QDeclarativeCompiledData * compiledData
QAbstractDynamicMetaObject * parent

Functions

◆ aliasTarget()

bool QDeclarativeVMEMetaObject::aliasTarget ( int  index,
QObject **  target,
int *  coreIndex,
int *  valueTypeIndex 
) const

Definition at line 839 of file qdeclarativevmemetaobject.cpp.

Referenced by QDeclarativePropertyPrivate::binding(), QDeclarativePropertyPrivate::findAliasTarget(), QDeclarativePropertyPrivate::setBinding(), and QDeclarativePropertyPrivate::setBindingNoEnable().

840 {
842 
843  *target = 0;
844  *coreIndex = -1;
845  *valueTypeIndex = -1;
846 
847  if (!ctxt)
848  return false;
849 
853 
854  *target = ctxtPriv->data->idValues[d->contextIdx].data();
855  if (!*target)
856  return false;
857 
858  if (d->isObjectAlias()) {
859  } else if (d->isValueTypeAlias()) {
860  *coreIndex = d->propertyIndex();
861  *valueTypeIndex = d->valueTypeIndex();
862  } else {
863  *coreIndex = d->propertyIndex();
864  }
865 
866  return true;
867 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
const QDeclarativeVMEMetaData * metaData
QDeclarativeContextData * data
static QDeclarativeContextPrivate * get(QDeclarativeContext *context)
QDeclarativeContext * asQDeclarativeContext()
struct QMetaObject::@38 d
The QDeclarativeContext class defines a context within a QML engine.
quint16 index
QDeclarativeGuardedContextData ctxt

◆ connectAlias()

void QDeclarativeVMEMetaObject::connectAlias ( int  aliasId)
private

Definition at line 869 of file qdeclarativevmemetaobject.cpp.

Referenced by connectAliasSignal(), and metaCall().

870 {
871  if (!aConnected.testBit(aliasId)) {
872  aConnected.setBit(aliasId);
873 
876 
878 
879  QObject *target = ctxtPriv->data->idValues[d->contextIdx].data();
880  if (!target)
881  return;
882 
883  int sigIdx = methodOffset + aliasId + metaData->propertyCount;
884  QMetaObject::connect(context, d->contextIdx + ctxtPriv->notifyIndex, object, sigIdx);
885 
886  if (!d->isObjectAlias()) {
887  QMetaProperty prop = target->metaObject()->property(d->propertyIndex());
888  if (prop.hasNotifySignal())
890  }
891  }
892 }
static bool connect(const QObject *sender, int signal_index, const QObject *receiver, int method_index, int type=0, int *types=0)
Definition: qobject.cpp:3194
void setBit(int i)
Sets the bit at index position i to 1.
Definition: qbitarray.h:128
int notifySignalIndex() const
Returns the index of the property change notifying signal if one was specified, otherwise returns -1...
static bool connect(QObject *sender, int signal_index, const QObject *receiver, int method_index, int type=0, int *types=0)
Connect sender signal_index to receiver method_index with the specified type and types.
bool testBit(int i) const
Returns true if the bit at index position i is 1; otherwise returns false.
Definition: qbitarray.h:124
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
const QDeclarativeVMEMetaData * metaData
QDeclarativeContextData * data
int methodOffset() const
Returns the method offset for this class; i.e.
static QDeclarativeContextPrivate * get(QDeclarativeContext *context)
QDeclarativeContext * asQDeclarativeContext()
struct QMetaObject::@38 d
The QDeclarativeContext class defines a context within a QML engine.
The QMetaProperty class provides meta-data about a property.
Definition: qmetaobject.h:176
QDeclarativeGuardedContextData ctxt
bool hasNotifySignal() const
Returns true if this property has a corresponding change notify signal; otherwise returns false...
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
QMetaProperty property(int index) const
Returns the meta-data for the property with the given index.

◆ connectAliasSignal()

void QDeclarativeVMEMetaObject::connectAliasSignal ( int  index)

Definition at line 894 of file qdeclarativevmemetaobject.cpp.

Referenced by flush_vme_signal().

895 {
896  int aliasId = (index - methodOffset) - metaData->propertyCount;
897  if (aliasId < 0 || aliasId >= metaData->aliasCount)
898  return;
899 
900  connectAlias(aliasId);
901 }
const QDeclarativeVMEMetaData * metaData
int methodOffset() const
Returns the method offset for this class; i.e.
if(void) toggleToolbarShown
quint16 index

◆ list_append()

void QDeclarativeVMEMetaObject::list_append ( QDeclarativeListProperty< QObject > *  prop,
QObject o 
)
staticprivate

Definition at line 748 of file qdeclarativevmemetaobject.cpp.

Referenced by metaCall().

749 {
750  List *list = static_cast<List *>(prop->data);
751  list->append(o);
752  QMetaObject::activate(prop->object, list->notifyIndex, 0);
753 }
static void activate(QObject *sender, int signal_index, void **argv)
Definition: qobject.cpp:3690

◆ list_at()

QObject * QDeclarativeVMEMetaObject::list_at ( QDeclarativeListProperty< QObject > *  prop,
int  index 
)
staticprivate

Definition at line 760 of file qdeclarativevmemetaobject.cpp.

Referenced by metaCall().

761 {
762  return static_cast<List *>(prop->data)->at(index);
763 }
#define at(className, varName)
quint16 index

◆ list_clear()

void QDeclarativeVMEMetaObject::list_clear ( QDeclarativeListProperty< QObject > *  prop)
staticprivate

Definition at line 765 of file qdeclarativevmemetaobject.cpp.

Referenced by metaCall().

766 {
767  List *list = static_cast<List *>(prop->data);
768  list->clear();
769  QMetaObject::activate(prop->object, list->notifyIndex, 0);
770 }
static void activate(QObject *sender, int signal_index, void **argv)
Definition: qobject.cpp:3690

◆ list_count()

int QDeclarativeVMEMetaObject::list_count ( QDeclarativeListProperty< QObject > *  prop)
staticprivate

Definition at line 755 of file qdeclarativevmemetaobject.cpp.

Referenced by metaCall().

756 {
757  return static_cast<List *>(prop->data)->count();
758 }

◆ listChanged()

void QDeclarativeVMEMetaObject::listChanged ( int  id)
private

Definition at line 743 of file qdeclarativevmemetaobject.cpp.

744 {
745  activate(object, methodOffset + id, 0);
746 }
int methodOffset() const
Returns the method offset for this class; i.e.
static void activate(QObject *sender, int signal_index, void **argv)
Definition: qobject.cpp:3690

◆ metaCall()

int QDeclarativeVMEMetaObject::metaCall ( QMetaObject::Call  _c,
int  _id,
void **  _a 
)
protectedvirtual

Reimplemented from QAbstractDynamicMetaObject.

Definition at line 424 of file qdeclarativevmemetaobject.cpp.

425 {
426  int id = _id;
428  int flags = *reinterpret_cast<int*>(a[3]);
430  && !aInterceptors.isEmpty()
431  && aInterceptors.testBit(id)) {
433  int valueIndex = pair.first;
435  int type = property(id).userType();
436 
437  if (type != QVariant::Invalid) {
438  if (valueIndex != -1) {
440  QDeclarativeValueType *valueType = 0;
441  if (ep) valueType = ep->valueTypes[type];
442  else valueType = QDeclarativeValueTypeFactory::valueType(type);
443  Q_ASSERT(valueType);
444 
445  valueType->setValue(QVariant(type, a[0]));
446  QMetaProperty valueProp = valueType->metaObject()->property(valueIndex);
447  vi->write(valueProp.read(valueType));
448 
449  if (!ep) delete valueType;
450  return -1;
451  } else {
452  vi->write(QVariant(type, a[0]));
453  return -1;
454  }
455  }
456  }
457  }
459  if (id >= propOffset) {
460  id -= propOffset;
461 
462  if (id < metaData->propertyCount) {
463  int t = (metaData->propertyData() + id)->propertyType;
464  bool needActivate = false;
465 
466  if (t == -1) {
467 
468  if (c == QMetaObject::ReadProperty) {
469  *reinterpret_cast<QVariant *>(a[0]) = readVarPropertyAsVariant(id);
470  } else if (c == QMetaObject::WriteProperty) {
471  writeVarProperty(id, *reinterpret_cast<QVariant *>(a[0]));
472  }
473 
474  } else {
475 
476  if (c == QMetaObject::ReadProperty) {
477  switch(t) {
478  case QVariant::Int:
479  *reinterpret_cast<int *>(a[0]) = data[id].asInt();
480  break;
481  case QVariant::Bool:
482  *reinterpret_cast<bool *>(a[0]) = data[id].asBool();
483  break;
484  case QVariant::Double:
485  *reinterpret_cast<double *>(a[0]) = data[id].asDouble();
486  break;
487  case QVariant::String:
488  *reinterpret_cast<QString *>(a[0]) = data[id].asQString();
489  break;
490  case QVariant::Url:
491  *reinterpret_cast<QUrl *>(a[0]) = data[id].asQUrl();
492  break;
493  case QVariant::Color:
494  *reinterpret_cast<QColor *>(a[0]) = data[id].asQColor();
495  break;
496  case QVariant::Date:
497  *reinterpret_cast<QDate *>(a[0]) = data[id].asQDate();
498  break;
499  case QVariant::DateTime:
500  *reinterpret_cast<QDateTime *>(a[0]) = data[id].asQDateTime();
501  break;
503  *reinterpret_cast<QObject **>(a[0]) = data[id].asQObject();
504  break;
505  default:
506  break;
507  }
509  int listIndex = data[id].asInt();
510  const List *list = &listProperties.at(listIndex);
511  *reinterpret_cast<QDeclarativeListProperty<QObject> *>(a[0]) =
512  QDeclarativeListProperty<QObject>(object, (void *)list,
514  list_clear);
515  }
516 
517  } else if (c == QMetaObject::WriteProperty) {
518 
519  switch(t) {
520  case QVariant::Int:
521  needActivate = *reinterpret_cast<int *>(a[0]) != data[id].asInt();
522  data[id].setValue(*reinterpret_cast<int *>(a[0]));
523  break;
524  case QVariant::Bool:
525  needActivate = *reinterpret_cast<bool *>(a[0]) != data[id].asBool();
526  data[id].setValue(*reinterpret_cast<bool *>(a[0]));
527  break;
528  case QVariant::Double:
529  needActivate = *reinterpret_cast<double *>(a[0]) != data[id].asDouble();
530  data[id].setValue(*reinterpret_cast<double *>(a[0]));
531  break;
532  case QVariant::String:
533  needActivate = *reinterpret_cast<QString *>(a[0]) != data[id].asQString();
534  data[id].setValue(*reinterpret_cast<QString *>(a[0]));
535  break;
536  case QVariant::Url:
537  needActivate = *reinterpret_cast<QUrl *>(a[0]) != data[id].asQUrl();
538  data[id].setValue(*reinterpret_cast<QUrl *>(a[0]));
539  break;
540  case QVariant::Color:
541  needActivate = *reinterpret_cast<QColor *>(a[0]) != data[id].asQColor();
542  data[id].setValue(*reinterpret_cast<QColor *>(a[0]));
543  break;
544  case QVariant::Date:
545  needActivate = *reinterpret_cast<QDate *>(a[0]) != data[id].asQDate();
546  data[id].setValue(*reinterpret_cast<QDate *>(a[0]));
547  break;
548  case QVariant::DateTime:
549  needActivate = *reinterpret_cast<QDateTime *>(a[0]) != data[id].asQDateTime();
550  data[id].setValue(*reinterpret_cast<QDateTime *>(a[0]));
551  break;
553  needActivate = *reinterpret_cast<QObject **>(a[0]) != data[id].asQObject();
554  data[id].setValue(*reinterpret_cast<QObject **>(a[0]));
555  break;
556  default:
557  break;
558  }
559  }
560 
561  }
562 
563  if (c == QMetaObject::WriteProperty && needActivate) {
564  activate(object, methodOffset + id, 0);
565  }
566 
567  return -1;
568  }
569 
570  id -= metaData->propertyCount;
571 
572  if (id < metaData->aliasCount) {
573 
575 
577  *reinterpret_cast<void **>(a[0]) = 0;
578 
579  if (!ctxt) return -1;
580 
583 
584  QObject *target = ctxtPriv->data->idValues[d->contextIdx].data();
585  if (!target)
586  return -1;
587 
588  connectAlias(id);
589 
590  if (d->isObjectAlias()) {
591  *reinterpret_cast<QObject **>(a[0]) = target;
592  return -1;
593  }
594 
595  // Remove binding (if any) on write
597  int flags = *reinterpret_cast<int*>(a[3]);
599  QDeclarativeData *targetData = QDeclarativeData::get(target);
600  if (targetData && targetData->hasBindingBit(d->propertyIndex())) {
602  if (binding) binding->destroy();
603  }
604  }
605  }
606 
607  if (d->isValueTypeAlias()) {
608  // Value type property
610 
611  QDeclarativeValueType *valueType = ep->valueTypes[d->valueType()];
612  Q_ASSERT(valueType);
613 
614  valueType->read(target, d->propertyIndex());
615  int rv = QMetaObject::metacall(valueType, c, d->valueTypeIndex(), a);
616 
618  valueType->write(target, d->propertyIndex(), 0x00);
619 
620  return rv;
621 
622  } else {
623  return QMetaObject::metacall(target, c, d->propertyIndex(), a);
624  }
625 
626  }
627  return -1;
628 
629  }
630 
631  } else if(c == QMetaObject::InvokeMetaMethod) {
632 
633  if (id >= methodOffset) {
634 
635  id -= methodOffset;
636  int plainSignals = metaData->signalCount + metaData->propertyCount +
638  if (id < plainSignals) {
639  QMetaObject::activate(object, _id, a);
640  return -1;
641  }
642 
643  id -= plainSignals;
644 
645  if (id < metaData->methodCount) {
646  if (!ctxt->engine)
647  return -1; // We can't run the method
648 
650 
651  QScriptValue function = method(id);
652 
653  QScriptValueList args;
655  if (data->parameterCount) {
656  for (int ii = 0; ii < data->parameterCount; ++ii) {
657  args << ep->scriptValueFromVariant(*(QVariant *)a[ii + 1]);
658  }
659  }
660  QScriptValue rv = function.call(ep->objectClass->newQObject(object), args);
661 
662  if (a[0]) *reinterpret_cast<QVariant *>(a[0]) = ep->scriptValueToVariant(rv);
663 
664  return -1;
665  }
666  return -1;
667  }
668  }
669 
670  if (parent)
671  return parent->metaCall(c, _id, a);
672  else
673  return object->qt_metacall(c, _id, a);
674 }
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
void writeVarProperty(int, const QScriptValue &)
static QObject * list_at(QDeclarativeListProperty< QObject > *, int)
static QDeclarativeData * get(const QObject *object, bool create=false)
int type
Definition: qmetatype.cpp:239
unsigned char c[8]
Definition: qnumeric_p.h:62
QDeclarativeEngine * engine
static int metacall(QObject *, Call, int, void **)
static QDeclarativeValueType * valueType(int)
virtual void destroy(DestroyMode mode=DisconnectBinding)
Destroy the binding.
T1 first
Definition: qpair.h:65
T2 second
Definition: qpair.h:66
QAbstractDynamicMetaObject * parent
int qMetaTypeId()
Definition: qmetatype.h:224
static void list_clear(QDeclarativeListProperty< QObject > *)
PropertyData * propertyData() const
The QDate class provides date functions.
Definition: qdatetime.h:55
long ASN1_INTEGER_get ASN1_INTEGER * a
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags flags)=0
QHash< int, QPair< int, QDeclarativePropertyValueInterceptor * > > interceptors
virtual void write(const QVariant &value)=0
This method will be called when a new value is assigned to the property being intercepted.
int propertyCount() const
Returns the number of properties in this class, including the number of properties provided by each b...
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
bool testBit(int i) const
Returns true if the bit at index position i is 1; otherwise returns false.
Definition: qbitarray.h:124
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
bool hasBindingBit(int) const
static QDeclarativeEnginePrivate * get(QDeclarativeEngine *e)
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
QScriptValue newQObject(QObject *, int type=QMetaType::QObjectStar)
QVariant scriptValueToVariant(const QScriptValue &, int hint=QVariant::Invalid)
virtual int metaCall(QMetaObject::Call, int _id, void **)
Definition: qobject_p.h:336
const QDeclarativeVMEMetaData * metaData
QDeclarativeContextData * data
int methodOffset() const
Returns the method offset for this class; i.e.
int userType() const
Returns this property&#39;s user type.
virtual void setValue(QVariant)=0
QScriptValue scriptValueFromVariant(const QVariant &)
static QDeclarativeAbstractBinding * setBinding(QObject *, int coreIndex, int valueTypeIndex, QDeclarativeAbstractBinding *, WriteFlags flags=DontRemoveBinding)
QDeclarativeObjectScriptClass * objectClass
static QDeclarativeContextPrivate * get(QDeclarativeContext *context)
The QDateTime class provides date and time functions.
Definition: qdatetime.h:216
static int list_count(QDeclarativeListProperty< QObject > *)
QDeclarativeValueTypeFactory valueTypes
static void activate(QObject *sender, int signal_index, void **argv)
Definition: qobject.cpp:3690
QDeclarativeContext * asQDeclarativeContext()
static void list_append(QDeclarativeListProperty< QObject > *, QObject *)
struct QMetaObject::@38 d
QVariant read(const QObject *obj) const
Reads the property&#39;s value from the given object.
The QDeclarativeContext class defines a context within a QML engine.
#define QML_ALIAS_FLAG_PTR
The QMetaProperty class provides meta-data about a property.
Definition: qmetaobject.h:176
QDeclarativeGuardedContextData ctxt
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57
int methodCount() const
Returns the number of methods known to the meta-object system in this class, including the number of ...
The QDeclarativePropertyValueInterceptor class is inherited by property interceptors such as Behavior...
QScriptValue call(const QScriptValue &thisObject=QScriptValue(), const QScriptValueList &args=QScriptValueList())
Calls this QScriptValue as a function, using thisObject as the `this&#39; object in the function call...
bool isEmpty() const
Returns true if this bit array has size 0; otherwise returns false.
Definition: qbitarray.h:78
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
QMetaProperty property(int index) const
Returns the meta-data for the property with the given index.
virtual void read(QObject *, int)=0

◆ method()

QScriptValue QDeclarativeVMEMetaObject::method ( int  index)
private

Definition at line 676 of file qdeclarativevmemetaobject.cpp.

Referenced by metaCall(), and vmeMethod().

677 {
678  if (!methods)
680 
681  if (!methods[index].isValid()) {
683 
684  const QChar *body =
685  (const QChar *)(((const char*)metaData) + data->bodyOffset);
686 
687  QString code = QString::fromRawData(body, data->bodyLength);
688 
689  // XXX Use QScriptProgram
690  // XXX We should evaluate all methods in a single big script block to
691  // improve the call time between dynamic methods defined on the same
692  // object
694  data->lineNumber, 0);
695  }
696 
697  return methods[index];
698 }
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
Definition: qurl.cpp:5896
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
static QString fromRawData(const QChar *, int size)
Constructs a QString that uses the first size Unicode characters in the array unicode.
Definition: qstring.cpp:7673
const QDeclarativeVMEMetaData * metaData
static QScriptValue evalInObjectScope(QDeclarativeContextData *, QObject *, const QString &, const QString &, int, QScriptValue *)
quint16 index
QDeclarativeGuardedContextData ctxt
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57

◆ readVarProperty()

QScriptValue QDeclarativeVMEMetaObject::readVarProperty ( int  id)
private

Definition at line 700 of file qdeclarativevmemetaobject.cpp.

Referenced by vmeProperty().

701 {
702  if (data[id].dataType() == qMetaTypeId<QScriptValue>())
703  return data[id].asQScriptValue();
704  else if (data[id].dataType() == QMetaType::QObjectStar)
706  else
708 }
QDeclarativeEngine * engine
static QDeclarativeEnginePrivate * get(QDeclarativeEngine *e)
QScriptValue newQObject(QObject *, int type=QMetaType::QObjectStar)
const QScriptValue & asQScriptValue()
QScriptValue scriptValueFromVariant(const QVariant &)
QDeclarativeObjectScriptClass * objectClass
QDeclarativeGuardedContextData ctxt

◆ readVarPropertyAsVariant()

QVariant QDeclarativeVMEMetaObject::readVarPropertyAsVariant ( int  id)
private

Definition at line 710 of file qdeclarativevmemetaobject.cpp.

Referenced by metaCall().

711 {
712  if (data[id].dataType() == qMetaTypeId<QScriptValue>())
713  return QDeclarativeEnginePrivate::get(ctxt->engine)->scriptValueToVariant(data[id].asQScriptValue());
714  else if (data[id].dataType() == QMetaType::QObjectStar)
715  return QVariant::fromValue(data[id].asQObject());
716  else
717  return data[id].asQVariant();
718 }
QDeclarativeEngine * engine
static QDeclarativeEnginePrivate * get(QDeclarativeEngine *e)
QVariant scriptValueToVariant(const QScriptValue &, int hint=QVariant::Invalid)
static QVariant fromValue(const T &value)
Returns a QVariant containing a copy of value.
Definition: qvariant.h:336
QDeclarativeGuardedContextData ctxt

◆ registerInterceptor()

void QDeclarativeVMEMetaObject::registerInterceptor ( int  index,
int  valueIndex,
QDeclarativePropertyValueInterceptor interceptor 
)

Definition at line 772 of file qdeclarativevmemetaobject.cpp.

773 {
774  if (aInterceptors.isEmpty())
777  interceptors.insert(index, qMakePair(valueIndex, interceptor));
778 }
void setBit(int i)
Sets the bit at index position i to 1.
Definition: qbitarray.h:128
QHash< int, QPair< int, QDeclarativePropertyValueInterceptor * > > interceptors
int propertyCount() const
Returns the number of properties in this class, including the number of properties provided by each b...
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
const QDeclarativeVMEMetaData * metaData
void resize(int size)
Resizes the bit array to size bits.
Definition: qbitarray.cpp:214
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
Definition: qpair.h:102
quint16 index
bool isEmpty() const
Returns true if this bit array has size 0; otherwise returns false.
Definition: qbitarray.h:78

◆ setVmeMethod()

void QDeclarativeVMEMetaObject::setVmeMethod ( int  index,
const QScriptValue value 
)

Definition at line 807 of file qdeclarativevmemetaobject.cpp.

Referenced by QDeclarativeEngineDebugService::setMethodBody().

808 {
809  if (index < methodOffset) {
810  Q_ASSERT(parent);
811  return static_cast<QDeclarativeVMEMetaObject *>(parent)->setVmeMethod(index, value);
812  }
813  int plainSignals = metaData->signalCount + metaData->propertyCount + metaData->aliasCount;
814  Q_ASSERT(index >= (methodOffset + plainSignals) && index < (methodOffset + plainSignals + metaData->methodCount));
815 
816  if (!methods)
818  methods[index - methodOffset - plainSignals] = value;
819 }
QAbstractDynamicMetaObject * parent
void setVmeMethod(int index, const QScriptValue &)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
const QDeclarativeVMEMetaData * metaData
int methodOffset() const
Returns the method offset for this class; i.e.
quint16 index
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57

◆ setVMEProperty()

void QDeclarativeVMEMetaObject::setVMEProperty ( int  index,
const QScriptValue v 
)

Definition at line 830 of file qdeclarativevmemetaobject.cpp.

831 {
832  if (index < propOffset) {
833  Q_ASSERT(parent);
835  }
836  return writeVarProperty(index - propOffset, v);
837 }
void writeVarProperty(int, const QScriptValue &)
QAbstractDynamicMetaObject * parent
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void setVMEProperty(int index, const QScriptValue &)
quint16 index

◆ vmeMethod()

QScriptValue QDeclarativeVMEMetaObject::vmeMethod ( int  index)

Definition at line 796 of file qdeclarativevmemetaobject.cpp.

797 {
798  if (index < methodOffset) {
799  Q_ASSERT(parent);
800  return static_cast<QDeclarativeVMEMetaObject *>(parent)->vmeMethod(index);
801  }
802  int plainSignals = metaData->signalCount + metaData->propertyCount + metaData->aliasCount;
803  Q_ASSERT(index >= (methodOffset + plainSignals) && index < (methodOffset + plainSignals + metaData->methodCount));
804  return method(index - methodOffset - plainSignals);
805 }
QAbstractDynamicMetaObject * parent
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
const QDeclarativeVMEMetaData * metaData
int methodOffset() const
Returns the method offset for this class; i.e.
quint16 index

◆ vmeMethodLineNumber()

int QDeclarativeVMEMetaObject::vmeMethodLineNumber ( int  index)

Definition at line 780 of file qdeclarativevmemetaobject.cpp.

Referenced by QDeclarativeEngineDebugService::setMethodBody().

781 {
782  if (index < methodOffset) {
783  Q_ASSERT(parent);
785  }
786 
787  int plainSignals = metaData->signalCount + metaData->propertyCount + metaData->aliasCount;
788  Q_ASSERT(index >= (methodOffset + plainSignals) && index < (methodOffset + plainSignals + metaData->methodCount));
789 
790  int rawIndex = index - methodOffset - plainSignals;
791 
793  return data->lineNumber;
794 }
QAbstractDynamicMetaObject * parent
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
const QDeclarativeVMEMetaData * metaData
int methodOffset() const
Returns the method offset for this class; i.e.
quint16 index

◆ vmeProperty()

QScriptValue QDeclarativeVMEMetaObject::vmeProperty ( int  index)

Definition at line 821 of file qdeclarativevmemetaobject.cpp.

822 {
823  if (index < propOffset) {
824  Q_ASSERT(parent);
825  return static_cast<QDeclarativeVMEMetaObject *>(parent)->vmeProperty(index);
826  }
827  return readVarProperty(index - propOffset);
828 }
QAbstractDynamicMetaObject * parent
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
quint16 index

◆ writeVarProperty() [1/2]

void QDeclarativeVMEMetaObject::writeVarProperty ( int  id,
const QScriptValue value 
)
private

Definition at line 720 of file qdeclarativevmemetaobject.cpp.

Referenced by metaCall(), and setVMEProperty().

721 {
722  data[id].setValue(value);
723  activate(object, methodOffset + id, 0);
724 }
int methodOffset() const
Returns the method offset for this class; i.e.
static void activate(QObject *sender, int signal_index, void **argv)
Definition: qobject.cpp:3690

◆ writeVarProperty() [2/2]

void QDeclarativeVMEMetaObject::writeVarProperty ( int  id,
const QVariant value 
)
private

Definition at line 726 of file qdeclarativevmemetaobject.cpp.

727 {
728  bool needActivate = false;
729  if (value.userType() == QMetaType::QObjectStar) {
730  QObject *o = qvariant_cast<QObject *>(value);
731  needActivate = (data[id].dataType() != QMetaType::QObjectStar || data[id].asQObject() != o);
732  data[id].setValue(qvariant_cast<QObject *>(value));
733  } else {
734  needActivate = (data[id].dataType() != qMetaTypeId<QVariant>() ||
735  data[id].asQVariant().userType() != value.userType() ||
736  data[id].asQVariant() != value);
737  data[id].setValue(value);
738  }
739  if (needActivate)
740  activate(object, methodOffset + id, 0);
741 }
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
int methodOffset() const
Returns the method offset for this class; i.e.
int userType() const
Returns the storage type of the value stored in the variant.
Definition: qvariant.cpp:1913
static void activate(QObject *sender, int signal_index, void **argv)
Definition: qobject.cpp:3690
T qvariant_cast(const QVariant &)
Definition: qvariant.h:571

Properties

◆ aConnected

QBitArray QDeclarativeVMEMetaObject::aConnected
private

Definition at line 166 of file qdeclarativevmemetaobject_p.h.

Referenced by connectAlias(), and QDeclarativeVMEMetaObject().

◆ aInterceptors

QBitArray QDeclarativeVMEMetaObject::aInterceptors
private

Definition at line 167 of file qdeclarativevmemetaobject_p.h.

Referenced by metaCall(), and registerInterceptor().

◆ compiledData

QDeclarativeCompiledData* QDeclarativeVMEMetaObject::compiledData
private

◆ ctxt

QDeclarativeGuardedContextData QDeclarativeVMEMetaObject::ctxt
private

◆ data

QDeclarativeVMEVariant* QDeclarativeVMEMetaObject::data
private

◆ interceptors

QHash<int, QPair<int, QDeclarativePropertyValueInterceptor*> > QDeclarativeVMEMetaObject::interceptors
private

Definition at line 168 of file qdeclarativevmemetaobject_p.h.

Referenced by metaCall(), and registerInterceptor().

◆ listProperties

QList<List> QDeclarativeVMEMetaObject::listProperties
private

Definition at line 187 of file qdeclarativevmemetaobject_p.h.

Referenced by metaCall(), and QDeclarativeVMEMetaObject().

◆ metaData

const QDeclarativeVMEMetaData* QDeclarativeVMEMetaObject::metaData
private

◆ methodOffset

int QDeclarativeVMEMetaObject::methodOffset
private

Definition at line 161 of file qdeclarativevmemetaobject_p.h.

◆ methods

QScriptValue* QDeclarativeVMEMetaObject::methods
private

Definition at line 170 of file qdeclarativevmemetaobject_p.h.

Referenced by method(), setVmeMethod(), and ~QDeclarativeVMEMetaObject().

◆ object

QObject* QDeclarativeVMEMetaObject::object
private

Definition at line 155 of file qdeclarativevmemetaobject_p.h.

Referenced by connectAlias().

◆ parent

QAbstractDynamicMetaObject* QDeclarativeVMEMetaObject::parent
private

◆ propOffset

int QDeclarativeVMEMetaObject::propOffset
private

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