summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_xmlpatterns_api_qsimplexmlnodemodel.cpp
blob: 0906328f867a85563ce88e4fb159d9dfd0e28414 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! [0]
QXmlNodeModelIndex MyTreeModel::nextFromSimpleAxis(SimpleAxis axis, const QXmlNodeModelIndex &ni) const
{
    // Convert the QXmlNodeModelIndex to a value that is specific to what we represent.
    const MyValue value = toMyValue(ni);

    switch(axis)
    {
        case Parent:
            return toNodeIndex(value.parent());
        case FirstChild:
        case PreviousSibling:
        case NextSibling:
            // and so on
            ;
    }
    return QXmlNodeModelIndex();
}
//! [0]