This is because the base QWidgets component that's being called can only support taking an icon string, not a URL. As a result, using icon.source produces no result in Button, ToolButton, RoundButton, CheckBox, and MenuItem. Simple test case: import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.13 Item { implicitWidth: 400 implicitHeight: 400 ColumnLayout { anchors.centerIn: parent Button { Layout.alignment: Qt.AlignHCenter text: "I wish I had an icon" icon.source: "https://dl.flathub.org/repo/logo.svg" } Button { Layout.alignment: Qt.AlignHCenter text: "Look at my beautiful icon" icon.name: "edit-bomb" } } }
Probably need to do it like Kirigami https://invent.kde.org/frameworks/kirigami/-/blob/master/src/icon.cpp#L402
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/67
Git commit 35e6076565d565922939eeca11e93abe67f7b664 by Nate Graham. Committed on 19/04/2021 at 21:11. Pushed by ngraham into branch 'master'. Draw icon in QQStyleItem Checkbox already knew how to do this, but it was doing so internally to itself. Let's move that logic to CheckDelegate.qml so that everything that uses it gains the same feature. This functionality can be optionally disabled in case a control using it already handles icon-drawing by itself. M +4 -4 org.kde.desktop/CheckBox.qml M +5 -2 org.kde.desktop/CheckDelegate.qml M +12 -1 org.kde.desktop/CheckIndicator.qml M +2 -0 org.kde.desktop/MenuItem.qml M +4 -4 org.kde.desktop/RadioButton.qml M +5 -2 org.kde.desktop/RadioDelegate.qml https://invent.kde.org/frameworks/qqc2-desktop-style/commit/35e6076565d565922939eeca11e93abe67f7b664
Still an issue despite that commit.
(In reply to Nate Graham from comment #4) Does https://github.com/nextcloud/desktop/issues/7419#issuecomment-2745794768 appear to be an example of this?