I am writing a program using Qt5 that works fine on Linux, but on Windows I observed strange behavior:
When QTreeView::setModel was called, it requested a model for the index ( QAbstractItemModel::index ) with some rows and col and an invalid parent. This never happened on Linux, always calling hasChildren , rowCount , etc. before calling index .
I downloaded Qt5 sources to find out what is happening and I can see:
// These asserts do basic sanity checking of the model Q_ASSERT_X(d->model->index(0,0) == d->model->index(0,0), "QAbstractItemView::setModel", "A model should return the exact same index " "(including its internal id/pointer) when asked for it twice in a row."); Q_ASSERT_X(!d->model->index(0,0).parent().isValid(), "QAbstractItemView::setModel", "The parent of a top level index should be invalid");
I cannot find a single word about these sanity checks in the documentation of class classes and model classes.
Where are they defined?
Another interesting thing is that I could deduce by observing the model / view classes that I wrote that the superscript must be invalid, but I could not find this information directly in the documents.
source share