本文整理汇总了C++中QMetaMethod::methodIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ QMetaMethod::methodIndex方法的具体用法?C++ QMetaMethod::methodIndex怎么用?C++ QMetaMethod::methodIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMetaMethod
的用法示例。
在下文中一共展示了QMetaMethod::methodIndex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void QDeclarativePropertyCache::Data::lazyLoad(const QMetaMethod &m)
{
coreIndex = m.methodIndex();
relatedIndex = -1;
flags |= Data::IsFunction;
if (m.methodType() == QMetaMethod::Signal)
flags |= Data::IsSignal;
propType = QVariant::Invalid;
const char *returnType = m.typeName();
if (returnType && *returnType) {
propTypeName = returnType;
flags |= Data::NotFullyResolved;
}
const char *signature = m.signature();
while (*signature != '(') { Q_ASSERT(*signature != 0); ++signature; }
++signature;
if (*signature != ')') {
flags |= Data::HasArguments;
if (0 == ::strcmp(signature, "QDeclarativeV8Function*)")) {
flags |= Data::IsV8Function;
}
}
revision = m.revision();
}
示例2:
void Nuria::ObjectWrapperResourcePrivate::connectToSignal (QMetaMethod method) {
// Connect objects' signal to our homegrown qt_metacall().
int index = method.methodIndex ();
if (!QMetaObject::connect (this->object, index, this, index, Qt::DirectConnection)) {
nError() << "connect() failed on" << this->object << "for signal" << method.methodSignature ();
}
}
示例3: registerObject
void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const PropertyName &prefix)
{
if (m_registeredObjectList.contains(spiedObject)) // prevent cycles
return;
m_registeredObjectList.append(spiedObject);
for (int index = QObject::staticMetaObject.propertyOffset();
index < spiedObject->metaObject()->propertyCount();
index++) {
QMetaProperty metaProperty = spiedObject->metaObject()->property(index);
// handle dot properties and connect the signals to the object
if (metaProperty.isReadable()
&& !metaProperty.isWritable()
&& QDeclarativeMetaType::isQObject(metaProperty.userType())) {
QObject *propertyObject = QDeclarativeMetaType::toQObject(metaProperty.read(spiedObject));
if (propertyObject)
registerObject(propertyObject, prefix + metaProperty.name() + '.');
} else if (metaProperty.hasNotifySignal()) {
QMetaMethod metaMethod = metaProperty.notifySignal();
bool isConnecting = QMetaObject::connect(spiedObject, metaMethod.methodIndex(), this, methodeOffset, Qt::DirectConnection);
Q_ASSERT(isConnecting);
Q_UNUSED(isConnecting);
m_indexPropertyHash.insert(methodeOffset, prefix + metaProperty.name());
methodeOffset++;
}
// search recursive in objects
if (metaProperty.isReadable()
&& metaProperty.isWritable()
&& QDeclarativeMetaType::isQObject(metaProperty.userType())) {
QObject *propertyObject = QDeclarativeMetaType::toQObject(metaProperty.read(spiedObject));
if (propertyObject)
registerObject(propertyObject, prefix + metaProperty.name() + '/');
}
// search recursive in objects list
if (metaProperty.isReadable()
&& QDeclarativeMetaType::isList(metaProperty.userType())) {
QDeclarativeListReference list(spiedObject, metaProperty.name());
if (list.canCount() && list.canAt()) {
for (int i = 0; i < list.count(); i++) {
QObject *propertyObject = list.at(i);
if (propertyObject)
registerObject(propertyObject, prefix + metaProperty.name() + '/');
}
}
}
}
}
示例4:
void QDeclarativePropertyCache::Data::load(const QMetaMethod &m)
{
coreIndex = m.methodIndex();
relatedIndex = -1;
flags |= Data::IsFunction;
if (m.methodType() == QMetaMethod::Signal)
flags |= Data::IsSignal;
propType = m.returnType();
QList<QByteArray> params = m.parameterTypes();
if (!params.isEmpty())
flags |= Data::HasArguments;
revision = m.revision();
}
示例5: createMetaMethod
void Nuria::ObjectWrapperResourcePrivate::initMethods () {
// Iterate over the objects signals and slots
for (int i = this->meta->methodOffset (); i < this->meta->methodCount (); i++) {
QMetaMethod m = this->meta->method (i);
QMetaMethod::MethodType type = m.methodType ();
// Store public slots and signals
if (type == QMetaMethod::Signal || (type == QMetaMethod::Slot && m.access () == QMetaMethod::Public)) {
Method descriptor = createMetaMethod (m);
addMethodToPropertyList (m, descriptor);
this->methods.insert (m.methodIndex (), descriptor);
}
// Connect to signals
if (type == QMetaMethod::Signal) {
connectToSignal (m);
}
}
}
示例6: QDeclarativeComponent
//.........这里部分代码省略.........
QDeclarativeMetaType::customStringConverter(data.type);
QVariant v = (*converter)(primitive);
QMetaProperty prop =
target->metaObject()->property(instr.assignCustomType.propertyIndex);
if (v.isNull() || ((int)prop.type() != data.type && prop.userType() != data.type))
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign value %1 to property %2").arg(primitive).arg(QString::fromUtf8(prop.name())));
void *a[] = { (void *)v.data(), 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.assignCustomType.propertyIndex, a);
}
break;
case QDeclarativeInstruction::AssignSignalObject:
{
// XXX optimize
QObject *assign = stack.pop();
QObject *target = stack.top();
int sigIdx = instr.assignSignalObject.signal;
const QByteArray &pr = datas.at(sigIdx);
QDeclarativeProperty prop(target, QString::fromUtf8(pr));
if (prop.type() & QDeclarativeProperty::SignalProperty) {
QMetaMethod method = QDeclarativeMetaType::defaultMethod(assign);
if (method.signature() == 0)
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object type %1 with no default method").arg(QString::fromLatin1(assign->metaObject()->className())));
if (!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature()))
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot connect mismatched signal/slot %1 %vs. %2").arg(QString::fromLatin1(method.signature())).arg(QString::fromLatin1(prop.method().signature())));
QDeclarativePropertyPrivate::connect(target, prop.index(), assign, method.methodIndex());
} else {
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign an object to signal property %1").arg(QString::fromUtf8(pr)));
}
}
break;
case QDeclarativeInstruction::StoreSignal:
{
QObject *target = stack.top();
QObject *context = stack.at(stack.count() - 1 - instr.storeSignal.context);
QMetaMethod signal = target->metaObject()->method(instr.storeSignal.signalIndex);
QDeclarativeBoundSignal *bs = new QDeclarativeBoundSignal(target, signal, target);
QDeclarativeExpression *expr =
new QDeclarativeExpression(ctxt, context, primitives.at(instr.storeSignal.value));
expr->setSourceLocation(comp->name, instr.line);
static_cast<QDeclarativeExpressionPrivate *>(QObjectPrivate::get(expr))->name = datas.at(instr.storeSignal.name);
bs->setExpression(expr);
}
break;
case QDeclarativeInstruction::StoreImportedScript:
{
ctxt->addImportedScript(scripts.at(instr.storeScript.value));
}
break;
case QDeclarativeInstruction::StoreScriptString: