What do I do to list data from two tables in tableView?
Database (Example) Sqlite:
tb_venda
tb_produto
tb_valor
tb_cliente_id (Id do cliente "tb_cliente")
tb_cliente
tb_cliente_id (id primary key)
tb_nome
tb_estado
With QSqlRelationalTableModel
I can only bring the client's name.
I also need the state.
relacao = new QSqlRelationalTableModel(this);
relacao->setTable("tb_venda");
relacao->setRelation(2, QSqlRelation("tb_cliente", "tb_cliente_id", "tb_nome"));
relacao->select();
ui->tableView->setModel(relacao);