473 \sa rowsInserted() |
473 \sa rowsInserted() |
474 */ |
474 */ |
475 void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, int end ) |
475 void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, int end ) |
476 { |
476 { |
477 // Q_UNUSED(end); |
477 // Q_UNUSED(end); |
478 qDebug() << "rowsAboutToBeInserted" << "start=" << start << "end=" << end << "parent=" << model->data ( parent ).toString() |
478 // qDebug() << "rowsAboutToBeInserted" << "start=" << start << "end=" << end << "parent=" << model->data ( parent ).toString() |
479 << "current count of parent=" << model->rowCount ( parent ); // << "display of last=" << model->data( model->index(start-1, 0, parent) ); |
479 // << "current count of parent=" << model->rowCount ( parent ); // << "display of last=" << model->data( model->index(start-1, 0, parent) ); |
480 // qDebug() << model->index(start-1, 0, parent) << model->data( model->index(start-1, 0, parent) ); |
480 // qDebug() << model->index(start-1, 0, parent) << model->data( model->index(start-1, 0, parent) ); |
481 Changing c; |
481 Changing c; |
482 c.parent = parent; |
482 c.parent = parent; |
483 c.oldSize = model->rowCount ( parent ); |
483 c.oldSize = model->rowCount ( parent ); |
484 c.last = model->data ( model->index ( start - 1, 0, parent ) ); |
484 c.last = model->data ( model->index ( start - 1, 0, parent ) ); |
493 */ |
493 */ |
494 void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end ) |
494 void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end ) |
495 { |
495 { |
496 Changing c = insert.pop(); |
496 Changing c = insert.pop(); |
497 Q_ASSERT ( c.parent == parent ); |
497 Q_ASSERT ( c.parent == parent ); |
498 qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize |
498 // qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize |
499 << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent ); |
499 // << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent ); |
500 |
500 |
501 for (int ii=start; ii <= end; ii++) |
501 // for (int ii=start; ii <= end; ii++) |
502 { |
502 // { |
503 qDebug() << "itemWasInserted:" << ii << model->data ( model->index ( ii, 0, parent )); |
503 // qDebug() << "itemWasInserted:" << ii << model->data ( model->index ( ii, 0, parent )); |
504 } |
504 // } |
505 qDebug(); |
505 // qDebug(); |
506 |
506 |
507 Q_ASSERT ( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) ); |
507 Q_ASSERT ( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) ); |
508 Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) ); |
508 Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) ); |
509 |
509 |
510 if (c.next != model->data(model->index(end + 1, 0, c.parent))) { |
510 if (c.next != model->data(model->index(end + 1, 0, c.parent))) { |