Verified Commit 31b70902 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

wallpapers/image: use string data type for `image` property

`wallpaper.configuration.Image` has string type, and assigning a string
value from QML to a url in C++ will truncate the string at the hash char.
This changes `image` data type to string to fix the bug.

BUG: 454692
FIXED-IN: 5.26
parent 930d3b2b
......@@ -16,7 +16,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore
QQC2.StackView {
id: root
readonly property string modelImage: imageWallpaper.modelImage
readonly property url modelImage: imageWallpaper.modelImage
readonly property int fillMode: wallpaper.configuration.FillMode
readonly property string configColor: wallpaper.configuration.Color
readonly property bool blur: wallpaper.configuration.Blur
......
......@@ -69,18 +69,18 @@ void ImageBackend::componentComplete()
}
}
QUrl ImageBackend::image() const
QString ImageBackend::image() const
{
return m_image;
return m_image.toString();
}
void ImageBackend::setImage(const QUrl &url)
void ImageBackend::setImage(const QString &url)
{
if (m_image == url || url.isEmpty()) {
if (m_image.toString() == url || url.isEmpty()) {
return;
}
m_image = url;
m_image = QUrl(url);
Q_EMIT imageChanged();
setSingleImage();
......
......@@ -41,7 +41,7 @@ class ImageBackend : public QObject, public QQmlParserStatus, public SortingMode
* Package path from the saved configuration, can be an image file, a url with
* "image://" scheme or a folder (KPackage).
*/
Q_PROPERTY(QUrl image READ image WRITE setImage NOTIFY imageChanged)
Q_PROPERTY(QString image READ image WRITE setImage NOTIFY imageChanged)
/**
* The real path of the image
* e.g. /home/kde/Pictures/image.png
......@@ -71,8 +71,8 @@ public:
explicit ImageBackend(QObject *parent = nullptr);
~ImageBackend() override;
QUrl image() const;
void setImage(const QUrl &url);
QString image() const;
void setImage(const QString &url);
QUrl modelImage() const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment