Inside QTableView I want to show data from Sql view that fetches data from multiple tables.
I tried two approaches, but both have their own problems:

1. First approach: I used QSqlQueryModel in combination with QTableView. Data are shown OK, but sorting is not implemented in QSqlQueryModel, so that sorting inside QTableView does not work even if it is enabled with sortingEnabled()

2. Second approach: I tried to use QSqlTableModel in combination with QTableView. I think that sorting should work now, but there is no data shown. It is really strange, because data are shown if I fetch it from SQL table, but if I use SQL view, then data are not shown. I thought that for Qt it does not matter if it fetches data from table or from view.

Any idea how to get data from view AND have sorting enabled?