1

I found a lot of answers how to transform rows into columns in SQL. But I need to transforms rows into columns in QSqlTableModel. As I understand it should not be a very difficult task but I can't find any idea of how to realize it. Perhaps data(), setData() and some other methods could be reimplemented, but I am afraid to miss something...

Or, maybe, some methods of QTableView should be reimplemented.

Funt
  • 399
  • 8
  • 23

1 Answers1

1

As I understand QIdentityProxyModel could be used to solve this problem. Unfortunately, QIdentityProxyModel is available since version 4.8.

So I inherited QAbstractProxyModel and implemented mapToSource() and mapFromSource(), rowCount(), columnCount() and few more methods to switch rows with columns.

Funt
  • 399
  • 8
  • 23
  • Showing the code of your subclass(es) here would have been really helpful to the next person coming along with the same question. ;-) – CodingCat Mar 28 '18 at 09:01