I have a model that does not collect all its data at one time but rather lazily, i.e. when the data is actually needed.
Therefore my hasChildren() method looks like that:
bool MyTreeModel::hasChildren(const QModelIndex &parent) const
{
if (!parent.isValid())
{
return true;
}
else
{
MyTreeElement *parentItem = static_cast<MyTreeElement *>(parent.internalPointer());
if (parentItem->populated())
return (parentItem->childCount() > 0);
else
return true;
}
}
This to my mind causes incorrect ASSERTs in ModelTest.cpp:310:
// rowCount() and columnCount() said that it existed...
Q_ASSERT(index.isValid() == true);
Is it really a bug in the model or does ModelTest not work perfectly with a lazily popuplated model?
Ralf