Qt Labs Forum » ModelTest

Examples/addressbook doesn't pass Q_ASSERT(model->parent(childIndex) == topIndex

(3 posts)

  1. The addressbook example doesn't pass the following test:

    // Common error test #2, make sure that a second level index has a parent
    // that is the first level index.
    if (model->rowCount(topIndex) > 0) {
    QModelIndex childIndex = model->index(0, 0, topIndex);
    Q_ASSERT(model->parent(childIndex) == topIndex);
    }

    I'm not clear in which reimplemented method this test might be failing...

    Sam

    Posted: 4 months #
  2. apaku
    apaku
    Member

    Well, I think the example uses QAbstractTableModel and I have the same thing here, which means its rowCount() or columnCount() methods don't check wether the parent is for row/col 0 or another parent index.

    Posted: 4 months #
  3. apaku
    apaku
    Member

    I meant to say that the model doesn't check the parent's validity, as explained in the QAbstractItemModel api docs for row/columnCount you should return 0 in table models if you get a valid parent.

    Posted: 4 months #

RSS feed for this topic

Reply

You must log in to post.



© 2008 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners.