I have a table Courses:
create table Cursos(
ID_curso int not null auto_increment,
Nome_curso varchar (50),
primary key (ID_curso)
)default charset = utf8;
And another table registered:
create table Cadastrados(
Nome varchar(50),
Matricula varchar(9) unique,
Curso_id int not null,
primary key (Matricula),
foreign key (Curso_id) references Cursos (ID_Curso)
)default charset = utf8;
Creating the interface with Qt, I was able to list all the courses within a comboBox:
ui->setupUi(this);
QSqlQueryModel *model = new QSqlQueryModel;
model->setQuery("select nome_curso from Cursos");
ui->comboBox->setModel(model);
But now I want to select some course of the combobox, and make a list appear with all the registered ones of that respective course (I thought to use the tableView for this). But I have no idea where to start. Could someone give me a light?