[Notifications] Port to upstream QConcatenateTablesProxyModel
AbandonedPublic

Authored by broulik on Apr 7 2020, 12:44 PM.

Details

Reviewers
None
Group Reviewers
Plasma
Summary

Now that we can depend on Qt 5.14

Test Plan

Still get both jobs and notifications. Can still interact with both and mapping is correct

Diff Detail

Repository
R120 Plasma Workspace
Lint
Lint Skipped
Unit
Unit Tests Skipped
broulik created this revision.Apr 7 2020, 12:44 PM
Restricted Application added a project: Plasma. · View Herald TranscriptApr 7 2020, 12:44 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Apr 7 2020, 12:44 PM
broulik planned changes to this revision.Apr 7 2020, 12:54 PM

Apparently this causes all kinds of breakages :0

This causes expired notifications to not vanish any more. This is supposed to work in the following way ExpiredRole is assigned true and NotficiationFilterProxyModel filters expired notifications out. I verified that upon timeout of the timer the data is updated correctly but the filter model behaves in a strange way. Even though filterAcceptsRow returns false the model still includes the index. I added the following debug output to the class: https://phabricator.kde.org/P584
Which results in this debug output

QModelIndex(0,0,0x0,QConcatenateTablesProxyModel(0x557a51b00d90)) is expired
QModelIndex(-1,-1,0x0,QObject(0x0)) not expired
rowCount NotificationManager::NotificationFilterProxyModel(0x557a51f6ab00) QModelIndex(-1,-1,0x0,QObject(0x0)) 1
QModelIndex(0,0,0x0,QConcatenateTablesProxyModel(0x557a51b00d90)) is expired
filter returns for filterAcceptsRow(index(0, mapToSource(parent)) false
rowCount NotificationManager::NotificationFilterProxyModel(0x557a51f6ab00) QModelIndex(-1,-1,0x0,QObject(0x0)) 1
QModelIndex(0,0,0x0,QConcatenateTablesProxyModel(0x557a51b00d90)) is expired
filter returns for filterAcceptsRow(index(0, mapToSource(parent)) false

So it still has one row even though the first row should get filtered.

Adding @dfaure because he wrote both K/QConcatenate... models

OK I see why this is happening.

KConcatenateProxyModel's columnCount is the number of columns of the first source model. Which leads to strange things if other models have less columns.
QConcatenateProxyModel takes the smallest number of columns of all source models, to solve that.
But here the jobs model is empty. And empty model shouldn't be taken into account when calculating the number of columns.
I'll fix that in QConcatenateProxyModel, but that means you can't use it for another 2 years or so... oh well ;)

:( I see. Thanks!
At least by then I'll be able to use sourceModels() so I could make the mapping up the chain generic

broulik abandoned this revision.Apr 19 2020, 10:13 AM

Wait, even if the jobs model is empty (no rows), what's its columnCount()?
If that's fixed, then it should all be fine. Maybe my analysis (and testcase) is incorrect.

Can you check the columnCount() of the Concat model?

I assume the notifications model emits dataChanged correctly when the ExpiredRole is set to true?

It's just a QAbstractListModel, if any, it does some columnCount behavior. I emit dataChanged, yes. Will check the actual column count later.