本文整理汇总了C++中QMetaObjectBuilder::setFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ QMetaObjectBuilder::setFlags方法的具体用法?C++ QMetaObjectBuilder::setFlags怎么用?C++ QMetaObjectBuilder::setFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMetaObjectBuilder
的用法示例。
在下文中一共展示了QMetaObjectBuilder::setFlags方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
QMetaObject *GoValue::metaObjectFor(GoTypeInfo *typeInfo)
{
if (typeInfo->metaObject) {
return reinterpret_cast<QMetaObject *>(typeInfo->metaObject);
}
QMetaObjectBuilder mob;
mob.setSuperClass(&QObject::staticMetaObject);
mob.setClassName(typeInfo->typeName);
mob.setFlags(QMetaObjectBuilder::DynamicMetaObject);
GoMemberInfo *memberInfo;
memberInfo = typeInfo->fields;
int relativePropIndex = mob.propertyCount();
for (int i = 0; i < typeInfo->fieldsLen; i++) {
mob.addSignal("__" + QByteArray::number(relativePropIndex) + "()");
QMetaPropertyBuilder propb = mob.addProperty(memberInfo->memberName, "QVariant", relativePropIndex);
propb.setWritable(true);
memberInfo->metaIndex = relativePropIndex;
memberInfo++;
relativePropIndex++;
}
memberInfo = typeInfo->methods;
int relativeMethodIndex = mob.methodCount();
for (int i = 0; i < typeInfo->methodsLen; i++) {
if (*memberInfo->resultSignature) {
mob.addMethod(memberInfo->methodSignature, memberInfo->resultSignature);
} else {
mob.addMethod(memberInfo->methodSignature);
}
memberInfo->metaIndex = relativeMethodIndex;
memberInfo++;
relativeMethodIndex++;
}
QMetaObject *mo = mob.toMetaObject();
// Turn the relative indexes into absolute indexes.
memberInfo = typeInfo->fields;
int propOffset = mo->propertyOffset();
for (int i = 0; i < typeInfo->fieldsLen; i++) {
memberInfo->metaIndex += propOffset;
memberInfo++;
}
memberInfo = typeInfo->methods;
int methodOffset = mo->methodOffset();
for (int i = 0; i < typeInfo->methodsLen; i++) {
memberInfo->metaIndex += methodOffset;
memberInfo++;
}
typeInfo->metaObject = mo;
return mo;
}
示例2:
void QDeclarative1OpenMetaObjectTypePrivate::init(const QMetaObject *metaObj)
{
if (!mem) {
mob.setSuperClass(metaObj);
mob.setClassName(metaObj->className());
mob.setFlags(QMetaObjectBuilder::DynamicMetaObject);
mem = mob.toMetaObject();
propertyOffset = mem->propertyOffset();
signalOffset = mem->methodOffset();
}
}
示例3:
QMetaObject *metaObjectFor(GoTypeInfo *typeInfo)
{
if (typeInfo->metaObject) {
return reinterpret_cast<QMetaObject *>(typeInfo->metaObject);
}
QMetaObjectBuilder mob;
if (typeInfo->paint) {
mob.setSuperClass(&QQuickPaintedItem::staticMetaObject);
} else {
mob.setSuperClass(&QObject::staticMetaObject);
}
mob.setClassName(typeInfo->typeName);
mob.setFlags(QMetaObjectBuilder::DynamicMetaObject);
GoMemberInfo *memberInfo;
memberInfo = typeInfo->fields;
int relativePropIndex = mob.propertyCount();
for (int i = 0; i < typeInfo->fieldsLen; i++) {
mob.addSignal("__" + QByteArray::number(relativePropIndex) + "()");
const char *typeName = "QVariant";
if (memberInfo->memberType == DTListProperty) {
typeName = "QQmlListProperty<QObject>";
}
QMetaPropertyBuilder propb = mob.addProperty(memberInfo->memberName, typeName, relativePropIndex);
propb.setWritable(true);
memberInfo->metaIndex = relativePropIndex;
memberInfo++;
relativePropIndex++;
}
memberInfo = typeInfo->methods;
int relativeMethodIndex = mob.methodCount();
for (int i = 0; i < typeInfo->methodsLen; i++) {
if (*memberInfo->resultSignature) {
mob.addMethod(memberInfo->methodSignature, memberInfo->resultSignature);
} else {
mob.addMethod(memberInfo->methodSignature);
}
memberInfo->metaIndex = relativeMethodIndex;
memberInfo++;
relativeMethodIndex++;
}
// TODO Support default properties.
//mob.addClassInfo("DefaultProperty", "objects");
QMetaObject *mo = mob.toMetaObject();
// Turn the relative indexes into absolute indexes.
memberInfo = typeInfo->fields;
int propOffset = mo->propertyOffset();
for (int i = 0; i < typeInfo->fieldsLen; i++) {
memberInfo->metaIndex += propOffset;
memberInfo++;
}
memberInfo = typeInfo->methods;
int methodOffset = mo->methodOffset();
for (int i = 0; i < typeInfo->methodsLen; i++) {
memberInfo->metaIndex += methodOffset;
memberInfo++;
}
typeInfo->metaObject = mo;
return mo;
}
示例4: init
void QQmlTypePrivate::init() const
{
if (m_isSetup) return;
QWriteLocker lock(metaTypeDataLock());
if (m_isSetup)
return;
const QMetaObject *mo = m_baseMetaObject;
if (!mo) {
// singleton type without metaobject information
return;
}
// Setup extended meta object
// XXX - very inefficient
if (m_extFunc) {
QMetaObjectBuilder builder;
clone(builder, m_extMetaObject, m_extMetaObject, m_extMetaObject);
builder.setFlags(QMetaObjectBuilder::DynamicMetaObject);
QMetaObject *mmo = builder.toMetaObject();
mmo->d.superdata = mo;
QQmlProxyMetaObject::ProxyData data = { mmo, m_extFunc, 0, 0 };
m_metaObjects << data;
}
mo = mo->d.superdata;
while(mo) {
QQmlType *t = metaTypeData()->metaObjectToType.value(mo);
if (t) {
if (t->d->m_extFunc) {
QMetaObjectBuilder builder;
clone(builder, t->d->m_extMetaObject, t->d->m_baseMetaObject, m_baseMetaObject);
builder.setFlags(QMetaObjectBuilder::DynamicMetaObject);
QMetaObject *mmo = builder.toMetaObject();
mmo->d.superdata = m_baseMetaObject;
if (!m_metaObjects.isEmpty())
m_metaObjects.last().metaObject->d.superdata = mmo;
QQmlProxyMetaObject::ProxyData data = { mmo, t->d->m_extFunc, 0, 0 };
m_metaObjects << data;
}
}
mo = mo->d.superdata;
}
for (int ii = 0; ii < m_metaObjects.count(); ++ii) {
m_metaObjects[ii].propertyOffset =
m_metaObjects.at(ii).metaObject->propertyOffset();
m_metaObjects[ii].methodOffset =
m_metaObjects.at(ii).metaObject->methodOffset();
}
// Check for revisioned details
{
const QMetaObject *mo = 0;
if (m_metaObjects.isEmpty())
mo = m_baseMetaObject;
else
mo = m_metaObjects.first().metaObject;
for (int ii = 0; !m_containsRevisionedAttributes && ii < mo->propertyCount(); ++ii) {
if (isPropertyRevisioned(mo, ii))
m_containsRevisionedAttributes = true;
}
for (int ii = 0; !m_containsRevisionedAttributes && ii < mo->methodCount(); ++ii) {
if (mo->method(ii).revision() != 0)
m_containsRevisionedAttributes = true;
}
}
m_isSetup = true;
lock.unlock();
}