Question

i have a CRUD form (more or less) in c++ with lineEdits and Labels upside, and a TableView down. Both have the same QSqlRelationalTableModel. I understood the "A Simple Widget Mapper" example, but how can i do a integration between the TableView and the LineEdits?.

Example: When i click a row in the Table, show those datas upside, and when i double click, i want to open a new window with those datas to Edit them.

I am new in this, i thank you very much. Greetings from Colombia.

Was it helpful?

Solution

Connect to the clicked() signal from the QTableView. See the docs for QAbstractItemView.

Use the provided QModelIndex from the signal to lookup the value in the table and then populate it in the QLineEdit.

For double clicking you can use the doubleClicked() signal.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top