当前位置: 首页>>代码示例>>C++>>正文


C++ QMetaObjectBuilder::serialize方法代码示例

本文整理汇总了C++中QMetaObjectBuilder::serialize方法的典型用法代码示例。如果您正苦于以下问题:C++ QMetaObjectBuilder::serialize方法的具体用法?C++ QMetaObjectBuilder::serialize怎么用?C++ QMetaObjectBuilder::serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QMetaObjectBuilder的用法示例。


在下文中一共展示了QMetaObjectBuilder::serialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ostream

Test::Test(QObject *parent) :
    QObject(parent), d(new TestPrivate)
{
    QMetaObjectBuilder builder;
    builder.setClassName("Test");
    d->catchedSignalId = builder.addSignal("catched(QString,QVariantList)").index();
    d->meta = builder.toMetaObject();

    QDataStream ostream(&d->metadata, QIODevice::WriteOnly);
    builder.serialize(ostream);
}
开发者ID:romixlab,项目名称:trunk,代码行数:11,代码来源:test.cpp

示例2: addSlot

bool Test::addSlot(const QString &slot)
{
    if (d->slotId2Name.key(slot, -1) != -1)
        return false;

    QDataStream istream(d->metadata);
    QMetaObjectBuilder builder;
    QMap<QByteArray, const QMetaObject*> refs;
    builder.deserialize(istream, refs);

    int metaIndex = builder.addSlot(slot.toLocal8Bit()).index();
    d->slotId2Name.insert(metaIndex + d->meta->methodOffset(), slot);

    if (d->meta)
        free(d->meta);
    d->meta = builder.toMetaObject();
    QDataStream ostream(&d->metadata, QIODevice::WriteOnly);
    builder.serialize(ostream);

    return true;
}
开发者ID:romixlab,项目名称:trunk,代码行数:21,代码来源:test.cpp

示例3: addSignal

bool Test::addSignal(const QString &signal)
{
    if (d->signalName2Id.value(signal, -1) != -1)
        return false;

    QDataStream istream(d->metadata);
    QMetaObjectBuilder builder;
    QMap<QByteArray, const QMetaObject*> refs;
    builder.deserialize(istream, refs);

    int metaIndex = builder.addSignal(signal.toLocal8Bit()).index()
            + d->meta->methodOffset();
    d->signalName2Id.insert(signal, metaIndex);

    if (d->meta)
        free(d->meta);
    d->meta = builder.toMetaObject();
    QDataStream ostream(&d->metadata, QIODevice::WriteOnly);
    builder.serialize(ostream);

    return true;
}
开发者ID:romixlab,项目名称:trunk,代码行数:22,代码来源:test.cpp

示例4: removeSlot

bool Test::removeSlot(const QString &slot)
{
    if (d->slotId2Name.key(slot, -1) == -1)
        return false;

    QDataStream istream(d->metadata);
    QMetaObjectBuilder builder;
    QMap<QByteArray, const QMetaObject*> refs;
    builder.deserialize(istream, refs);

    int metaIndex = d->slotId2Name.key(slot);
    builder.removeMethod(metaIndex - d->meta->methodOffset());
    d->slotId2Name.remove(metaIndex);

    if (d->meta)
        free(d->meta);
    d->meta = builder.toMetaObject();
    QDataStream ostream(&d->metadata, QIODevice::WriteOnly);
    builder.serialize(ostream);

    return true;
}
开发者ID:romixlab,项目名称:trunk,代码行数:22,代码来源:test.cpp

示例5: removeSignal

bool Test::removeSignal(const QString &signal)
{
    if (d->signalName2Id.value(signal, -1) == -1)
        return false;

    QDataStream istream(d->metadata);
    QMetaObjectBuilder builder;
    QMap<QByteArray, const QMetaObject*> refs;
    builder.deserialize(istream, refs);

    int metaIndex = d->signalName2Id.value(signal) - d->meta->methodOffset();
    d->signalName2Id.remove(signal);
    builder.removeMethod(metaIndex);

    if (d->meta)
        free(d->meta);
    d->meta = builder.toMetaObject();
    QDataStream ostream(&d->metadata, QIODevice::WriteOnly);
    builder.serialize(ostream);

    return true;
}
开发者ID:romixlab,项目名称:trunk,代码行数:22,代码来源:test.cpp


注:本文中的QMetaObjectBuilder::serialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。