If a submenu action has an icon set, make sure to also display it

Authored by ahiemstra on Aug 27 2019, 4:49 PM.



QQC2's Menu does not support icons, but the MenuItem that gets created
when it is used as a submenu does. Since we already have a reference to
that MenuItem, also update the MenuItem's icon property with those of
the Action. This way submenus will properly display icons if set.

Test Plan

The following test code, ran through qmlscene, should produce a context menu
with icons for both entries, even though one of them is a menu.

Note that you will need D23499 for the context menu button to show up again.

import QtQuick 2.12
import QtQuick.Controls 2.12

import org.kde.kirigami 2.8 as Kirigami

Kirigami.ApplicationWindow {
    pageStack.initialPage: Kirigami.Page {
        actions.main: Kirigami.Action { text: "Main"; icon.name: "document-new" }
        actions.contextualActions: [
            Kirigami.Action { text: "Action 1"; icon.name: "document-new" },
            Kirigami.Action {
                text: "Action 2"
                icon.name: "document-new"
                Kirigami.Action { text: "Nested Action" }

Diff Detail

R169 Kirigami
No Linters Available
No Unit Test Coverage
Build Status
Buildable 15704
Build 15722: arc lint + arc unit
ahiemstra created this revision.Aug 27 2019, 4:49 PM
Restricted Application added a project: Kirigami. · View Herald TranscriptAug 27 2019, 4:49 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
ahiemstra requested review of this revision.Aug 27 2019, 4:49 PM
mart accepted this revision.Sep 3 2019, 10:21 AM
This revision is now accepted and ready to land.Sep 3 2019, 10:21 AM
This revision was automatically updated to reflect the committed changes.