14 int main(
int argc,
char** argv)
16 QApplication app(argc, argv);
17 QStandardItemModel model(5, 3);
19 for (
int nTopRow = 0; nTopRow < 5; ++nTopRow) {
20 QModelIndex index = model.index(nTopRow, 0);
21 model.setData(index,
"item" + QString::number(nTopRow + 1));
23 model.insertRows(0, 4, index);
24 model.insertColumns(0, 3, index);
25 for (
int nRow = 0; nRow < 4; ++nRow) {
26 for (
int nCol = 0; nCol < 3; ++nCol) {
27 QString strPos = QString(
"%1,%2").arg(nRow).arg(nCol);
28 model.setData(model.index(nRow, nCol, index), strPos);
34 treeView.setModel(&model);
int main(int argc, char **argv)