- if icons are defined for marks, use them in the context menu
- more general approach than D7158
Details
Details
- Reviewers
dhaumann - Group Reviewers
KTextEditor - Commits
- R39:5118d39bb24e: Show icons in icon border context menu
- right click icon border to open context menu
Diff Detail
Diff Detail
- Repository
- R39 KTextEditor
- Branch
- iconbordermenu
- Lint
No Linters Available - Unit
No Unit Test Coverage
Comment Actions
Other than that the patch looks sensible to me.
src/view/kateviewhelpers.cpp | ||
---|---|---|
2254 | Less code with: if (auto icon = ...) { mA->setIcon(icon); dMA->setIcon(icon); } |
Comment Actions
I think we need one more iteration, then this is good to go, see the comments.
src/view/kateviewhelpers.cpp | ||
---|---|---|
2254 | What most likely would work is this: if (!m_doc->markDescription(markType).isEmpty()) { const QPixmap icon = m_doc->markPixmap(markType); mA = markMenu.addAction(icon, m_doc->markDescription(markType)); dMA = selectDefaultMark.addAction(icon, m_doc->markDescription(markType)); } else { mA = markMenu.addAction(i18n("Mark Type %1", bit + 1)); dMA = selectDefaultMark.addAction(i18n("Mark Type %1", bit + 1)); } Looking at the Qt code of the constructor QIcon(const QPixmap & ) it becomes clear that a null pixmap will simply create a null icon. And a null QIcon will not be displayed in the gui, so we do not need the if at all, right? Could you test this? |
Comment Actions
Yes, the QAction simply overwrites its icon, which then just stays null. Works fine, thank you!
Comment Actions
Good patch, thanks a lot! You can make the QPixmap const, if you want: const QPixmap icon = ...;
Please commit.