fix(StatusLoadingIndicator): make StatusLoadingIndicator use Animator

TLDR: the `StatusLoadingIndicator` will be able to continue the
(rotating) animation eventhough the app might be stuck as
`RotationAnimator` runs on the render thread

- make `StatusIcon` use internally `ColorImage` component which makes it
possible to recolor `Image` on the fly w/o the need to use
`QtGraphicalEffects` module and a separate color layer
- which in turn enables us to use `StatusIcon` with the
`RotationAnimator`
- one minor drawback though, we can no longer use the versioned
properties like `mipmap` with `StatusIcon`; not a big deal as we use
this with SVGs only

Fixes #10014
This commit is contained in:
Lukáš Tinkl 2024-05-02 20:48:06 +02:00 committed by Lukáš Tinkl
parent 688238fdd3
commit ac9a240e25
7 changed files with 17 additions and 30 deletions

View File

@ -255,7 +255,6 @@ Rectangle {
Layout.alignment: Qt.AlignTop | Qt.AlignRight
Layout.preferredHeight: 16
Layout.preferredWidth: 16
mipmap: true
}
}
RowLayout {

View File

@ -44,11 +44,10 @@ GroupBox {
StatusIcon {
sourceSize.width: width || undefined
sourceSize.height: height || undefined
mipmap: true
antialiasing: true
width: root.iconSize
height: width
source: root.icon
icon: root.icon
color: enabled ? "transparent" : Theme.palette.baseColor1
}

View File

@ -1,18 +1,20 @@
import QtQuick 2.13
import QtQuick 2.15
import StatusQ.Core 0.1
StatusIcon {
id: statusIcon
id: root
icon: "loading"
height: 17
width: 17
RotationAnimation {
target: statusIcon;
from: 0;
to: 360;
height: 20
width: 20
RotationAnimator {
target: root
from: 0
to: 360
duration: 1200
running: visible
loops: Animation.Infinite
}
}

View File

@ -78,7 +78,6 @@ Loader {
StatusIcon {
icon: "refresh"
color: Theme.palette.directColor1
mipmap: false
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor

View File

@ -1,11 +1,10 @@
import QtQuick 2.13
import QtGraphicalEffects 1.13
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Controls.impl 2.15 // for ColorImage
Image {
ColorImage {
property string icon: ""
property color color: "transparent"
id: statusIcon
width: 24
height: 24
// SVGs must have sourceSize, PNGs not; otherwise blurry
@ -22,11 +21,4 @@ Image {
objectName = icon + "-icon"
}
}
layer.smooth: true
layer.format: ShaderEffectSource.RGBA
layer.enabled: !Qt.colorEqual(statusIcon.color, "transparent")
layer.effect: ColorOverlay {
color: statusIcon.color
}
}

View File

@ -79,8 +79,6 @@ StatusComboBox {
Layout.preferredWidth: d.iconSize
Layout.preferredHeight: d.iconSize
mipmap: true
}
CustomText {

View File

@ -315,9 +315,7 @@ StatusListView {
ButtonGroup.group: d.airdropGroup
anchors.verticalCenter: parent.verticalCenter
icon.name: "airdrop"
icon.color: hovered ? Theme.palette.primaryColor3 :
checked ? Theme.palette.primaryColor1
: disabledTextColor
icon.color: checked ? Theme.palette.primaryColor1 : disabledTextColor
checkable: true
checked: {
const obj = root.selectedSharedAddressesMap.get(listItem.address)