demos/books/bookwindow.cpp
changeset 37 758a864f9613
parent 18 2f34d5167611
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
    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"));