?? qmetaobject.cpp
字號:
QGenericArgument val9 = QGenericArgument()) \overload This overload can be used if the return value of the member is of no interest.*//*! \fn 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()) \overload This overload invokes the member using the connection type Qt::AutoConnection and ignores return values.*//*! \class QMetaMethod \brief The QMetaMethod class provides meta-data about a member function. \ingroup objectmodel A QMetaMethod has a methodType(), a signature(), a list of parameterTypes() and parameterNames(), a return typeName(), a tag(), and an access() specifier. \sa QMetaObject, QMetaEnum, QMetaProperty, {Qt's Property System}*//*! \enum QMetaMethod::Attributes \internal \value Compatibility \value Cloned \value Scriptable*//*! \enum QMetaMethod::MethodType \value Method The function is a plain member function. \value Signal The function is a signal. \value Slot The function is a slot.*//*! \fn QMetaMethod::QMetaMethod() \internal*//*! Returns the signature of this method (e.g., \c{setValue(double)}). \sa parameterTypes(), parameterNames()*/const char *QMetaMethod::signature() const{ if (!mobj) return 0; return mobj->d.stringdata + mobj->d.data[handle];}/*! Returns a list of parameter types. \sa parameterNames(), signature()*/QList<QByteArray> QMetaMethod::parameterTypes() const{ QList<QByteArray> list; if (!mobj) return list; const char *signature = mobj->d.stringdata + mobj->d.data[handle]; while (*signature && *signature != '(') ++signature; while (*signature && *signature != ')' && *++signature != ')') { const char *begin = signature; int level = 0; while (*signature && (level > 0 || *signature != ',') && *signature != ')') { if (*signature == '<') ++level; else if (*signature == '>') --level; ++signature; } list += QByteArray(begin, signature - begin); } return list;}/*! Returns a list of parameter names. \sa parameterTypes(), signature()*/QList<QByteArray> QMetaMethod::parameterNames() const{ QList<QByteArray> list; if (!mobj) return list; const char *names = mobj->d.stringdata + mobj->d.data[handle + 1]; if (*names == 0) { // do we have one or zero arguments? const char *signature = mobj->d.stringdata + mobj->d.data[handle]; while (*signature && *signature != '(') ++signature; if (*++signature != ')') list += QByteArray(); } else { --names; do { const char *begin = ++names; while (*names && *names != ',') ++names; list += QByteArray(begin, names - begin); } while (*names); } return list;}/*! Returns the return type of this method, or an empty string if the return type is \e void.*/const char *QMetaMethod::typeName() const{ if (!mobj) return 0; return mobj->d.stringdata + mobj->d.data[handle + 2];}/*! Returns the tag associated with this method. Tags are special macros recognized by \c moc that make it possible to add extra information about a method. For the moment, \c moc doesn't support any special tags.*/const char *QMetaMethod::tag() const{ if (!mobj) return 0; return mobj->d.stringdata + mobj->d.data[handle + 3];}/*! \internal */int QMetaMethod::attributes() const{ if (!mobj) return false; return ((mobj->d.data[handle + 4])>>4);}/*! Returns the access specification of this method (private, protected, or public). Signals are always protected, meaning that you can only emit them from the class or from a subclass. \sa methodType()*/QMetaMethod::Access QMetaMethod::access() const{ if (!mobj) return Private; return (QMetaMethod::Access)(mobj->d.data[handle + 4] & AccessMask);}/*! Returns the type of this method (signal, slot, or method). \sa access()*/QMetaMethod::MethodType QMetaMethod::methodType() const{ if (!mobj) return QMetaMethod::Method; return (QMetaMethod::MethodType)((mobj->d.data[handle + 4] & MethodTypeMask)>>2);}/*! \class QMetaEnum \brief The QMetaEnum class provides meta-data about an enumerator. \ingroup objectmodel Use name() for the enumerator's name. The enumerator's keys (names of each enumerated item) are returned by key(); use keyCount() to find the number of keys. isFlag() returns whether the enumerator is meant to be used as a flag, meaning that its values can be combined using the OR operator. The conversion functions keyToValue(), valueToKey(), keysToValue(), and valueToKeys() allow conversion between the integer representation of an enumeration or set value and its literal representation. The scope() function returns the class scope this enumerator was declared in. \sa QMetaObject, QMetaMethod, QMetaProperty*//*! \fn bool QMetaEnum::isValid() const Returns true if this enum is valid (has a name); otherwise returns false. \sa name()*//*! \fn QMetaEnum::QMetaEnum() \internal*//*! Returns the name of the enumerator (without the scope). For example, the Qt::AlignmentFlag enumeration has \c AlignmentFlag as the name and \l Qt as the scope. \sa isValid(), scope()*/const char *QMetaEnum::name() const{ if (!mobj) return 0; return mobj->d.stringdata + mobj->d.data[handle];}/*! Returns the number of keys. \sa key()*/int QMetaEnum::keyCount() const{ if (!mobj) return 0; return mobj->d.data[handle + 2];}/*! Returns the key with the given \a index, or 0 if no such key exists. \sa keyCount(), value(), valueToKey()*/const char *QMetaEnum::key(int index) const{ if (!mobj) return 0; int count = mobj->d.data[handle + 2]; int data = mobj->d.data[handle + 3]; if (index >= 0 && index < count) return mobj->d.stringdata + mobj->d.data[data + 2*index]; return 0;}/*! Returns the value with the given \a index; or returns -1 if there is no such value. \sa keyCount(), key(), keyToValue()*/int QMetaEnum::value(int index) const{ if (!mobj) return 0; int count = mobj->d.data[handle + 2]; int data = mobj->d.data[handle + 3]; if (index >= 0 && index < count) return mobj->d.data[data + 2*index + 1]; return -1;}/*! Returns true if this enumerator is used as a flag; otherwise returns false. When used as flags, enumerators can be combined using the OR operator. \sa keysToValue(), valueToKeys()*/bool QMetaEnum::isFlag() const{ return mobj && mobj->d.data[handle + 1];}/*! Returns the scope this enumerator was declared in. For example, the Qt::AlignmentFlag enumeration has \c Qt as the scope and \c AlignmentFlag as the name. \sa name()*/const char *QMetaEnum::scope() const{ return mobj?mobj->d.stringdata : 0;}/*! Returns the integer value of the given enumeration \a key, or -1 if \a key is not defined. For flag types, use keysToValue(). \sa valueToKey(), isFlag(), keysToValue()*/int QMetaEnum::keyToValue(const char *key) const{ if (!mobj || !key) return -1; int scope = 0; const char *qualified_key = key; const char *s = key; while (*s && *s != ':') ++s; if (*s && *(s+1)==':') { scope = s - key; key += scope + 2; } int count = mobj->d.data[handle + 2]; int data = mobj->d.data[handle + 3]; for (int i = 0; i < count; ++i) if ((!scope || strncmp(qualified_key, mobj->d.stringdata, scope) == 0) && strcmp(key, mobj->d.stringdata + mobj->d.data[data + 2*i]) == 0) return mobj->d.data[data + 2*i + 1]; return -1;}/*! Returns the string that is used as the name of the given enumeration \a value, or 0 if \a value is not defined. For flag types, use valueToKeys(). \sa isFlag(), valueToKeys()*/const char* QMetaEnum::valueToKey(int value) const{ if (!mobj) return 0; int count = mobj->d.data[handle + 2]; int data = mobj->d.data[handle + 3]; for (int i = 0; i < count; ++i) if (value == (int)mobj->d.data[data + 2*i + 1]) return mobj->d.stringdata + mobj->d.data[data + 2*i]; return 0;}/*! Returns the value derived from combining together the values of the \a keys using the OR operator, or -1 if \a keys is not defined. Note that the strings in \a keys must be '|'-separated. \sa isFlag(), valueToKey(), valueToKeys()*/int QMetaEnum::keysToValue(const char *keys) const{ if (!mobj) return -1; QStringList l = QString::fromLatin1(keys).split(QLatin1Char('|')); //#### TODO write proper code, do not use QStringList int value = 0; int count = mobj->d.data[handle + 2]; int data = mobj->d.data[handle + 3]; for (int li = 0; li < l.size(); ++li) { QString trimmed = l.at(li).trimmed(); QByteArray qualified_key = trimmed.toLatin1(); const char *key = qualified_key.constData(); int scope = 0; const char *s = key; while (*s && *s != ':') ++s; if (*s && *(s+1)==':') { scope = s - key; key += scope + 2; } int i; for (i = count-1; i >= 0; --i) if ((!scope || strncmp(qualified_key.constData(), mobj->d.stringdata, scope) == 0) && strcmp(key, mobj->d.stringdata + mobj->d.data[data + 2*i]) == 0) { value |= mobj->d.data[data + 2*i + 1]; break; } if (i < 0) value |= -1; } return value;}/*! Returns a byte array of '|'-separated keys that represents the given \a value. \sa isFlag(), valueToKey(), keysToValue()*/QByteArray QMetaEnum::valueToKeys(int value) const{ QByteArray keys; if (!mobj) return keys; int count = mobj->d.data[handle + 2]; int data = mobj->d.data[handle + 3]; int v = value; for(int i = count - 1; i >= 0; --i) { int k = mobj->d.data[data + 2*i + 1]; if ((k != 0 && (v & k) == k ) || (k == value)) { v = v & ~k; if (!keys.isEmpty()) keys += '|'; keys += mobj->d.stringdata + mobj->d.data[data + 2*i]; } } return keys;}/*! \class QMetaProperty \brief The QMetaProperty class provides meta-data about a property. \ingroup objectmodel A property has a name() and a type(), as well as various attributes that specify its behavior: isReadable(), isWritable(), isDesignable(), isScriptable(), and isStored(). If the property is an enumeration, isEnumType() returns true; if the property is an enumeration that is also a flag (i.e. its values can be combined using the OR operator), isEnumType() and isFlagType() both return true. The enumerator for these types is available from enumerator(). The property's values are set and retrieved with read(), write(), and reset(); they can also be changed through QObject's set and get functions. See QObject::setProperty() and QObject::property() for details. You get property meta-data through an object's meta-object. See QMetaObject::property() and QMetaObject::propertyCount() for details. \sa QMetaObject, QMetaEnum, QMetaMethod, {Qt's Property System}*//*! \fn bool QMetaProperty::isValid() const Returns true if this property is valid (readable); otherwise returns false. \sa isReadable()*//*! \internal*/QMetaProperty::QMetaProperty() : mobj(0), handle(0), idx(0){}/*! Returns this property's name. \sa type(), typeName()*/const char *QMetaProperty::name() const{ if (!mobj) return 0; int handle = priv(mobj->d.data)->propertyData + 3*idx; return mobj->d.stringdata + mobj->d.data[handle];}/*! Returns the name of this property's type. \sa type(), name()*/const char *QMetaProperty::typeName() const{ if (!mobj) return 0; int handle = priv(mobj->d.data)->propertyData + 3*idx; return mobj->d.stringdata + mobj->d.data[handle + 1];}/*! Returns this property's type. The return value is one
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -