You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
source data changes, in particular for roles other than the sort role, are not forwarded (SortProxyModel::handleDataChanged), thus having a SortProxyModel in the stack makes you "lose" updates.
In a customer project using SPM, I just implemented it using linear search to do the mapping:
int minRow = std::numeric_limits<int>::max();
int maxRow = -1;
for (int sourceRow = topLeft.row(); sourceRow <= bottomRight.row(); ++sourceRow) {
auto it = std::find(m_rowMap.cbegin(), m_rowMap.cend(), sourceRow);
Q_ASSERT(it != m_rowMap.cend());
const auto proxyRow = static_cast<int>(std::distance(m_rowMap.cbegin(), it));
minRow = std::min(minRow, proxyRow);
maxRow = std::max(maxRow, proxyRow);
}
Q_ASSERT(minRow <= maxRow);
emit dataChanged(index(minRow, 0), index(maxRow, 0), roles);
That does the job for my use case, but generic solution probably should use something more efficient.
The text was updated successfully, but these errors were encountered:
Thank you for your bug report. I have implemented a solution different from yours, based on keeping a reverse map and only emitting the dataChanged signal for the rows that that we got the signal for in the first place but grouping those in as few signals as possible. The change is now in review internally first before publishing.
Cheers, and happy to see the code gets some use outside of KDAB,
source data changes, in particular for roles other than the sort role, are not forwarded (SortProxyModel::handleDataChanged), thus having a SortProxyModel in the stack makes you "lose" updates.
In a customer project using SPM, I just implemented it using linear search to do the mapping:
That does the job for my use case, but generic solution probably should use something more efficient.
The text was updated successfully, but these errors were encountered: