Reputation: 30885
i like to make my QStandardItemModel that populates items in qtreeview to append rows on top the allready defined items in the view . something like the twitter view , new items first. all i see in the QStandardItemModel is the appendRow/s that appends then to button. this is what im using now.
SWidget *widget = new SWidget;
QStandardItem *newItem = new QStandardItem;
newItem->setSizeHint( widget->size() );
appendRow( newItem );
view->setIndexWidget( newItem->index(), widget );
Upvotes: 1
Views: 1410
Reputation: 11822
void QStandardItemModel::insertRow ( int row, QStandardItem * item ) inserts a row at row
containing item
. So instead of calling appendRow(newItem);
call insertRow(0, newItem);
Upvotes: 2