setData(id, tindex, status.data.speed, Qt::DisplayRole); tindex = index(row, 2); setData(id, tindex, status.state_move, Qt::DecorationRole); tindex = index(row, 3); setData(id, tindex, status.state_battery, Qt::DecorationRole); tindex = index(row, 4); setData(id, tindex, status.state_satellite, Qt::DecorationRole); tindex = index(row, 5); setData(id, tindex, status.state_communication, Qt::DecorationRole);
resizeColumnsToContents(); resizeRowsToContents();
QModelCars::statuses_t statuses; for(int i = 0; i < 2000; i++) { QModelCars::status_t status; status.data.speed = 10; status.state_battery = true; status.state_communication = true; status.state_move = true; status.state_satellite = true; statuses[i + 1000] = status; } for(int key: statuses.keys()) { m_model->addCar(key, statuses[key]); } resizeColumnsToContents(); resizeRowsToContents();
for(int i = 0; i < 2000; i++) { QModelCars::status_t status; status.data.speed = 10; status.state_battery = true; status.state_communication = true; status.state_move = true; status.state_satellite = true; //statuses[i + 1000] = status; m_model->addCar(i, status); }