From 09629985f7060d38421d4e00a8452de84c5bfd96 Mon Sep 17 00:00:00 2001 From: Noelia Date: Fri, 19 Jan 2024 12:40:26 +0100 Subject: [PATCH] feat(statusQ/StatusToastMessage): Added image component - Added new image component and specific related config parameters. - Fixed issue when there's no `linkUrl` but `actionRequired`. --- .../StatusQ/Components/StatusToastMessage.qml | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/ui/StatusQ/src/StatusQ/Components/StatusToastMessage.qml b/ui/StatusQ/src/StatusQ/Components/StatusToastMessage.qml index 3821761a72..1456f585a8 100644 --- a/ui/StatusQ/src/StatusQ/Components/StatusToastMessage.qml +++ b/ui/StatusQ/src/StatusQ/Components/StatusToastMessage.qml @@ -85,6 +85,24 @@ Control { height: 23 } + /*! + \qmlproperty string StatusToastMessage::image + This property holds an image source to be displayed in the ToastMessage. + */ + property string image: "" + + /*! + \qmlproperty real StatusToastMessage::imageSize + This property holds the imageSize of the image to be displayed in the ToastMessage. + */ + property int imageSize: 32 + + /*! + \qmlproperty real StatusToastMessage::imageRadius + This property holds the imageRadius of the image to be displayed in the ToastMessage. + */ + property real imageRadius: imageSize / 2 + /*! \qmlproperty int StatusToastMessage::type This property holds the type of the ToastMessage. Values are: @@ -280,8 +298,8 @@ Control { id: loader anchors.centerIn: parent sourceComponent: root.loading ? loadingInd : - root.icon.name != ""? statusIcon : - undefined + root.icon.name != "" ? statusIcon : + root.image !== "" ? statusImage : undefined Component { id: loadingInd @@ -299,6 +317,19 @@ Control { icon: root.icon.name } } + + Component { + id: statusImage + StatusRoundedImage { + anchors.centerIn: parent + radius: root.imageRadius + width: root.imageSize + height: root.imageSize + image.source: root.image + showLoadingIndicator: false + image.fillMode: Image.PreserveAspectCrop + } + } } } ColumnLayout { @@ -337,7 +368,8 @@ Control { height: visible ? implicitHeight : 0 font.pixelSize: 13 hoveredLinkColor: Theme.palette.primaryColor1 - text: "

%2

".arg(root.linkUrl).arg(root.secondaryText) + text: root.actionRequired ? "

%1

".arg(root.secondaryText) : + "

%2

".arg(root.linkUrl).arg(root.secondaryText) onLinkActivated: { root.linkActivated(link); }