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


C++ QXmlNodeModelIndex类代码示例

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


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

示例1: typedValue

QVariant QObjectXmlModel::typedValue(const QXmlNodeModelIndex &n) const
{
    switch (toNodeType(n))
    {
    case QObjectProperty:
    {
        const QVariant &candidate = toMetaProperty(n).read(asQObject(n));
        if (isTypeSupported(candidate.type()))
            return candidate;
        else
            return QVariant();
    }

    case MetaObjectClassName:
        return QVariant(static_cast<QMetaObject*>(n.internalPointer())->className());

    case MetaObjectSuperClass:
    {
        const QMetaObject *const superClass = static_cast<QMetaObject*>(n.internalPointer())->superClass();
        if (superClass)
            return QVariant(superClass->className());
        else
            return QVariant();
    }

    case QObjectClassName:
        return QVariant(asQObject(n)->metaObject()->className());

    default:
        return QVariant();
    }
}
开发者ID:eagafonov,项目名称:qtmoko,代码行数:32,代码来源:qobjectxmlmodel.cpp

示例2: internalPointer

void tst_QXmlNodeModelIndex::internalPointer() const
{
    /* Check default value. */
    {
        const QXmlNodeModelIndex index;
        QCOMPARE(index.internalPointer(), static_cast<void *>(0));
    }
}
开发者ID:mpvader,项目名称:qt,代码行数:8,代码来源:tst_qxmlnodemodelindex.cpp

示例3: model

void tst_QXmlNodeModelIndex::model() const
{
    /* Check default value. */
    {
        const QXmlNodeModelIndex index;
        QCOMPARE(index.model(), static_cast<const QAbstractXmlNodeModel *>(0));
    }
}
开发者ID:mpvader,项目名称:qt,代码行数:8,代码来源:tst_qxmlnodemodelindex.cpp

示例4: additionalData

void tst_QXmlNodeModelIndex::additionalData() const
{
    /* Check default value. */
    {
        const QXmlNodeModelIndex index;
        QCOMPARE(index.additionalData(), qint64(0));
    }

    // TODO check that the return value for data() is qint64.
}
开发者ID:mpvader,项目名称:qt,代码行数:10,代码来源:tst_qxmlnodemodelindex.cpp

示例5: Q_ASSERT

void QAbstractXmlReceiver::sendFromAxis(const QXmlNodeModelIndex &node)
{
    Q_ASSERT(!node.isNull());
    const QXmlNodeModelIndex::Iterator::Ptr it(node.iterate(axis));
    QXmlNodeModelIndex next(it->next());

    while(!next.isNull())
    {
        sendAsNode(next);
        next = it->next();
    }
}
开发者ID:zmjdx,项目名称:steamlink-sdk,代码行数:12,代码来源:qabstractxmlreceiver.cpp

示例6: Q_ASSERT

QXmlNodeModelIndex QObjectXmlModel::metaObjectSibling(const int pos, const QXmlNodeModelIndex &n) const
{
    Q_ASSERT(pos == 1 || pos == -1);
    Q_ASSERT(!n.isNull());

    const int indexOf = m_allMetaObjects.indexOf(static_cast<const QMetaObject *>(n.internalPointer())) + pos;

    if (indexOf >= 0 && indexOf < m_allMetaObjects.count())
        return createIndex(const_cast<QMetaObject *>(m_allMetaObjects.at(indexOf)), MetaObject);
    else
        return QXmlNodeModelIndex();
}
开发者ID:eagafonov,项目名称:qtmoko,代码行数:12,代码来源:qobjectxmlmodel.cpp

示例7: QVERIFY

void tst_QXmlNodeModelIndex::isNull() const
{
    /* Check default value. */
    {
        const QXmlNodeModelIndex index;
        QVERIFY(index.isNull());
    }

    /* Test default value on a temporary object. */
    {
        QVERIFY(QXmlNodeModelIndex().isNull());
    }
}
开发者ID:mpvader,项目名称:qt,代码行数:13,代码来源:tst_qxmlnodemodelindex.cpp

示例8: while

bool XsdInstanceReader::hasChildElement() const
{
    const QXmlNodeModelIndex index = m_model.index();
    QXmlNodeModelIndex::Iterator::Ptr it = index.model()->iterate(index, QXmlNodeModelIndex::AxisChild);

    QXmlNodeModelIndex currentIndex = it->next();
    while (!currentIndex.isNull()) {
        if (currentIndex.kind() == QXmlNodeModelIndex::Element)
            return true;

        currentIndex = it->next();
    }

    return false;
}
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:15,代码来源:qxsdinstancereader.cpp

示例9: Q_ASSERT_X

QXmlNodeModelIndex::DocumentOrder AccelTree::compareOrder(const QXmlNodeModelIndex &ni1,
                                                          const QXmlNodeModelIndex &ni2) const
{
    Q_ASSERT_X(ni1.model() == ni2.model(), Q_FUNC_INFO,
               "The API docs guarantees the two nodes are from the same model");

    const PreNumber p1 = ni1.data();
    const PreNumber p2 = ni2.data();

    if(p1 == p2)
        return QXmlNodeModelIndex::Is;
    else if(p1 < p2)
        return QXmlNodeModelIndex::Precedes;
    else
        return QXmlNodeModelIndex::Follows;
}
开发者ID:maxxant,项目名称:qt,代码行数:16,代码来源:qacceltree.cpp

示例10: typedValue

/*!
  Returns the typed value for \a node, which must be either an
  attribute or an element. The QVariant returned represents the atomic
  value of an attribute or the atomic value contained in an element.

  If the QVariant is returned as a default constructed variant,
  it means that \a node has no typed value.
 */
QVariant FileTree::typedValue(const QXmlNodeModelIndex &node) const
{
    const QFileInfo &fi = toFileInfo(node);

    switch (Type(node.additionalData())) {
    case Directory:
    // deliberate fall through.
    case File:
        return QString();
    case AttributeFileName:
        return fi.fileName();
    case AttributeFilePath:
        return fi.filePath();
    case AttributeSize:
        return fi.size();
    case AttributeMIMEType:
    {
        /* We don't have any MIME detection code currently, so return
         * the most generic one. */
        return QLatin1String("application/octet-stream");
    }
    case AttributeSuffix:
        return fi.suffix();
    }

    Q_ASSERT_X(false, Q_FUNC_INFO, "This line should never be reached.");
    return QString();
}
开发者ID:PNIDigitalMedia,项目名称:emscripten-qt,代码行数:36,代码来源:filetree.cpp

示例11: attribute

/*!
  \internal

   Treats \a outputItem as a node and calls the appropriate function,
   e.g., attribute() or comment(), depending on its
   QXmlNodeModelIndex::NodeKind.

   This is a helper function that subclasses can use to multiplex
   Nodes received via item().
 */
void QAbstractXmlReceiver::sendAsNode(const QPatternist::Item &outputItem)
{
    Q_ASSERT(outputItem);
    Q_ASSERT(outputItem.isNode());
    const QXmlNodeModelIndex asNode = outputItem.asNode();

    switch(asNode.kind())
    {
        case QXmlNodeModelIndex::Attribute:
        {
            const QString &v = outputItem.stringValue();
            attribute(asNode.name(), QStringRef(&v));
            return;
        }
        case QXmlNodeModelIndex::Element:
        {
            startElement(asNode.name());

            /* First the namespaces, then attributes, then the children. */
            asNode.sendNamespaces(this);
            sendFromAxis<QXmlNodeModelIndex::AxisAttribute>(asNode);
            sendFromAxis<QXmlNodeModelIndex::AxisChild>(asNode);

            endElement();

            return;
        }
        case QXmlNodeModelIndex::Text:
        {
            const QString &v = asNode.stringValue();
            characters(QStringRef(&v));
            return;
        }
        case QXmlNodeModelIndex::ProcessingInstruction:
        {
            processingInstruction(asNode.name(), outputItem.stringValue());
            return;
        }
        case QXmlNodeModelIndex::Comment:
        {
            comment(outputItem.stringValue());
            return;
        }
        case QXmlNodeModelIndex::Document:
        {
            startDocument();
            sendFromAxis<QXmlNodeModelIndex::AxisChild>(asNode);
            endDocument();
            return;
        }
        case QXmlNodeModelIndex::Namespace:
            Q_ASSERT_X(false, Q_FUNC_INFO, "Not implemented");
    }

    Q_ASSERT_X(false, Q_FUNC_INFO,
               QString::fromLatin1("Unknown node type: %1").arg(asNode.kind()).toUtf8().constData());
}
开发者ID:zmjdx,项目名称:steamlink-sdk,代码行数:67,代码来源:qabstractxmlreceiver.cpp

示例12: Q_ASSERT

QHash<QXmlName, QXmlItem> PullBridge::attributeItems()
{
    Q_ASSERT(m_current == StartElement);

    QHash<QXmlName, QXmlItem> attributes;

    QXmlNodeModelIndex::Iterator::Ptr it = m_index.iterate(QXmlNodeModelIndex::AxisAttribute);
    QXmlNodeModelIndex index = it->next();
    while (!index.isNull()) {
        const Item attribute(index);
        attributes.insert(index.name(), QXmlItem(index));

        index = it->next();
    }

    return attributes;
}
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:17,代码来源:qpullbridge.cpp

示例13: switch

/*!
  This function returns QXmlNodeModelIndex::Element if \a node
  is a directory or a file, and QXmlNodeModelIndex::Attribute
  otherwise.
 */
QXmlNodeModelIndex::NodeKind
FileTree::kind(const QXmlNodeModelIndex &node) const
{
    switch (Type(node.additionalData())) {
    case Directory:
    case File:
        return QXmlNodeModelIndex::Element;
    default:
        return QXmlNodeModelIndex::Attribute;
    }
}
开发者ID:PNIDigitalMedia,项目名称:emscripten-qt,代码行数:16,代码来源:filetree.cpp

示例14: toFileInfo

/*!
  Returns the attributes of \a element. The caller guarantees
  that \a element is an element in this node model.
 */
QVector<QXmlNodeModelIndex>
FileTree::attributes(const QXmlNodeModelIndex &element) const
{
    QVector<QXmlNodeModelIndex> result;

    /* Both elements has this attribute. */
    const QFileInfo &forElement = toFileInfo(element);
    result.append(toNodeIndex(forElement, AttributeFilePath));
    result.append(toNodeIndex(forElement, AttributeFileName));

    if (Type(element.additionalData() == File)) {
        result.append(toNodeIndex(forElement, AttributeSize));
        result.append(toNodeIndex(forElement, AttributeSuffix));
        //result.append(toNodeIndex(forElement, AttributeMIMEType));
    }
    else {
        Q_ASSERT(element.additionalData() == Directory);
    }

    return result;
}
开发者ID:PNIDigitalMedia,项目名称:emscripten-qt,代码行数:25,代码来源:filetree.cpp

示例15: mapToItem

Item AxisStep::mapToItem(const QXmlNodeModelIndex &node,
                         const DynamicContext::Ptr &context) const
{
    Q_ASSERT(!node.isNull());
    Q_ASSERT(Item(node).isNode());
    Q_ASSERT(Item(node));
    Q_UNUSED(context);

    if(m_nodeTest->itemMatches(Item(node)))
        return Item(node);
    else
        return Item();
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:13,代码来源:qaxisstep.cpp


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