1 Attachment(s)
Inserting QStandardItems to the child rows and columns in QStandardItemModel
Hi all!
There is code which helps to build the tree (picturied lower)
Code:
#include <QtGui>
int main(int argc, char** argv)
{
for (int nTopRow = 0; nTopRow < 5; ++nTopRow) {
model.
setData(index,
"item" + QString::number(nTopRow
+ 1));
model.insertRows(0, 4, index);
model.insertColumns(0, 3, index);
for (int nRow = 0; nRow < 4; ++nRow) {
for (int nCol = 0; nCol < 3; ++nCol) {
model.setData(model.index(nRow, nCol, index), strPos);
}
}
}
treeView.setModel(&model);
treeView.show();
return app.exec();
}
My task is to insert QStandardItems in the child rows and columns.
tried
Quote:
void QStandardItemModel::setItem ( int row, int column, QStandardItem * item )
but but the model did not change the count of its rows and columns after new rows and colums have been inserted
do you have any ideas?
Thank you
Re: Inserting QStandardItems to the child rows and columns in QStandardItemModel
Where is your code calling setItem()?
Re: Inserting QStandardItems to the child rows and columns in QStandardItemModel
Quote:
Originally Posted by
caduel
Where is your code calling setItem()?
I just tried to insert it, but have no ideas how to set the Items to the inserted rows