| 45 | } |
| 46 | |
| 47 | void SampleModel::fillSampleData(int size) |
| 48 | { |
| 49 | QString abs = "qwertyuiopasdfghjklzxcvbnm"; |
| 50 | QRandomGenerator r; |
| 51 | for (auto i = 0; i < size; i++) { |
| 52 | Row row; |
| 53 | auto nameLen = r.bounded(3, 8); |
| 54 | QString name; |
| 55 | for (int c = 0; c < nameLen; ++c) |
| 56 | name.append(abs.at(r.bounded(0, abs.size() - 1))); |
| 57 | |
| 58 | row.first = name; |
| 59 | row.second = r.bounded(0, 20); |
| 60 | _data.append(row); |
| 61 | } |
| 62 | |
| 63 | qDebug() << _data.size() << "item(s) added as sample data"; |
| 64 | beginInsertRows(QModelIndex(), 0, _data.size() - 1); |
| 65 | endInsertRows(); |
| 66 | } |
nothing calls this directly
no test coverage detected