Status bar mode menu: Reuse empty QIcon that is implicitly shared
ClosedPublic

Authored by dhaumann on Sep 23 2019, 5:22 PM.

Details

Summary

Instead of creating N empty QIcons, use just one QIcon
that internally is implicitly shared, see:
https://doc.qt.io/qt-5/implicit-sharing.html

Test Plan

make

Diff Detail

Repository
R39 KTextEditor
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dhaumann created this revision.Sep 23 2019, 5:22 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptSep 23 2019, 5:22 PM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
dhaumann requested review of this revision.Sep 23 2019, 5:22 PM
cullmann accepted this revision.Sep 23 2019, 5:33 PM
This revision is now accepted and ready to land.Sep 23 2019, 5:33 PM
This revision was automatically updated to reflect the committed changes.
nibags added a subscriber: nibags.Sep 23 2019, 10:32 PM

In the function KateModeMenuList::updateSelectedItem() an empty QIcon is also created when selecting an item. It would be better to put emptyIcon as an attribute of the class and use it every time.

I will do it in another commit, I have seen others bugs in the mode menu, apparently they appeared when I changed from QListWidget to QListView.