equal
deleted
inserted
replaced
62 // Create the data model |
62 // Create the data model |
63 model = new QSqlRelationalTableModel(ui.bookTable); |
63 model = new QSqlRelationalTableModel(ui.bookTable); |
64 model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
64 model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
65 model->setTable("books"); |
65 model->setTable("books"); |
66 |
66 |
67 // Remeber the indexes of the columns |
67 // Remember the indexes of the columns |
68 authorIdx = model->fieldIndex("author"); |
68 authorIdx = model->fieldIndex("author"); |
69 genreIdx = model->fieldIndex("genre"); |
69 genreIdx = model->fieldIndex("genre"); |
70 |
70 |
71 // Set the relations to the other database tables |
71 // Set the relations to the other database tables |
72 model->setRelation(authorIdx, QSqlRelation("authors", "id", "name")); |
72 model->setRelation(authorIdx, QSqlRelation("authors", "id", "name")); |