More fixes to resource models
I was investigating why tagging doesn't really take effect in Krita until a restart, and curiously enough two test cases of TestTagFilterResourceProxyModel kept failing with this Qt 5.15."3" git code that won't ever see an open source release.
I noticed that KisTagModel
and KisTagResourceModel
always create a new KisAllTagsModel
/KisAllTagResourceModel
respectively, while KisResourceModel
uses KisResourceModelProvider::resourceModel()
, so I figured they should do that too since KisResourceModelProvider has corresponding functions for those models too.
Things started working, so I hope this assumption was correct.
This however turned up warnings in TestTagFilterResourceProxyModel that kept me busy for 2 days, until I finally realized that KisAllTagResourceModel
confuses filter models by passing a wrong range to beginRemoveRows() when untagging a resource. They removed one too many rows in their mapping, causing subsequent modifications to throw QSortFilterProxyModel: invalid inserted rows reported by source model
warnings.
Test Plan
I think the best way to test it is to go through the test cases listed in the Resource bugs spreadsheet, specifically rows 28-31 in the "User Tests" tab should be fixed by this, and possibly others with "Models communication" as subproject. (Haven't gone through all of them myself yet...)
Formalities Checklist
-
I confirmed this builds. -
I confirmed Krita ran and the relevant functions work. -
I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!) -
I made sure my commits build individually and have good descriptions as per KDE guidelines. -
I made sure my code conforms to the standards set in the HACKING file. -
I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.