| 32 | } |
| 33 | |
| 34 | QStandardItemModel * TestAggregateModel::newModel() |
| 35 | { |
| 36 | /* |
| 37 | construct the simple model like: |
| 38 | cool item |
| 39 | item 0 |
| 40 | item 1 |
| 41 | item 2 |
| 42 | item 3 |
| 43 | */ |
| 44 | |
| 45 | auto *model = new QStandardItemModel(this); |
| 46 | QStandardItem *parentItem = model->invisibleRootItem(); |
| 47 | |
| 48 | auto* item = new QStandardItem(QStringLiteral("cool item")); |
| 49 | parentItem->appendRow(item); |
| 50 | |
| 51 | for (int i = 0; i < 4; ++i) { |
| 52 | auto* item = new QStandardItem(QStringLiteral("item %0").arg(i)); |
| 53 | parentItem->appendRow(item); |
| 54 | parentItem = item; |
| 55 | } |
| 56 | |
| 57 | return model; |
| 58 | } |
| 59 | |
| 60 | |
| 61 | QTEST_MAIN(TestAggregateModel) |