if (index.column() == 0) {
if (index.row() == 0) {
return QString::fromUtf8("(None/unknown)");
- } else if (index.row() == formations.size() + 1) {
+ } else if (index.row() == int(formations.size() + 1)) {
return QString::fromUtf8("Add new…");
} else {
return QString::fromUtf8(formations[index.row() - 1].name);
fprintf(stderr, "INSERT finalize: %s\n", sqlite3_errmsg(db));
abort();
}
-
- beginResetModel(); // Simplest for our use, though not ideal.
-
int formation_id = sqlite3_last_insert_rowid(db);
- formations.push_back(Formation{ formation_id, name });
+ beginResetModel(); // Simplest for our use, though not ideal.
+ load_data();
endResetModel();
return formation_id;