Skip to content

fix: Use SVG features compatible with Qt SVG Tiny 1.1#1560

Open
ratijas wants to merge 1 commit intoaristocratos:mainfrom
ratijas:work/ratijas/svg-icon
Open

fix: Use SVG features compatible with Qt SVG Tiny 1.1#1560
ratijas wants to merge 1 commit intoaristocratos:mainfrom
ratijas:work/ratijas/svg-icon

Conversation

@ratijas
Copy link
Copy Markdown

@ratijas ratijas commented Feb 28, 2026

Committed on behalf of https://t.me/SergeiR

Downgrades incompatible (advanced) SVG features to something supported by a default Qt SVG rendered. Besides, xlink:href is deprecated1, and in this case introduces an unnecessary indirection. Fixes these errors causing the icon to be all black in Plasma and Qt apps:

qt.svg: icon.svg:27:6: Could not resolve property: #pattern1888
qt.svg: icon.svg:27:6: Could not resolve property: #pattern1870

Interestingly enough, logo.svg doesn't need any adjustments, it's fine.

comparison
test.qml
import QtQuick
import QtQuick.Layouts

Window {
    width: 580
    height: 320
    visible: true
    title: qsTr("btop")

    component Showcase : ColumnLayout {
        id: comp

        required property string text
        required property url url
        readonly property int size: 256

        Rectangle {
            Layout.preferredHeight: comp.size + border.width * 2
            Layout.preferredWidth: comp.size + border.width * 2
            border.width: 2
            border.color: "gray"

            Image {
                anchors.centerIn: parent
                height: comp.size
                width: comp.size
                source: comp.url
            }
        }

        Text {
            text: comp.text
            font.pixelSize: 36
            Layout.fillWidth: true
            horizontalAlignment: Text.AlignHCenter
        }
    }

    RowLayout {
        id: item

        anchors.centerIn: parent
        spacing: 16

        Showcase {
            url: "old/icon.svg"
            text: "Old"
        }


        Showcase {
            url: "new/icon.svg"
            text: "New"
        }
    }

    Component.onCompleted: {
        contentItem.grabToImage((result) => {
            result.saveToFile("comparison.png")
        })
    }
}

Committed on behalf of https://t.me/SergeiR

Downgrades incompatible (advanced) SVG features to something supported
by a default Qt SVG rendered. Besides, xlink:href is deprecated[1], and in
this case introduces an unnecessary indirection. Fixes these errors
causing the icon to be all black in Plasma and Qt apps:

qt.svg: icon.svg:27:6: Could not resolve property: #pattern1888
qt.svg: icon.svg:27:6: Could not resolve property: #pattern1870

Interestingly enough, logo.svg doesn't need any adjustments, it's fine.

[1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/xlink:href
@vandabbin
Copy link
Copy Markdown
Contributor

After a recent update on my system the icon no longer displays correctly in KDE so this fix is needed i think. I have tested with the new icon and it displays fine.

Screenshot_20260304_185510

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants