Skip to content
Advertisement

How to use QSortFilterProxyModel to do data aggregation

I used QSortFilterProxyModel to filter the model data and display it in a tableView. Then I want to aggregate the filtered data, so I created a new tableView2 to display the filtered data aggregation.

I created a new QSortFilterProxyModel to aggregate the data, but I don’t know how to get the source data, and then increase the data

But with my current knowledge of QSortFilterProxyModel, I seem to be unable to start.

JavaScript

This is the effect I want to achieve according to the specified head key (a1, a3) to perform data aggregation:

enter image description here

Advertisement

Answer

A proxymodel is used to map items but in this case the goal is to count, so using a proxymodel seems unnecessary to me. Instead it is easier to use match() to count and connect the signals that indicate some change in the model to recalculate it.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement