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.alignment: Qt.AlignTop | Qt.AlignRight
Layout.preferredHeight: 16 Layout.preferredHeight: 16
Layout.preferredWidth: 16 Layout.preferredWidth: 16
mipmap: true
} }
} }
RowLayout { RowLayout {

View File

@ -44,11 +44,10 @@ GroupBox {
StatusIcon { StatusIcon {
sourceSize.width: width || undefined sourceSize.width: width || undefined
sourceSize.height: height || undefined sourceSize.height: height || undefined
mipmap: true
antialiasing: true antialiasing: true
width: root.iconSize width: root.iconSize
height: width height: width
source: root.icon icon: root.icon
color: enabled ? "transparent" : Theme.palette.baseColor1 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 import StatusQ.Core 0.1
StatusIcon { StatusIcon {
id: statusIcon id: root
icon: "loading" icon: "loading"
height: 17 height: 20
width: 17 width: 20
RotationAnimation {
target: statusIcon; RotationAnimator {
from: 0; target: root
to: 360; from: 0
to: 360
duration: 1200 duration: 1200
running: visible running: visible
loops: Animation.Infinite loops: Animation.Infinite
} }
} }

View File

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

View File

@ -1,11 +1,10 @@
import QtQuick 2.13 import QtQuick 2.15
import QtGraphicalEffects 1.13 import QtQuick.Controls 2.15
import QtQuick.Controls.impl 2.15 // for ColorImage
Image { ColorImage {
property string icon: "" property string icon: ""
property color color: "transparent"
id: statusIcon
width: 24 width: 24
height: 24 height: 24
// SVGs must have sourceSize, PNGs not; otherwise blurry // SVGs must have sourceSize, PNGs not; otherwise blurry
@ -22,11 +21,4 @@ Image {
objectName = icon + "-icon" 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.preferredWidth: d.iconSize
Layout.preferredHeight: d.iconSize Layout.preferredHeight: d.iconSize
mipmap: true
} }
CustomText { CustomText {

View File

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