KCharSelect's internal model: ensure rowCount() is 0 for valid indexes
ClosedPublic

Authored by dfaure on Apr 13 2019, 1:42 PM.

Details

Summary

This isn't a tree model.
QAbstractTableModel's hasChildren() is a bit stupid about asking the
model, I'll fix that in Qt: https://codereview.qt-project.org/258965
Still, this is more correct.

Caught by QAbstractItemModelTester, but probably harmless with
the view used here.

Test Plan

not much yet, I'm debugging the assert that happens later on
(bug 395181)

Diff Detail

Repository
R236 KWidgetsAddons
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dfaure created this revision.Apr 13 2019, 1:42 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 13 2019, 1:42 PM
Restricted Application edited subscribers, added: kde-frameworks-devel; removed: Frameworks. · View Herald Transcript
dfaure requested review of this revision.Apr 13 2019, 1:42 PM
cfeck accepted this revision.Apr 13 2019, 1:59 PM

KF5 coding style:

if (...) {
    ...
}
This revision is now accepted and ready to land.Apr 13 2019, 1:59 PM
pino added a subscriber: pino.Apr 13 2019, 2:07 PM

Shouldn't the same applied to columnCount too?

This revision was automatically updated to reflect the committed changes.

It's common to say "I have 3 columns everywhere", that's what tree models look like.
And if you have zero rows somewhere, it doesn't matter how many columns you have, that's still "nothing".