diff --git a/components/AnimLoader.qml b/components/AnimLoader.qml new file mode 100644 index 00000000..343dfa12 --- /dev/null +++ b/components/AnimLoader.qml @@ -0,0 +1,40 @@ +import QtQuick + +Loader { + id: root + + property Component sourceComp + property bool isComplete + + asynchronous: true + Component.onCompleted: { + isComplete = true; + sourceComponent = sourceComp; + } + onSourceCompChanged: { + if (isComplete) + anim.restart(); + } + + SequentialAnimation { + id: anim + + running: false + + Anim { + target: root + property: "opacity" + to: 0 + type: Anim.FastEffects + } + ScriptAction { + script: root.sourceComponent = root.sourceComp + } + Anim { + target: root + property: "opacity" + to: 1 + type: Anim.DefaultEffects + } + } +} diff --git a/modules/nexus/pages/NetworkPage.qml b/modules/nexus/pages/NetworkPage.qml index 219266b3..f32b854b 100644 --- a/modules/nexus/pages/NetworkPage.qml +++ b/modules/nexus/pages/NetworkPage.qml @@ -169,8 +169,6 @@ PageBase { id: network required property Nmcli.AccessPoint modelData - readonly property Component rightComp: Nmcli.connectingSsid() === modelData.ssid ? loadingComp : iconComp - property bool isComplete property bool currentSelected property real textOpacity: disabled ? 0.5 : 1 @@ -190,12 +188,6 @@ PageBase { } } - Component.onCompleted: isComplete = true - onRightCompChanged: { - if (isComplete) - rightCompAnim.restart(); - } - Behavior on textOpacity { Anim { type: Anim.DefaultEffects @@ -220,28 +212,6 @@ PageBase { target: root } - SequentialAnimation { - id: rightCompAnim - - running: false - - Anim { - target: rightLoader - property: "opacity" - to: 0 - type: Anim.FastEffects - } - ScriptAction { - script: rightLoader.sourceComponent = network.rightComp - } - Anim { - target: rightLoader - property: "opacity" - to: 1 - type: Anim.DefaultEffects - } - } - RowLayout { id: networkLayout @@ -279,11 +249,8 @@ PageBase { } } - Loader { - id: rightLoader - - asynchronous: true - sourceComponent: iconComp + AnimLoader { + sourceComp: Nmcli.connectingSsid() === network.modelData.ssid ? loadingComp : iconComp Component { id: iconComp