feat(StatusRoundedImage): add loading indicator option

Closes #56
This commit is contained in:
B.Melnik 2021-05-27 14:44:51 +03:00 committed by Michał Cieślak
parent 106936a930
commit 4b9f996d06
2 changed files with 18 additions and 11 deletions

View File

@ -5,6 +5,9 @@ import StatusQ.Core.Theme 0.1
Rectangle {
id: statusRoundImage
property bool showLoadingIndicator: false
property alias image: image
implicitWidth: 40
@ -28,4 +31,15 @@ Rectangle {
fillMode: Image.PreserveAspectFit
cache: true
}
Loader {
id: itemSelector
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
active: showLoadingIndicator && image.status === Image.Loading
sourceComponent: StatusLoadingIndicator {
color: Theme.palette.directColor6
}
}
}

View File

@ -45,24 +45,17 @@ TabButton {
height: 28
StatusRoundedImage {
id: statusRoundImage
showLoadingIndicator: true
width: parent.width
height: parent.height
image.source: icon.source
}
Loader {
sourceComponent: {
switch (statusRoundImage.image.status) {
case Image.Loading:
return statusLoadingIndicator
break;
case Image.Error:
return letterIdenticon
break;
}
}
sourceComponent:letterIdenticon
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
active: statusRoundImage.image.status === Image.Loading || statusRoundImage.image.status === Image.Error
active: statusRoundImage.image.status === Image.Error
}
Component {