Hi guys,

I'm using the provided QTreeModel. It works fine when using only the first
column.
But if I try to add data to a second column there is either the same data
displayed as in the first column or none at all.

So I had a look at the sources and found a part below that confuses me.
In the last line the index is created and the column is _always_ set to 0.
Is this a mistake or is the QTreeModel not supposed to hold more than one
column?

Regards,
Paolo


QModelIndex QTreeModel::index(int row, int, const QModelIndex &parent) const
{
    Node *parentNode = node(parent);

    // abstract item view may decide to ask for index(0, 0) even
    // though it doesn't exist, as part of its sanity checking...
    if (parentNode->nodes.size() == 0) {
        return QModelIndex();
    }

    QTJAMBI_EXCEPTION_CHECK(qtjambi_current_environment());
    if (!parentNode->isChildrenQueried())
        queryChildren(parentNode);
    QTJAMBI_EXCEPTION_CHECK(qtjambi_current_environment());

    // So someone asked for a bad row... so what...
    if (row >= parentNode->nodes.size())
        return QModelIndex();

    Q_ASSERT_X(parentNode->nodes.at(row),
               "QTreeModel::indeX()",
               "all child nodes must be queried ahead of time...");

    return createIndex(row, 0, parentNode->nodes.at(row));
}
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-jambi-interest

Reply via email to