Say I have a one-dimensional QStandardItemModel and a QTableView instance:
QStandardItemModel model;
for (int i = 1; i < 10; ++i) {
QStandardItem *item = new QStandardItem(QString::number(i));
model.appendRow(item);
}
QTableView tableView;
tableView.setModel(&model);
tableView.show();
This shows the data in the first column, but I want to show it in a two-dimensional way like this:
1 2 3
4 5 6
7 8 9
Additionally the user should be able to select the data, which means that a custom QStyledItemDelegate probably isn't the way to go to implement this.
So one needs to create a custom QAbstractItemView, where the documentation is unfortunately a bit lacking in my opinion. Help?
QAbstractProxyModel
as the solution.