本文整理汇总了C++中QMetaObjectBuilder::indexOfSignal方法的典型用法代码示例。如果您正苦于以下问题:C++ QMetaObjectBuilder::indexOfSignal方法的具体用法?C++ QMetaObjectBuilder::indexOfSignal怎么用?C++ QMetaObjectBuilder::indexOfSignal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMetaObjectBuilder
的用法示例。
在下文中一共展示了QMetaObjectBuilder::indexOfSignal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deserializeInitDynamicPacket
void deserializeInitDynamicPacket(QDataStream &in, QMetaObjectBuilder &builder, QVariantList &values)
{
quint32 numSignals = 0;
quint32 numMethods = 0;
quint32 numProperties = 0;
in >> numSignals;
in >> numMethods;
int curIndex = 0;
for (quint32 i = 0; i < numSignals; ++i) {
QByteArray signature;
in >> signature;
++curIndex;
builder.addSignal(signature);
}
for (quint32 i = 0; i < numMethods; ++i) {
QByteArray signature, returnType;
in >> signature;
in >> returnType;
++curIndex;
const bool isVoid = returnType.isEmpty() || returnType == QByteArrayLiteral("void");
if (isVoid)
builder.addMethod(signature);
else
builder.addMethod(signature, QByteArrayLiteral("QRemoteObjectPendingCall"));
}
in >> numProperties;
const quint32 initialListSize = values.size();
if (static_cast<quint32>(values.size()) < numProperties)
values.reserve(numProperties);
else if (static_cast<quint32>(values.size()) > numProperties)
for (quint32 i = numProperties; i < initialListSize; ++i)
values.removeLast();
for (quint32 i = 0; i < numProperties; ++i) {
QByteArray name;
QByteArray typeName;
QByteArray signalName;
in >> name;
in >> typeName;
in >> signalName;
if (signalName.isEmpty())
builder.addProperty(name, typeName);
else
builder.addProperty(name, typeName, builder.indexOfSignal(signalName));
QVariant value;
in >> value;
if (i < initialListSize)
values[i] = value;
else
values.append(value);
}
}
示例2: create_dynamic_metaobject
//.........这里部分代码省略.........
data[s_offset + (s * 5) + 2] = empty;
}
// Add the tag and flags.
data[s_offset + (s * 5) + 3] = empty;
data[s_offset + (s * 5) + 4] = 0x0a;
#endif
}
// Add the properties to the meta-object.
#if QT_VERSION < 0x050000
QList<uint> notify_signals;
#endif
QMapIterator<uint, prop_data> it(pprops);
for (int p = 0; it.hasNext(); ++p)
{
it.next();
const prop_data &pprop = it.value();
const char *prop_name = SIPBytes_AS_STRING(pprop.first);
qpycore_pyqtProperty *pp = (qpycore_pyqtProperty *)pprop.second;
int notifier_id;
#if QT_VERSION < 0x050000
uint flags = 0;
#endif
if (pp->pyqtprop_notify)
{
qpycore_pyqtSignal *ps = (qpycore_pyqtSignal *)pp->pyqtprop_notify;
const QByteArray &sig = ps->signature->signature;
#if QT_VERSION >= 0x050000
notifier_id = builder.indexOfSignal(sig.mid(1));
#else
notifier_id = psigs.indexOf(sig);
#endif
if (notifier_id < 0)
{
PyErr_Format(PyExc_TypeError,
"the notify signal '%s' was not defined in this class",
sig.constData() + 1);
// Note that we leak the property name.
return -1;
}
#if QT_VERSION < 0x050000
notify_signals.append(notifier_id);
flags |= 0x00400000;
#endif
}
else
{
#if QT_VERSION >= 0x050000
notifier_id = -1;
#else
notify_signals.append(0);
#endif
}
#if QT_VERSION >= 0x050000
// A Qt v5 revision 7 meta-object holds the QMetaType::Type of the type
// or its name if it is unresolved (ie. not known to the type system).
// In Qt v4 both are held. For QObject sub-classes Chimera will fall
示例3: create_dynamic_metaobject
//.........这里部分代码省略.........
// Add the slots to the meta-object.
for (int s = 0; s < qo->pslots.count(); ++s)
{
const Chimera::Signature *slot_signature = qo->pslots.at(s)->slotSignature();
const QByteArray &sig = slot_signature->signature;
QMetaMethodBuilder slot_builder = builder.addSlot(sig);
// Add any type.
if (slot_signature->result)
slot_builder.setReturnType(slot_signature->result->name());
slot_builder.setRevision(slot_signature->revision);
}
// Add the properties to the meta-object.
QMapIterator<uint, PropertyData> it(pprops);
for (int p = 0; it.hasNext(); ++p)
{
it.next();
const PropertyData &pprop = it.value();
const char *prop_name = SIPBytes_AS_STRING(pprop.first);
qpycore_pyqtProperty *pp = (qpycore_pyqtProperty *)pprop.second;
int notifier_id;
if (pp->pyqtprop_notify)
{
qpycore_pyqtSignal *ps = (qpycore_pyqtSignal *)pp->pyqtprop_notify;
const QByteArray &sig = ps->parsed_signature->signature;
notifier_id = builder.indexOfSignal(sig.mid(1));
if (notifier_id < 0)
{
PyErr_Format(PyExc_TypeError,
"the notify signal '%s' was not defined in this class",
sig.constData() + 1);
// Note that we leak the property name.
return -1;
}
}
else
{
notifier_id = -1;
}
// A Qt v5 revision 7 meta-object holds the QMetaType::Type of the type
// or its name if it is unresolved (ie. not known to the type system).
// In Qt v4 both are held. For QObject sub-classes Chimera will fall
// back to the QMetaType::QObjectStar if there is no specific meta-type
// for the sub-class. This means that, for Qt v4,
// QMetaProperty::read() can handle the type. However, Qt v5 doesn't
// know that the unresolved type is a QObject sub-class. Therefore we
// have to tell it that the property is a QObject, rather than the
// sub-class. This means that QMetaProperty.typeName() will always
// return "QObject*".
QByteArray prop_type;
if (pp->pyqtprop_parsed_type->metatype() == QMetaType::QObjectStar)
{
// However, if the type is a Python sub-class of QObject then we
// use the name of the Python type. This anticipates that the type