Not obvious at all, this should return a valid index if the model has such a cell:
If the index is not valid despite this cell being part of the model, then there must a problem with the model's index() implementation.Qt Code:
Q_ASSERT(topLevelRow0Column0.isValid()); }To copy to clipboard, switch view to plain text mode
The index() and the parent() method are the two tricky ones when implementing a tree model, so things can go wrong there.
See https://wiki.qt.io/Model_Test for a simple standard test harness for models and also check out https://www.kdab.com/development-res...ools/gammaray/ (has a model inspector plugin)
Cheers,
_
Bookmarks