sddm-theme: fix missing images with Qt6

Qt6 defers the URL resolution to the component that actually uses the
property. Which means that the images are now resolved relatively to the
corresponding sddm component (Background, ComboBox) instead of a theme.
Work around that by pinning resource URLs to the theme path with
`Qt.resolvedUrl()`.

Fixes following error:
```
file:///usr/lib64/qt6/qml/SddmComponents/ComboBox.qml:105:9: QML Image: Cannot open: file:///usr/lib64/qt6/qml/SddmComponents/angle-down.png
```
This commit is contained in:
Aleksei Bavshin 2024-01-31 23:42:56 -08:00
commit e980f01b61
No known key found for this signature in database
GPG key ID: 4F071603387A382A

View file

@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (c) 2013 Abdurrahman AVCI <abdurrahmanavci@gmail.com>
* Copyright (c) 2024 Aleksei Bavshin <alebastr@fedoraproject.org>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@ -58,11 +59,12 @@ Rectangle {
Background {
anchors.fill: parent
source: config.background
source: Qt.resolvedUrl(config.background)
fillMode: Image.PreserveAspectCrop
onStatusChanged: {
if (status == Image.Error && source != config.defaultBackground) {
source = config.defaultBackground
var defaultBackground = Qt.resolvedUrl(config.defaultBackground)
if (status == Image.Error && source != defaultBackground) {
source = defaultBackground
}
}
}
@ -87,7 +89,7 @@ Rectangle {
width: Math.max(320, mainColumn.implicitWidth + 50)
height: Math.max(320, mainColumn.implicitHeight + 50)
source: "rectangle.png"
source: Qt.resolvedUrl("rectangle.png")
Column {
id: mainColumn
@ -186,7 +188,7 @@ Rectangle {
width: parent.width; height: 30
font.pixelSize: 14
arrowIcon: "angle-down.png"
arrowIcon: Qt.resolvedUrl("angle-down.png")
model: sessionModel
index: sessionModel.lastIndex
@ -215,7 +217,7 @@ Rectangle {
width: parent.width; height: 30
font.pixelSize: 14
arrowIcon: "angle-down.png"
arrowIcon: Qt.resolvedUrl("angle-down.png")
KeyNavigation.backtab: session; KeyNavigation.tab: loginButton
}