#include <qobjectdefs.h>
Inheritance diagram for QMetaObject:


The Qt {Meta-Object System} in Qt is responsible for the signals and slots inter-object communication mechanism, runtime type information, and the Qt property system. A single QMetaObject instance is created for each QObject subclass that is used in an application, and this instance stores all the meta-information for the QObject subclass. This object is available as QObject::metaObject().
This class is not normally required for application programming, but it is useful if you write meta-applications, such as scripting engines or GUI builders.
The functions you are most likely to find useful are these: className() returns the name of a class. superClass() returns the superclass's meta-object. method() and methodCount() provide information about a class's meta-methods (signals, slots and other member functions). enumerator() and enumeratorCount() and provide information about a class's enumerators. propertyCount() and property() provide information about a class's properties.
The index functions indexOfMethod(), indexOfEnumerator(), and indexOfProperty() map names of member functions, enumerators, or properties to indexes in the meta-object. For example, Qt uses indexOfMethod() internally when you connect a signal to a slot.
Classes can also have a list of {name}--{value} pairs of additional class information, stored in QMetaClassInfo objects. The number of pairs is returned by classInfoCount(), single pairs are returned by classInfo(), and you can search for pairs with indexOfClassInfo().
Definition at line 211 of file qobjectdefs.h.
| enum QMetaObject::Call |
Definition at line 338 of file qobjectdefs.h.
00338 { 00339 InvokeMetaMethod, 00340 ReadProperty, 00341 WriteProperty, 00342 ResetProperty, 00343 QueryPropertyDesignable, 00344 QueryPropertyScriptable, 00345 QueryPropertyStored, 00346 QueryPropertyEditable, 00347 QueryPropertyUser 00348 };
| const char * QMetaObject::className | ( | ) | const [inline] |
Returns the class name.
Definition at line 362 of file qobjectdefs.h.
References d.
Referenced by qdesigner_internal::QDesignerFormBuilder::applyProperties(), QObject::connect(), QDesignerMemberSheet::declaredInClass(), Q3SqlPropertyMap::property(), QDesignerPropertySheet::propertyGroup(), qDBusGenerateMetaObjectXml(), QDesignerPropertySheet::QDesignerPropertySheet(), QTest::qExec(), QTest::qSignalDumperCallback(), QTest::qSignalDumperCallbackSlot(), QAccessible::queryAccessibleInterface(), QMetaProperty::read(), QDBusAdaptorConnector::relay(), Q3SqlPropertyMap::setProperty(), and QAbstractFormBuilder::toVariant().
00363 { return d.stringdata; }
| const QMetaObject * QMetaObject::superClass | ( | ) | const [inline] |
Returns the meta-object of the superclass, or 0 if there is no such object.
Definition at line 365 of file qobjectdefs.h.
References d.
Referenced by QDesignerMemberSheet::declaredInClass(), QObject::disconnect(), qdesigner_internal::introducedBy(), Q3SqlPropertyMap::property(), qDBusIntrospectObject(), QDesignerPropertySheet::QDesignerPropertySheet(), QAccessible::queryAccessibleInterface(), QDBusConnectionPrivate::relaySignal(), and Q3SqlPropertyMap::setProperty().
00366 { return d.superdata; }
Definition at line 187 of file qmetaobject.cpp.
References m.
Referenced by qt_qFindChild_helper(), and qt_qFindChildren_helper().
00188 { 00189 if (obj) { 00190 const QMetaObject *m = obj->metaObject(); 00191 do { 00192 if (m == this) 00193 return const_cast<QObject*>(obj); 00194 } while ((m = m->d.superdata)); 00195 } 00196 return 0; 00197 }
| QString QMetaObject::tr | ( | const char * | s, | |
| const char * | c | |||
| ) | const |
Definition at line 203 of file qmetaobject.cpp.
References QCoreApplication::CodecForTr, d, and QCoreApplication::translate().
00204 { 00205 return QCoreApplication::translate(d.stringdata, s, c, QCoreApplication::CodecForTr); 00206 }
Here is the call graph for this function:

| QString QMetaObject::trUtf8 | ( | const char * | s, | |
| const char * | c | |||
| ) | const |
Definition at line 219 of file qmetaobject.cpp.
References d, QCoreApplication::translate(), and QCoreApplication::UnicodeUTF8.
00220 { 00221 return QCoreApplication::translate(d.stringdata, s, c, QCoreApplication::UnicodeUTF8); 00222 }
Here is the call graph for this function:

| QString QMetaObject::tr | ( | const char * | s, | |
| const char * | c, | |||
| int | n | |||
| ) | const |
Definition at line 211 of file qmetaobject.cpp.
References QCoreApplication::CodecForTr, d, and QCoreApplication::translate().
00212 { 00213 return QCoreApplication::translate(d.stringdata, s, c, QCoreApplication::CodecForTr, n); 00214 }
Here is the call graph for this function:

| QString QMetaObject::trUtf8 | ( | const char * | s, | |
| const char * | c, | |||
| int | n | |||
| ) | const |
Definition at line 227 of file qmetaobject.cpp.
References d, QCoreApplication::translate(), and QCoreApplication::UnicodeUTF8.
00228 { 00229 return QCoreApplication::translate(d.stringdata, s, c, QCoreApplication::UnicodeUTF8, n); 00230 }
Here is the call graph for this function:

| int QMetaObject::methodOffset | ( | ) | const |
Returns the method offset for this class; i.e. the index position of this class's first member function.
The offset is the sum of all the methods in the class's superclasses (which is always positive since QObject has the deleteLater() slot and a destroyed() signal).
Definition at line 243 of file qmetaobject.cpp.
References d, m, QMetaObjectPrivate::methodCount, and priv().
Referenced by listInterface(), QDBusInterfacePrivate::metacall(), method(), and placeCall().
00244 { 00245 int offset = 0; 00246 const QMetaObject *m = d.superdata; 00247 while (m) { 00248 offset += priv(m->d.data)->methodCount; 00249 m = m->d.superdata; 00250 } 00251 return offset; 00252 }
Here is the call graph for this function:

| int QMetaObject::enumeratorOffset | ( | ) | const |
Returns the enumerator offset for this class; i.e. the index position of this class's first enumerator.
If the class has no superclasses with enumerators, the offset is 0; otherwise the offset is the sum of all the enumerators in the class's superclasses.
Definition at line 265 of file qmetaobject.cpp.
References d, QMetaObjectPrivate::enumeratorCount, m, and priv().
Referenced by enumerator().
00266 { 00267 int offset = 0; 00268 const QMetaObject *m = d.superdata; 00269 while (m) { 00270 offset += priv(m->d.data)->enumeratorCount; 00271 m = m->d.superdata; 00272 } 00273 return offset; 00274 }
Here is the call graph for this function:

| int QMetaObject::propertyOffset | ( | ) | const |
Returns the property offset for this class; i.e. the index position of this class's first property.
The offset is the sum of all the properties in the class's superclasses (which is always positive since QObject has the name() property).
Definition at line 286 of file qmetaobject.cpp.
References d, m, priv(), and QMetaObjectPrivate::propertyCount.
Referenced by qdesigner_internal::introducedBy(), QMetaProperty::isDesignable(), QMetaProperty::isEditable(), QMetaProperty::isScriptable(), QMetaProperty::isStored(), QMetaProperty::isUser(), listInterface(), QDBusInterfacePrivate::metacall(), property(), QMetaProperty::read(), QMetaProperty::reset(), and QMetaProperty::write().
00287 { 00288 int offset = 0; 00289 const QMetaObject *m = d.superdata; 00290 while (m) { 00291 offset += priv(m->d.data)->propertyCount; 00292 m = m->d.superdata; 00293 } 00294 return offset; 00295 }
Here is the call graph for this function:

| int QMetaObject::classInfoOffset | ( | ) | const |
Returns the class information offset for this class; i.e. the index position of this class's first class information item.
If the class has no superclasses with class information, the offset is 0; otherwise the offset is the sum of all the class information items in the class's superclasses.
Definition at line 307 of file qmetaobject.cpp.
References QMetaObjectPrivate::classInfoCount, d, m, and priv().
Referenced by classInfo(), and qDBusGenerateMetaObjectXml().
00308 { 00309 int offset = 0; 00310 const QMetaObject *m = d.superdata; 00311 while (m) { 00312 offset += priv(m->d.data)->classInfoCount; 00313 m = m->d.superdata; 00314 } 00315 return offset; 00316 }
Here is the call graph for this function:

| int QMetaObject::methodCount | ( | ) | const |
Returns the number of methods in this class. These include ordinary methods, signals, and slots.
Definition at line 324 of file qmetaobject.cpp.
References d, m, QMetaObjectPrivate::methodCount, n, and priv().
Referenced by QAccessibleObjectPrivate::actionList(), QDBusViewer::callMethod(), QDBusAbstractInterface::callWithArgumentList(), connectSlotsByName(), QDesignerMemberSheet::count(), findSlot(), generateInterfaceXml(), listInterface(), placeCall(), QTest::qExec(), and QDBusAbstractAdaptor::setAutoRelaySignals().
00325 { 00326 int n = priv(d.data)->methodCount; 00327 const QMetaObject *m = d.superdata; 00328 while (m) { 00329 n += priv(m->d.data)->methodCount; 00330 m = m->d.superdata; 00331 } 00332 return n; 00333 }
Here is the call graph for this function:

| int QMetaObject::enumeratorCount | ( | ) | const |
Returns the number of enumerators in this class.
Definition at line 340 of file qmetaobject.cpp.
References d, QMetaObjectPrivate::enumeratorCount, m, n, and priv().
Referenced by WidgetInfo::checkEnumerator(), and WidgetInfo::resolveEnumerator().
00341 { 00342 int n = priv(d.data)->enumeratorCount; 00343 const QMetaObject *m = d.superdata; 00344 while (m) { 00345 n += priv(m->d.data)->enumeratorCount; 00346 m = m->d.superdata; 00347 } 00348 return n; 00349 }
Here is the call graph for this function:

| int QMetaObject::propertyCount | ( | ) | const |
Returns the number of properties in this class.
Definition at line 356 of file qmetaobject.cpp.
References d, m, n, priv(), and QMetaObjectPrivate::propertyCount.
Referenced by QAbstractFormBuilder::computeProperties(), QDesignerPropertySheet::count(), generateInterfaceXml(), listInterface(), and userProperty().
00357 { 00358 int n = priv(d.data)->propertyCount; 00359 const QMetaObject *m = d.superdata; 00360 while (m) { 00361 n += priv(m->d.data)->propertyCount; 00362 m = m->d.superdata; 00363 } 00364 return n; 00365 }
Here is the call graph for this function:

| int QMetaObject::classInfoCount | ( | ) | const |
Returns the number of items of class information in this class.
Definition at line 372 of file qmetaobject.cpp.
References QMetaObjectPrivate::classInfoCount, d, m, n, and priv().
00373 { 00374 int n = priv(d.data)->classInfoCount; 00375 const QMetaObject *m = d.superdata; 00376 while (m) { 00377 n += priv(m->d.data)->classInfoCount; 00378 m = m->d.superdata; 00379 } 00380 return n; 00381 }
Here is the call graph for this function:

| int QMetaObject::indexOfMethod | ( | const char * | method | ) | const |
Finds method and returns its index; otherwise returns -1.
Note that the method has to be in normalized form, as returned by normalizedSignature().
Definition at line 391 of file qmetaobject.cpp.
References i, m, QMetaObjectPrivate::methodCount, QMetaObjectPrivate::methodData, and priv().
Referenced by connectSlotsByName(), QObject::disconnect(), QDesignerMemberSheet::indexOf(), and QSignalSpy::QSignalSpy().
00392 { 00393 int i = -1; 00394 const QMetaObject *m = this; 00395 while (m && i < 0) { 00396 for (i = priv(m->d.data)->methodCount-1; i >= 0; --i) 00397 if (strcmp(method, m->d.stringdata 00398 + m->d.data[priv(m->d.data)->methodData + 5*i]) == 0) { 00399 i += m->methodOffset(); 00400 break; 00401 } 00402 m = m->d.superdata; 00403 } 00404 return i; 00405 }
Here is the call graph for this function:

| int QMetaObject::indexOfSignal | ( | const char * | signal | ) | const |
Finds signal and returns its index; otherwise returns -1.
This is the same as indexOfMethod(), except that it will return -1 if the method exists but isn't a signal.
Note that the signal has to be in normalized form, as returned by normalizedSignature().
Definition at line 418 of file qmetaobject.cpp.
References i, m, QMetaObjectPrivate::methodCount, QMetaObjectPrivate::methodData, MethodSignal, MethodTypeMask, priv(), and qWarning().
Referenced by QObject::connect(), QObject::disconnect(), WidgetInfo::isValidSignal(), QObject::receivers(), and QDBusAbstractAdaptor::setAutoRelaySignals().
00419 { 00420 int i = -1; 00421 const QMetaObject *m = this; 00422 while (m && i < 0) { 00423 for (i = priv(m->d.data)->methodCount-1; i >= 0; --i) 00424 if ((m->d.data[priv(m->d.data)->methodData + 5*i + 4] & MethodTypeMask) == MethodSignal 00425 && strcmp(signal, m->d.stringdata 00426 + m->d.data[priv(m->d.data)->methodData + 5*i]) == 0) { 00427 i += m->methodOffset(); 00428 break; 00429 } 00430 m = m->d.superdata; 00431 } 00432 #ifndef QT_NO_DEBUG 00433 if (i >= 0 && m && m->d.superdata) { 00434 int conflict = m->d.superdata->indexOfMethod(signal); 00435 if (conflict >= 0) 00436 qWarning("QMetaObject::indexOfSignal:%s: Conflict with %s::%s", 00437 m->d.stringdata, m->d.superdata->d.stringdata, signal); 00438 } 00439 #endif 00440 return i; 00441 }
Here is the call graph for this function:

| int QMetaObject::indexOfSlot | ( | const char * | slot | ) | const |
Finds slot and returns its index; otherwise returns -1.
This is the same as indexOfMethod(), except that it will return -1 if the method exists but isn't a slot.
Definition at line 451 of file qmetaobject.cpp.
References i, m, QMetaObjectPrivate::methodCount, QMetaObjectPrivate::methodData, MethodSlot, MethodTypeMask, and priv().
Referenced by QObject::connect(), and WidgetInfo::isValidSlot().
00452 { 00453 int i = -1; 00454 const QMetaObject *m = this; 00455 while (m && i < 0) { 00456 for (i = priv(m->d.data)->methodCount-1; i >= 0; --i) 00457 if ((m->d.data[priv(m->d.data)->methodData + 5*i + 4] & MethodTypeMask) == MethodSlot 00458 && strcmp(slot, m->d.stringdata 00459 + m->d.data[priv(m->d.data)->methodData + 5*i]) == 0) { 00460 i += m->methodOffset(); 00461 break; 00462 } 00463 m = m->d.superdata; 00464 } 00465 return i; 00466 }
Here is the call graph for this function:

| int QMetaObject::indexOfEnumerator | ( | const char * | name | ) | const |
Finds enumerator name and returns its index; otherwise returns -1.
Definition at line 492 of file qmetaobject.cpp.
References QMetaObjectPrivate::enumeratorCount, QMetaObjectPrivate::enumeratorData, i, m, and priv().
Referenced by property().
00493 { 00494 int i = -1; 00495 const QMetaObject *m = this; 00496 while (m && i < 0) { 00497 for (i = priv(m->d.data)->enumeratorCount-1; i >= 0; --i) 00498 if (strcmp(name, m->d.stringdata 00499 + m->d.data[priv(m->d.data)->enumeratorData + 4*i]) == 0) { 00500 i += m->enumeratorOffset(); 00501 break; 00502 } 00503 m = m->d.superdata; 00504 } 00505 return i; 00506 }
Here is the call graph for this function:

| int QMetaObject::indexOfProperty | ( | const char * | name | ) | const |
Finds property name and returns its index; otherwise returns -1.
Definition at line 514 of file qmetaobject.cpp.
References i, m, priv(), QMetaObjectPrivate::propertyCount, and QMetaObjectPrivate::propertyData.
Referenced by qdesigner_internal::QDesignerResource::checkProperty(), QAbstractFormBuilder::computeProperties(), QDesignerPropertySheet::createFakeProperty(), qdesigner_internal::QDesignerResource::createProperty(), QAbstractFormBuilder::createProperty(), QDesignerPropertySheet::indexOf(), WidgetInfo::isValidProperty(), qdesigner_internal::PaletteModel::PaletteModel(), QObject::property(), QObject::setProperty(), and QAbstractFormBuilder::toVariant().
00515 { 00516 int i = -1; 00517 const QMetaObject *m = this; 00518 while (m && i < 0) { 00519 for (i = priv(m->d.data)->propertyCount-1; i >= 0; --i) 00520 if (strcmp(name, m->d.stringdata 00521 + m->d.data[priv(m->d.data)->propertyData + 3*i]) == 0) { 00522 i += m->propertyOffset(); 00523 break; 00524 } 00525 m = m->d.superdata; 00526 } 00527 return i; 00528 }
Here is the call graph for this function:

| int QMetaObject::indexOfClassInfo | ( | const char * | name | ) | const |
Finds class information item name and returns its index; otherwise returns -1.
Definition at line 536 of file qmetaobject.cpp.
References QMetaObjectPrivate::classInfoCount, QMetaObjectPrivate::classInfoData, d, i, m, and priv().
Referenced by QAccessibleObjectPrivate::actionList(), QDBusAdaptorConnector::addAdaptor(), qDBusGenerateMetaObjectXml(), and QDBusConnectionPrivate::relaySignal().
00537 { 00538 int i = -1; 00539 const QMetaObject *m = this; 00540 while (m && i < 0) { 00541 for (i = priv(m->d.data)->classInfoCount-1; i >= 0; --i) 00542 if (strcmp(name, m->d.stringdata 00543 + m->d.data[priv(d.data)->classInfoData + 2*i]) == 0) { 00544 i += m->classInfoOffset(); 00545 break; 00546 } 00547 m = m->d.superdata; 00548 } 00549 return i; 00550 }
Here is the call graph for this function:

| QMetaMethod QMetaObject::method | ( | int | index | ) | const |
Returns the meta-data for the method with the given index.
Definition at line 557 of file qmetaobject.cpp.
References d, QMetaMethod::handle, i, QMetaObjectPrivate::methodCount, QMetaObjectPrivate::methodData, methodOffset(), QMetaMethod::mobj, and priv().
Referenced by QAccessibleObjectPrivate::actionList(), activate(), QDBusViewer::callMethod(), QDBusAbstractInterface::callWithArgumentList(), QObject::connect(), connectSlotsByName(), QDesignerMemberSheet::declaredInClass(), findSlot(), generateInterfaceXml(), QDesignerMemberSheet::inheritedFromWidget(), QDesignerMemberSheet::isSignal(), QDesignerMemberSheet::isSlot(), QDesignerMemberSheet::isVisible(), listInterface(), QDesignerMemberSheet::memberName(), QDBusInterfacePrivate::metacall(), QDesignerMemberSheet::parameterNames(), QDesignerMemberSheet::parameterTypes(), placeCall(), QTest::qExec(), QTest::qSignalDumperCallback(), QTest::qSignalDumperCallbackSlot(), QSignalSpy::QSignalSpy(), QDBusAdaptorConnector::relay(), QDBusConnectionPrivate::relaySignal(), QDBusAbstractAdaptor::setAutoRelaySignals(), and QDesignerMemberSheet::signature().
00558 { 00559 int i = index; 00560 i -= methodOffset(); 00561 if (i < 0 && d.superdata) 00562 return d.superdata->method(index); 00563 00564 QMetaMethod result; 00565 if (i >= 0 && i < priv(d.data)->methodCount) { 00566 result.mobj = this; 00567 result.handle = priv(d.data)->methodData + 5*i; 00568 } 00569 return result; 00570 }
Here is the call graph for this function:

| QMetaEnum QMetaObject::enumerator | ( | int | index | ) | const |
Returns the meta-data for the enumerator with the given index.
Definition at line 577 of file qmetaobject.cpp.
References d, QMetaObjectPrivate::enumeratorCount, QMetaObjectPrivate::enumeratorData, enumeratorOffset(), QMetaEnum::handle, i, QMetaEnum::mobj, and priv().
Referenced by WidgetInfo::checkEnumerator(), property(), and WidgetInfo::resolveEnumerator().
00578 { 00579 int i = index; 00580 i -= enumeratorOffset(); 00581 if (i < 0 && d.superdata) 00582 return d.superdata->enumerator(index); 00583 00584 QMetaEnum result; 00585 if (i >= 0 && i < priv(d.data)->enumeratorCount) { 00586 result.mobj = this; 00587 result.handle = priv(d.data)->enumeratorData + 4*i; 00588 } 00589 return result; 00590 }
Here is the call graph for this function:

| QMetaProperty QMetaObject::property | ( | int | index | ) | const |
Returns the meta-data for the property with the given index. If no such property exists, a null QMetaProperty is returned.
Definition at line 598 of file qmetaobject.cpp.
References d, enumerator(), EnumOrFlag, flags, QMetaProperty::handle, i, QMetaProperty::idx, indexOfEnumerator(), QMetaEnum::isValid(), QByteArray::left(), QMetaProperty::menum, QByteArray::mid(), QMetaProperty::mobj, priv(), QMetaObjectPrivate::propertyCount, QMetaObjectPrivate::propertyData, propertyOffset(), QMetaObject_findMetaObject(), s, QObject::staticQtMetaObject, and type.
Referenced by qdesigner_internal::QDesignerResource::checkProperty(), QAbstractFormBuilder::computeProperties(), qdesigner_internal::QDesignerResource::createProperty(), QAbstractFormBuilder::createProperty(), generateInterfaceXml(), QDesignerPropertySheet::isVisible(), listInterface(), QDBusInterfacePrivate::metacall(), QDesignerPropertySheet::metaProperty(), qdesigner_internal::PaletteModel::PaletteModel(), QObject::property(), QDesignerPropertySheet::property(), QDesignerPropertySheet::propertyName(), QDesignerPropertySheet::QDesignerPropertySheet(), QDesignerPropertySheet::reset(), QObject::setProperty(), QDesignerPropertySheet::setProperty(), QAbstractFormBuilder::toVariant(), and userProperty().
00599 { 00600 int i = index; 00601 i -= propertyOffset(); 00602 if (i < 0 && d.superdata) 00603 return d.superdata->property(index); 00604 00605 QMetaProperty result; 00606 if (i >= 0 && i < priv(d.data)->propertyCount) { 00607 int handle = priv(d.data)->propertyData + 3*i; 00608 int flags = d.data[handle + 2]; 00609 const char *type = d.stringdata + d.data[handle + 1]; 00610 result.mobj = this; 00611 result.handle = handle; 00612 result.idx = i; 00613 00614 if (flags & EnumOrFlag) { 00615 result.menum = enumerator(indexOfEnumerator(type)); 00616 if (!result.menum.isValid()) { 00617 QByteArray enum_name = type; 00618 QByteArray scope_name = d.stringdata; 00619 int s = enum_name.lastIndexOf("::"); 00620 if (s > 0) { 00621 scope_name = enum_name.left(s); 00622 enum_name = enum_name.mid(s + 2); 00623 } 00624 const QMetaObject *scope = 0; 00625 if (scope_name == "Qt") 00626 scope = &QObject::staticQtMetaObject; 00627 else 00628 scope = QMetaObject_findMetaObject(this, scope_name); 00629 if (scope) 00630 result.menum = scope->enumerator(scope->indexOfEnumerator(enum_name)); 00631 } 00632 } 00633 } 00634 return result; 00635 }
Here is the call graph for this function:

| QMetaClassInfo QMetaObject::classInfo | ( | int | index | ) | const |
Returns the meta-data for the item of class information with the given index.
Example:
class MyClass { Q_OBJECT Q_CLASSINFO("author", "Sabrina Schweinsteiger") Q_CLASSINFO("url", "http://doc.moosesoft.co.uk/1.0/") public: ... };
Definition at line 675 of file qmetaobject.cpp.
References QMetaObjectPrivate::classInfoCount, QMetaObjectPrivate::classInfoData, classInfoOffset(), d, QMetaClassInfo::handle, i, QMetaClassInfo::mobj, and priv().
Referenced by QAccessibleObjectPrivate::actionList(), QDBusAdaptorConnector::addAdaptor(), qDBusGenerateMetaObjectXml(), and QDBusConnectionPrivate::relaySignal().
00676 { 00677 int i = index; 00678 i -= classInfoOffset(); 00679 if (i < 0 && d.superdata) 00680 return d.superdata->classInfo(index); 00681 00682 QMetaClassInfo result; 00683 if (i >= 0 && i < priv(d.data)->classInfoCount) { 00684 result.mobj = this; 00685 result.handle = priv(d.data)->classInfoData + 2*i; 00686 } 00687 return result; 00688 }
Here is the call graph for this function:

| QMetaProperty QMetaObject::userProperty | ( | ) | const |
USER flag set to true.
Definition at line 644 of file qmetaobject.cpp.
References i, property(), and propertyCount().
00645 { 00646 const int propCount = propertyCount(); 00647 for (int i = propCount - 1; i >= 0; --i) { 00648 const QMetaProperty prop = property(i); 00649 if (prop.isUser()) 00650 return prop; 00651 } 00652 return QMetaProperty(); 00653 }
Here is the call graph for this function:

| bool QMetaObject::checkConnectArgs | ( | const char * | signal, | |
| const char * | method | |||
| ) | [static] |
Returns true if the signal and method arguments are compatible; otherwise returns false.
Both signal and method are expected to be normalized.
Definition at line 698 of file qmetaobject.cpp.
References qstrcmp(), qstrlen(), s1, and s2.
Referenced by QObject::connect().
00699 { 00700 const char *s1 = signal; 00701 const char *s2 = method; 00702 while (*s1++ != '(') { } // scan to first '(' 00703 while (*s2++ != '(') { } 00704 if (*s2 == ')' || qstrcmp(s1,s2) == 0) // method has no args or 00705 return true; // exact match 00706 int s1len = qstrlen(s1); 00707 int s2len = qstrlen(s2); 00708 if (s2len < s1len && strncmp(s1,s2,s2len-1)==0 && s1[s2len-1]==',') 00709 return true; // method has less args 00710 return false; 00711 }
Here is the call graph for this function:

| QByteArray QMetaObject::normalizedSignature | ( | const char * | method | ) | [static] |
Normalizes the signature of the given method.
Qt uses normalized signatures to decide whether two given signals and slots are compatible. Normalization reduces whitespace to a minimum, moves 'const' to the front where appropriate, removes 'const' from value types and replaces const references with values.
Definition at line 790 of file qmetaobject.cpp.
References buf, d, len, qNormalizeType(), qRemoveWhitespace(), and QByteArray::reserve().
Referenced by QAccessibleObjectPrivate::actionList(), QAccessibleWidget::addControllingSignal(), QObject::connect(), QObject::disconnect(), Ui3Reader::fixMethod(), invokeMethod(), QDBusMetaObjectGenerator::parseMethods(), QDBusMetaObjectGenerator::parseSignals(), QDBusConnectionPrivate::prepareHook(), QSignalSpy::QSignalSpy(), QObject::receivers(), QDBusConnectionPrivate::sendWithReplyAsync(), QDBusAbstractAdaptor::setAutoRelaySignals(), and QDesignerMemberSheet::signature().
00791 { 00792 QByteArray result; 00793 if (!method || !*method) 00794 return result; 00795 int len = strlen(method); 00796 char stackbuf[64]; 00797 char *buf = (len >= 64 ? new char[len+1] : stackbuf); 00798 qRemoveWhitespace(method, buf); 00799 char *d = buf; 00800 00801 result.reserve(len); 00802 00803 int argdepth = 0; 00804 int templdepth = 0; 00805 while (*d) { 00806 if (argdepth == 1) 00807 d = qNormalizeType(d, templdepth, result); 00808 if (*d == '(') 00809 ++argdepth; 00810 if (*d == ')') 00811 --argdepth; 00812 result += *d++; 00813 } 00814 00815 if (buf != stackbuf) 00816 delete [] buf; 00817 return result; 00818 }
Here is the call graph for this function:

| QByteArray QMetaObject::normalizedType | ( | const char * | type | ) | [static] |
See QMetaObject::normalizedSignature() for a description on how Qt normalizes.
Example:
QByteArray normType = QMetaObject::normalizedType(" int const *"); // normType is now "const int*"
Definition at line 764 of file qmetaobject.cpp.
References QVarLengthArray< T, Prealloc >::data(), qNormalizeType(), and qRemoveWhitespace().
Referenced by QMetaType::registerType(), and QMetaType::type().
00765 { 00766 QByteArray result; 00767 00768 if (!type || !*type) 00769 return result; 00770 00771 QVarLengthArray<char> stackbuf(strlen(type)); 00772 qRemoveWhitespace(type, stackbuf.data()); 00773 int templdepth = 0; 00774 qNormalizeType(stackbuf.data(), templdepth, result); 00775 00776 return result; 00777 }
Here is the call graph for this function:

| bool QMetaObject::connect | ( | const QObject * | sender, | |
| int | signal_index, | |||
| const QObject * | receiver, | |||
| int | method_index, | |||
| int | type = 0, |
|||
| int * | types = 0 | |||
| ) | [static] |
Definition at line 2731 of file qobject.cpp.
References QConnectionList::addConnection(), and QConnectionList::lock.
Referenced by QObject::connect(), QDBusAdaptorConnector::connectAllSignals(), connectSlotsByName(), and QSignalSpy::QSignalSpy().
02733 { 02734 QConnectionList *list = ::connectionList(); 02735 if (!list) 02736 return false; 02737 QWriteLocker locker(&list->lock); 02738 list->addConnection(const_cast<QObject *>(sender), signal_index, 02739 const_cast<QObject *>(receiver), method_index, type, types); 02740 return true; 02741 }
Here is the call graph for this function:

| bool QMetaObject::disconnect | ( | const QObject * | sender, | |
| int | signal_index, | |||
| const QObject * | receiver, | |||
| int | method_index | |||
| ) | [static] |
Definition at line 2746 of file qobject.cpp.
References QConnectionList::lock, and QConnectionList::removeConnection().
Referenced by QObject::disconnect(), and QDBusAdaptorConnector::disconnectAllSignals().
02748 { 02749 if (!sender) 02750 return false; 02751 QConnectionList *list = ::connectionList(); 02752 if (!list) 02753 return false; 02754 QWriteLocker locker(&list->lock); 02755 return list->removeConnection(const_cast<QObject*>(sender), signal_index, 02756 const_cast<QObject*>(receiver), method_index); 02757 }
Here is the call graph for this function:

| void QMetaObject::connectSlotsByName | ( | QObject * | object | ) | [static] |
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:
void on_<widget name>_<signal name>(<signal parameters>);
Let's assume our object has a child object of type QPushButton with the {QObject::objectName}{object name} {button1}. The slot to catch the button's {clicked()} signal would be:
void on_button1_clicked();
Definition at line 2779 of file qobject.cpp.
References QList< T >::at(), QMetaMethod::attributes(), QMetaMethod::Cloned, connect(), QList< T >::count(), QByteArray::data(), i, indexOfMethod(), j, len, QByteArray::length(), method(), methodCount(), QMetaMethod::methodType(), o, qstrlen(), qstrncmp(), qWarning(), QMetaMethod::Signal, and QMetaMethod::signature().
Referenced by CalculatorForm::CalculatorForm(), and ConnectionWidget::ConnectionWidget().
02780 { 02781 if (!o) 02782 return; 02783 const QMetaObject *mo = o->metaObject(); 02784 Q_ASSERT(mo); 02785 const QObjectList list = qFindChildren<QObject *>(o, QString()); 02786 for (int i = 0; i < mo->methodCount(); ++i) { 02787 const char *slot = mo->method(i).signature(); 02788 Q_ASSERT(slot); 02789 if (slot[0] != 'o' || slot[1] != 'n' || slot[2] != '_') 02790 continue; 02791 bool foundIt = false; 02792 for(int j = 0; j < list.count(); ++j) { 02793 const QObject *co = list.at(j); 02794 QByteArray objName = co->objectName().toAscii(); 02795 int len = objName.length(); 02796 if (!len || qstrncmp(slot + 3, objName.data(), len) || slot[len+3] != '_') 02797 continue; 02798 const QMetaObject *smo = co->metaObject(); 02799 int sigIndex = smo->indexOfMethod(slot + len + 4); 02800 if (sigIndex < 0) { // search for compatible signals 02801 int slotlen = qstrlen(slot + len + 4) - 1; 02802 for (int k = 0; k < co->metaObject()->methodCount(); ++k) { 02803 if (smo->method(k).methodType() != QMetaMethod::Signal) 02804 continue; 02805 02806 if (!qstrncmp(smo->method(k).signature(), slot + len + 4, slotlen)) { 02807 sigIndex = k; 02808 break; 02809 } 02810 } 02811 } 02812 if (sigIndex < 0) 02813 continue; 02814 if (QMetaObject::connect(co, sigIndex, o, i)) { 02815 foundIt = true; 02816 break; 02817 } 02818 } 02819 if (foundIt) { 02820 // we found our slot, now skip all overloads 02821 while (mo->method(i + 1).attributes() & QMetaMethod::Cloned) 02822 ++i; 02823 } else if (!(mo->method(i).attributes() & QMetaMethod::Cloned)) { 02824 qWarning("QMetaObject::connectSlotsByName: No matching signal for %s", slot); 02825 } 02826 } 02827 }
Here is the call graph for this function:

| void QMetaObject::activate | ( | QObject * | sender, | |
| int | signal_index, | |||
| void ** | argv | |||
| ) | [static] |
Definition at line 2972 of file qobject.cpp.
Referenced by activate(), QDBusInterfacePrivate::metacall(), and QDBusAdaptorConnector::relaySignal().
02973 { 02974 activate(sender, signal_index, signal_index, argv); 02975 }
| void QMetaObject::activate | ( | QObject * | sender, | |
| int | from_signal_index, | |||
| int | to_signal_index, | |||
| void ** | argv | |||
| ) | [static] |
Definition at line 2863 of file qobject.cpp.
References Qt::AutoConnection, c, QConnectionList::connections, QHash< Key, T >::const_iterator, QVarLengthArray< T, Prealloc >::constData(), QThreadData::current(), QVarLengthArray< T, Prealloc >::data(), i, InvokeMetaMethod, QConnectionList::lock, method(), qt_signal_spy_callback_set, queued_activate(), Qt::QueuedConnection, QReadLocker::relock(), QConnectionList::sendersHash, QSignalSpyCallbackSet::signal_begin_callback, QSignalSpyCallbackSet::signal_end_callback, QVarLengthArray< T, Prealloc >::size(), QSignalSpyCallbackSet::slot_begin_callback, QSignalSpyCallbackSet::slot_end_callback, start, and QReadLocker::unlock().
02864 { 02865 if (sender->d_func()->blockSig) 02866 return; 02867 02868 QConnectionList * const list = ::connectionList(); 02869 if (!list) 02870 return; 02871 02872 void *empty_argv[] = { 0 }; 02873 if (qt_signal_spy_callback_set.signal_begin_callback != 0) { 02874 qt_signal_spy_callback_set.signal_begin_callback(sender, from_signal_index, 02875 argv ? argv : empty_argv); 02876 } 02877 02878 QReadLocker locker(&list->lock); 02879 02880 QConnectionList::Hash::const_iterator it = list->sendersHash.constFind(sender); 02881 const QConnectionList::Hash::const_iterator start = it; 02882 const QConnectionList::Hash::const_iterator end = list->sendersHash.constEnd(); 02883 02884 if (start == end) { 02885 locker.unlock(); 02886 if (qt_signal_spy_callback_set.signal_end_callback != 0) 02887 qt_signal_spy_callback_set.signal_end_callback(sender, from_signal_index); 02888 return; 02889 } 02890 02891 QThreadData *currentThreadData = QThreadData::current(); 02892 02893 // QVarLengthArray doesn't use the same growth strategy as the rest of the Tulip classes, so we need to 02894 // determine the exact number of connections 02895 int i = 0; 02896 for (it = start; it != end && it.key() == sender; ++it) { 02897 ++i; 02898 } 02899 QVarLengthArray<int> connections(i); 02900 for (i = 0, it = start; it != end && it.key() == sender; ++i, ++it) { 02901 connections.data()[i] = it.value(); 02902 ++list->connections[it.value()].refCount; 02903 } 02904 02905 for (i = 0; i < connections.size(); ++i) { 02906 const int at = connections.constData()[connections.size() - (i + 1)]; 02907 QConnectionList * const list = ::connectionList(); 02908 QConnection *c = &list->connections[at]; 02909 --c->refCount; 02910 if (!c->receiver || ((c->signal < from_signal_index || c->signal > to_signal_index) && 02911 c->signal != -1)) 02912 continue; 02913 02914 // determine if this connection should be sent immediately or 02915 // put into the event queue 02916 if ((c->type == Qt::AutoConnection 02917 && (currentThreadData != sender->d_func()->threadData 02918 || c->receiver->d_func()->threadData != sender->d_func()->threadData)) 02919 || (c->type == Qt::QueuedConnection)) { 02920 ::queued_activate(sender, *c, argv, from_signal_index, to_signal_index); 02921 continue; 02922 } 02923 02924 const int method = c->method; 02925 QObject * const previousSender = c->receiver->d_func()->currentSender; 02926 int previousFrom = c->receiver->d_func()->currentSenderSignalIdStart; 02927 int previousTo = c->receiver->d_func()->currentSenderSignalIdEnd; 02928 c->receiver->d_func()->currentSender = sender; 02929 c->receiver->d_func()->currentSenderSignalIdStart = from_signal_index; 02930 c->receiver->d_func()->currentSenderSignalIdEnd = to_signal_index; 02931 locker.unlock(); 02932 02933 if (qt_signal_spy_callback_set.slot_begin_callback != 0) 02934 qt_signal_spy_callback_set.slot_begin_callback(c->receiver, method, argv ? argv : empty_argv); 02935 02936 #if defined(QT_NO_EXCEPTIONS) 02937 c->receiver->qt_metacall(QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv); 02938 #else 02939 try { 02940 c->receiver->qt_metacall(QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv); 02941 } catch (...) { 02942 if (c->receiver) { 02943 c->receiver->d_func()->currentSender = previousSender; 02944 c->receiver->d_func()->currentSenderSignalIdStart = previousFrom; 02945 c->receiver->d_func()->currentSenderSignalIdEnd = previousTo; 02946 } 02947 throw; 02948 } 02949 #endif 02950 c = &list->connections[at]; 02951 02952 if (qt_signal_spy_callback_set.slot_end_callback != 0) 02953 qt_signal_spy_callback_set.slot_end_callback(c->receiver, method); 02954 02955 locker.relock(); 02956 if (c->receiver) { 02957 c->receiver->d_func()->currentSender = previousSender; 02958 c->receiver->d_func()->currentSenderSignalIdStart = previousFrom; 02959 c->receiver->d_func()->currentSenderSignalIdEnd = previousTo; 02960 } 02961 } 02962 02963 locker.unlock(); 02964 02965 if (qt_signal_spy_callback_set.signal_end_callback != 0) 02966 qt_signal_spy_callback_set.signal_end_callback(sender, from_signal_index); 02967 }
Here is the call graph for this function:

| void QMetaObject::activate | ( | QObject * | sender, | |
| const QMetaObject * | , | |||
| int | local_signal_index, | |||
| void ** | argv | |||
| ) | [static] |
Definition at line 2979 of file qobject.cpp.
References activate(), and m.
02981 { 02982 int offset = m->methodOffset(); 02983 activate(sender, offset + local_signal_index, offset + local_signal_index, argv); 02984 }
Here is the call graph for this function:

| void QMetaObject::activate | ( | QObject * | sender, | |
| const QMetaObject * | , | |||
| int | from_local_signal_index, | |||
| int | to_local_signal_index, | |||
| void ** | argv | |||
| ) | [static] |
Definition at line 2988 of file qobject.cpp.
References activate(), and m.
02990 { 02991 int offset = m->methodOffset(); 02992 activate(sender, offset + from_local_signal_index, offset + to_local_signal_index, argv); 02993 }
Here is the call graph for this function:

| void QMetaObject::addGuard | ( | QObject ** | ptr | ) | [static] |
Definition at line 377 of file qobject.cpp.
References QMultiHash< Key, T >::insert().
Referenced by QAction::activate(), and QPointer< QDesignerFormEditorInterface >::QPointer().
00378 { 00379 if (!*ptr) 00380 return; 00381 GuardHash *hash = guardHash(); 00382 if (!hash) { 00383 *ptr = 0; 00384 return; 00385 } 00386 QWriteLocker locker(guardHashLock()); 00387 hash->insert(*ptr, ptr); 00388 }
Here is the call graph for this function:

| void QMetaObject::removeGuard | ( | QObject ** | ptr | ) | [static] |
Definition at line 392 of file qobject.cpp.
References QHash< Key, T >::end(), QHash< Key, T >::erase(), QHash< Key, T >::find(), QHash< Key, T >::iterator, and ptr.
Referenced by QAction::activate(), and QPointer< QDesignerFormEditorInterface >::~QPointer().
00393 { 00394 if (!*ptr) 00395 return; 00396 GuardHash *hash = guardHash(); 00397 if (!hash) 00398 return; 00399 QWriteLocker locker(guardHashLock()); 00400 GuardHash::iterator it = hash->find(*ptr); 00401 const GuardHash::iterator end = hash->end(); 00402 for (; it.key() == *ptr && it != end; ++it) { 00403 if (it.value() == ptr) { 00404 (void) hash->erase(it); 00405 break; 00406 } 00407 } 00408 }
Here is the call graph for this function:

Definition at line 412 of file qobject.cpp.
References QHash< Key, T >::end(), QHash< Key, T >::erase(), QHash< Key, T >::find(), QMultiHash< Key, T >::insert(), QHash< Key, T >::iterator, o, and ptr.
Referenced by QPointer< QDesignerFormEditorInterface >::operator=().
00413 { 00414 GuardHash *hash = guardHash(); 00415 if (!hash) { 00416 *ptr = 0; 00417 return; 00418 } 00419 QWriteLocker locker(guardHashLock()); 00420 if (*ptr) { 00421 GuardHash::iterator it = hash->find(*ptr); 00422 const GuardHash::iterator end = hash->end(); 00423 for (; it.key() == *ptr && it != end; ++it) { 00424 if (it.value() == ptr) { 00425 (void) hash->erase(it); 00426 break; 00427 } 00428 } 00429 } 00430 *ptr = o; 00431 if (*ptr) 00432 hash->insert(*ptr, ptr); 00433 }
Here is the call graph for this function:

| bool QMetaObject::invokeMethod | ( | QObject * | obj, | |
| const char * | member, | |||
| Qt::ConnectionType | type, | |||
| 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] |
Invokes the member (a signal or a slot name) on the object obj. Returns true if the member could be invoked. Returns false if there is no such member or the parameters did not match.
The invocation can be either synchronous or asynchronous, depending on type:
If type is Qt::DirectConnection, the member will be invoked immediately.
If type is Qt::QueuedConnection, a QEvent will be sent and the member is invoked as soon as the application enters the main event loop.
If type is Qt::AutoConnection, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously.
The return value of the member function call is placed in ret. If the invocation is asynchronous, the return value cannot be evaluated. You can pass up to ten arguments (val0, val1, val2, val3, val4, val5, val6, val7, val8, and val9) to the member function.
QGenericArgument and QGenericReturnArgument are internal helper classes. Because signals and slots can be dynamically invoked, you must enclose the arguments using the Q_ARG() and Q_RETURN_ARG() macros. Q_ARG() takes a type name and a const reference of that type; Q_RETURN_ARG() takes a type name and a non-const reference.
To asynchronously invoke the {QPushButton::animateClick()}{animateClick()} slot on a QPushButton:
QMetaObject::invokeMethod(pushButton, "animateClick", Qt::QueuedConnection);
With asynchronous method invocations, the parameters must be of types that are known to Qt's meta-object system, because Qt needs to copy the arguments to store them in an event behind the scenes. If you try to use a queued connection and get the error message
QMetaObject::invokeMethod: Unable to handle unregistered datatype 'MyType'
call qRegisterMetaType() to register the data type before you call invokeMethod().
To synchronously invoke the compute(QString, int, double) slot on some arbitrary object obj retrieve its return value:
QString retVal; QMetaObject::invokeMethod(obj, "compute", Qt::DirectConnection, Q_RETURN_ARG(QString, retVal), Q_ARG(QString, "sqrt"), Q_ARG(int, 42), Q_ARG(double, 9.7));
If the "compute" slot does not take exactly one QString, one int and one double in the specified order, the call will fail.
Definition at line 893 of file qmetaobject.cpp.
References QVarLengthArray< T, Prealloc >::append(), QByteArray::append(), Qt::AutoConnection, QByteArray::constData(), QVarLengthArray< T, Prealloc >::constData(), QMetaType::construct(), QThread::currentThread(), QGenericArgument::data(), Qt::DirectConnection, i, InvokeMetaMethod, len, QByteArray::length(), QGenericArgument::name(), normalizedSignature(), QCoreApplication::postEvent(), qMalloc(), qstrcmp(), qstrlen(), Qt::QueuedConnection, qWarning(), QByteArray::reserve(), QVarLengthArray< T, Prealloc >::size(), QObject::thread(), QByteArray::truncate(), QMetaType::type(), and types.
Referenced by QHttpPrivate::_q_slotClosed(), QHttpPrivate::_q_slotError(), QHttpPrivate::_q_slotReadyRead(), CarAdaptor::accelerate(), QLayout::addChildWidget(), QHttpPrivate::addRequest(), TorrentClientPrivate::callScheduler(), QWidgetPrivate::close_helper(), QHttpPrivate::closeConn(), QDesignerToolWindow::closeEvent(), QAbstractSocket::connectToHost(), CarAdaptor::decelerate(), QAbstractSocket::disconnectFromHost(), QSocks5SocketEnginePrivate::emitReadNotification(), QSocks5SocketEnginePrivate::emitWriteNotification(), QWorkspace::event(), QWinEventNotifier::event(), QObject::event(), QSocketNotifier::event(), QItemDelegate::eventFilter(), qdesigner_internal::FormWindow::handleContextMenu(), QHttpPrivate::init(), QDesigner::initialize(), qdesigner_internal::FindIconDialog::itemActivated(), jump(), main(), QDesignerActions::minimizeForm(), QDesktopServices::openUrl(), Pong::ping(), QDesignerActions::previewFormLater(), QDBusAbstractAdaptor::QDBusAbstractAdaptor(), QDBusViewer::QDBusViewer(), QTest::qExec(), QTest::qInvokeTestMethod(), FileManager::read(), qdesigner_internal::EditableResourceModel::reload(), qdesigner_internal::WidgetBoxTreeView::removeCurrentItem(), qdesigner_internal::EditableResourceModel::save(), QDBusConnectionPrivate::sendWithReply(), QDBusConnectionPrivate::setConnection(), QAbstractScrollArea::setViewport(), qdesigner_internal::ObjectInspector::slotSelectionChanged(), QStyle::standardIcon(), QInotifyFileSystemWatcherEngine::stop(), QPollingFileSystemWatcherEngine::stop(), QDesignerWorkbench::switchToDockedMode(), CarAdaptor::turnLeft(), CarAdaptor::turnRight(), QTreeView::updateGeometries(), QTableView::updateGeometries(), FileManager::verifyPiece(), FileManager::write(), and QBuffer::writeData().
00905 { 00906 if (!obj) 00907 return false; 00908 00909 QVarLengthArray<char, 512> sig; 00910 int len = qstrlen(member); 00911 if (len <= 0) 00912 return false; 00913 sig.append(member, len); 00914 sig.append('('); 00915 00916 enum { ParamCount = 11 }; 00917 const char *typeNames[] = {ret.name(), val0.name(), val1.name(), val2.name(), val3.name(), 00918 val4.name(), val5.name(), val6.name(), val7.name(), val8.name(), 00919 val9.name()}; 00920 00921 int i; 00922 for (i = 1; i < ParamCount; ++i) { 00923 len = qstrlen(typeNames[i]); 00924 if (len <= 0) 00925 break; 00926 sig.append(typeNames[i], len); 00927 sig.append(','); 00928 } 00929 if (i == 1) 00930 sig.append(')'); // no parameters 00931 else 00932 sig[sig.size() - 1] = ')'; 00933 sig.append('\0'); 00934 00935 int idx = obj->metaObject()->indexOfMethod(sig.constData()); 00936 if (idx < 0) { 00937 QByteArray norm = QMetaObject::normalizedSignature(sig.constData()); 00938 idx = obj->metaObject()->indexOfMethod(norm.constData()); 00939 } 00940 if (idx < 0) 00941 return false; 00942 00943 // check return type 00944 if (ret.data()) { 00945 const char *retType = obj->metaObject()->method(idx).typeName(); 00946 if (qstrcmp(ret.name(), retType) != 0) { 00947 // normalize the return value as well 00948 // the trick here is to make a function signature out of the return type 00949 // so that we can call normalizedSignature() and avoid duplicating code 00950 QByteArray unnormalized; 00951 int len = qstrlen(ret.name()); 00952 00953 unnormalized.reserve(len + 3); 00954 unnormalized = "_("; // the function is called "_" 00955 unnormalized.append(ret.name()); 00956 unnormalized.append(')'); 00957 00958 QByteArray normalized = QMetaObject::normalizedSignature(unnormalized.constData()); 00959 normalized.truncate(normalized.length() - 1); // drop the ending ')' 00960 00961 if (qstrcmp(normalized.constData() + 2, retType) != 0) 00962 return false; 00963 } 00964 } 00965 void *param[] = {ret.data(), val0.data(), val1.data(), val2.data(), val3.data(), val4.data(), 00966 val5.data(), val6.data(), val7.data(), val8.data(), val9.data()}; 00967 if (type == Qt::AutoConnection) { 00968 type = QThread::currentThread() == obj->thread() 00969 ? Qt::DirectConnection 00970 : Qt::QueuedConnection; 00971 } 00972 00973 if (type != Qt::QueuedConnection) { 00974 return obj->qt_metacall(QMetaObject::InvokeMetaMethod, idx, param) < 0; 00975 } else { 00976 if (ret.data()) { 00977 qWarning("QMetaObject::invokeMethod: Unable to invoke methods with return values in queued " 00978 "connections"); 00979 return false; 00980 } 00981 int nargs = 1; // include return type 00982 void **args = (void **) qMalloc(ParamCount * sizeof(void *)); 00983 int *types = (int *) qMalloc(ParamCount * sizeof(int)); 00984 types[0] = 0; // return type 00985 args[0] = 0; 00986 for (i = 1; i < ParamCount; ++i) { 00987 types[i] = QMetaType::type(typeNames[i]); 00988 if (types[i]) { 00989 args[i] = QMetaType::construct(types[i], param[i]); 00990 ++nargs; 00991 } else if (param[i]) { 00992 qWarning("QMetaObject::invokeMethod: Unable to handle unregistered datatype '%s'", 00993 typeNames[i]); 00994 return false; 00995 } 00996 } 00997 00998 QCoreApplication::postEvent(obj, new QMetaCallEvent(idx, 0, -1, -1, nargs, types, args)); 00999 } 01000 return true; 01001 }
Here is the call graph for this function:

| bool QMetaObject::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() | |||
| ) | [inline, static] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This overload always invokes the member using the connection type Qt::AutoConnection.
Definition at line 287 of file qobjectdefs.h.
References Qt::AutoConnection.
00299 { 00300 return invokeMethod(obj, member, Qt::AutoConnection, ret, val0, val1, val2, val3, 00301 val4, val5, val6, val7, val8, val9); 00302 }
| bool QMetaObject::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() | |||
| ) | [inline, static] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This overload can be used if the return value of the member is of no interest.
Definition at line 304 of file qobjectdefs.h.
00316 { 00317 return invokeMethod(obj, member, type, QGenericReturnArgument(), val0, val1, val2, 00318 val3, val4, val5, val6, val7, val8, val9); 00319 }
| bool QMetaObject::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() | |||
| ) | [inline, static] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This overload invokes the member using the connection type Qt::AutoConnection and ignores return values.
Definition at line 322 of file qobjectdefs.h.
References Qt::AutoConnection.
00333 { 00334 return invokeMethod(obj, member, Qt::AutoConnection, QGenericReturnArgument(), val0, 00335 val1, val2, val3, val4, val5, val6, val7, val8, val9); 00336 }
Definition at line 355 of file qobjectdefs.h.
Referenced by MocParser::parse(), QMetaObject_findMetaObject(), and QDBusMetaObjectGenerator::write().
| const char* QMetaObject::stringdata |
Definition at line 356 of file qobjectdefs.h.
Referenced by QMetaEnum::key(), QMetaEnum::keysToValue(), QMetaEnum::keyToValue(), QMetaEnum::name(), QMetaProperty::name(), QMetaClassInfo::name(), QMetaMethod::parameterNames(), QMetaMethod::parameterTypes(), MocParser::parse(), QMetaObject_findMetaObject(), QMetaProperty::read(), QMetaEnum::scope(), QMetaMethod::signature(), QMetaMethod::tag(), QMetaMethod::typeName(), QMetaProperty::typeName(), QMetaClassInfo::value(), QMetaEnum::valueToKey(), QMetaEnum::valueToKeys(), QMetaProperty::write(), QDBusMetaObjectGenerator::write(), and MocParser::~MocParser().
| const uint* QMetaObject::data |
Definition at line 357 of file qobjectdefs.h.
Referenced by QMetaMethod::access(), QMetaMethod::attributes(), QMetaProperty::hasStdCppSet(), QMetaProperty::isDesignable(), QMetaProperty::isEditable(), QMetaProperty::isEnumType(), QMetaEnum::isFlag(), QMetaProperty::isReadable(), QMetaProperty::isResettable(), QMetaProperty::isScriptable(), QMetaProperty::isStored(), QMetaProperty::isUser(), QMetaProperty::isWritable(), QMetaEnum::key(), QMetaEnum::keyCount(), QMetaEnum::keysToValue(), QMetaEnum::keyToValue(), QMetaMethod::methodType(), QMetaEnum::name(), QMetaProperty::name(), QMetaClassInfo::name(), QMetaMethod::parameterNames(), QMetaMethod::parameterTypes(), MocParser::parse(), QMetaProperty::read(), QMetaMethod::signature(), QMetaMethod::tag(), QMetaProperty::type(), QMetaMethod::typeName(), QMetaProperty::typeName(), QMetaEnum::value(), QMetaClassInfo::value(), QMetaEnum::valueToKey(), QMetaEnum::valueToKeys(), QDBusMetaObjectGenerator::write(), QMetaProperty::write(), and MocParser::~MocParser().
| const QMetaObject** QMetaObject::extradata |
Definition at line 358 of file qobjectdefs.h.
Referenced by MocParser::parse(), QMetaObject_findMetaObject(), and QDBusMetaObjectGenerator::write().
| struct { ... } QMetaObject::d |
Referenced by QMetaMethod::access(), QMetaMethod::attributes(), classInfo(), classInfoCount(), classInfoOffset(), className(), QDBusMetaObject::dbusNameForMethod(), enumerator(), enumeratorCount(), enumeratorOffset(), QMetaProperty::hasStdCppSet(), indexOfClassInfo(), QDBusMetaObject::inputSignatureForMethod(), QDBusMetaObject::inputTypesForMethod(), QMetaProperty::isDesignable(), QMetaProperty::isEditable(), QMetaProperty::isEnumType(), QMetaEnum::isFlag(), QMetaProperty::isReadable(), QMetaProperty::isResettable(), QMetaProperty::isScriptable(), QMetaProperty::isStored(), QMetaProperty::isUser(), QMetaProperty::isWritable(), QMetaEnum::key(), QMetaEnum::keyCount(), QMetaEnum::keysToValue(), QMetaEnum::keyToValue(), method(), methodCount(), methodOffset(), QMetaMethod::methodType(), QMetaEnum::name(), QMetaProperty::name(), QMetaClassInfo::name(), normalizedSignature(), QDBusMetaObject::outputSignatureForMethod(), QDBusMetaObject::outputTypesForMethod(), QMetaMethod::parameterNames(), QMetaMethod::parameterTypes(), MocParser::parse(), property(), propertyCount(), QDBusMetaObject::propertyMetaType(), propertyOffset(), QMetaObject_findMetaObject(), QMetaProperty::read(), QMetaEnum::scope(), QMetaMethod::signature(), superClass(), QMetaMethod::tag(), tr(), trUtf8(), QMetaProperty::type(), QMetaMethod::typeName(), QMetaProperty::typeName(), QMetaEnum::value(), QMetaClassInfo::value(), QMetaEnum::valueToKey(), QMetaEnum::valueToKeys(), QDBusMetaObjectGenerator::write(), QMetaProperty::write(), and MocParser::~MocParser().
1.5.1