QTableView with QSqlQueryModel how to display values of two data fields into one cell
I have a requirement to display values from two data fields from sqlite table into table view where one cell of that table view would contain two values from two data fields from sqlite table. Is there a way to do it using QTableView and QSqlQueryModel or should I switch to something else? Any ideas would be greatly appreciated. Is it possible to create a custom widget and tight it to the model somehow?
Below is the screenshot of my requirements.
Thank you very much for your help.
Looks like a job for QStyledItemDelegate.
Will that address the requirement to combine two data fields into one cell of a
QTableViewthough? IIRC it deals with 1 model field per 1 view column?
Nothing forbids you to get more data from the model using the model index passed to the delegate.
You can also use a proxy model that returns the data from two columns together.
@SGaist Thanks. Yet more to absorb...!