Bug 391681 - Support icons in contextual actions
Summary: Support icons in contextual actions
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kirigami
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: Master
Platform: Other Linux
: NOR wishlist
Target Milestone: Not decided
Assignee: Marco Martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-10 21:12 UTC by Nate Graham
Modified: 2018-03-12 13:04 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2018-03-10 21:12:29 UTC
Discover DiscoverWindow.qml defines a refresh action:

Kirigami.Action {
        id: refreshAction
        readonly property QtObject action: ResourcesModel.updateAction
        text: action.text
        onTriggered: action.trigger()
        enabled: action.enabled
        tooltip: shortcut
        shortcut: "Ctrl+R"
    }



Discover updatesPage.qml uses it as a contextual action:

contextualActions: [refreshAction]



This works, and the action shows up as a toolbar button on the Updates page. But it doesn't have an icon. When I try to add one:

@@ -89,6 +89,7 @@ Kirigami.ApplicationWindow
         id: refreshAction
         readonly property QtObject action: ResourcesModel.updateAction
         text: action.text
+        icon: "view-refresh"
         onTriggered: action.trigger()
         enabled: action.enabled
         tooltip: shortcut



...it doesn't work:

$ plasma-discover 
QQmlApplicationEngine failed to load component
qrc:/qml/DiscoverWindow.qml:92 Invalid property assignment: unsupported type "ActionIconGroup_QMLTYPE_11*"
Comment 1 Aleix Pol 2018-03-12 12:59:20 UTC
Wrong API. It's icon.name or iconName.

You will only get the icon on the tool button from Qt 5.10 on.
Comment 2 Nate Graham 2018-03-12 13:04:55 UTC
Jeez, my brain must not have been fully on yet.