You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, October 19th 2011, 6:21pm

QStandartItemModel::removeRows throw exception

Greeting All

I have got problem with removeRows method. I want to update item after changing rows. And removeRows method threw exception.
This is my code:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void updateDate(const QList<Info> newRows) //[public slot]
{	
    emit layoutAboutToBeChanged();

    removeRows(0, rowCount()); // this row of code threw exception

    for (int i = 0; i < newRows.count(); i++)
    {
        QList<QStandartItem *> items;
        const Info &info = newRows[i];
        items << createItem(QString().setNum(info.number), Qt::AlignCenter, info.default) <<
        createItem(info.name, Qt::AlignCenter, info.default);
        appendRow(items);
    }
    emit layoutChanged();
}


Have you got any ideas?