Developing for Android. QT 5.6.
I have a StackView in my main.qml to load each of my sub-pages on demand. It's elegant, and works flawlessly. All my bindings allow data propagation without issues.
However, I have some C++ code that updates the QML with the user's location via property bindings. I have an Image type on one QML page that has a Glow and PropertyAnimation. This page is loaded via the StackView on app startup.
Glow {
id: statusGlow
anchors.fill: statusImage
radius: 16
samples: 33
spread: 0.85
color: appWin.statusGlowColor
source: statusImage
visible: appWin.statusGlowVisible
opacity: appWin.statusGlowOpacity
}
PropertyAnimation {
id: statusAnimation
target: statusGlow
property: "opacity"
from: 100
to: 0
duration: 500
running: appWin.statusAnimationRunning
}
Image {
id: statusImage
anchors.fill: parent
fillMode: Image.PreserveAspectFit
antialiasing: true
source: "status.png"
sourceSize.width: 715
sourceSize.height: 1543
smooth: false
}
Glow {
id: statusGlow
anchors.fill: statusImage
radius: 16
samples: 33
spread: 0.85
color: appWin.statusGlowColor
source: statusImage
visible: appWin.statusGlowVisible
opacity: appWin.statusGlowOpacity
}
PropertyAnimation {
id: statusAnimation
target: statusGlow
property: "opacity"
from: 100
to: 0
duration: 500
running: appWin.statusAnimationRunning
}
Image {
id: statusImage
anchors.fill: parent
fillMode: Image.PreserveAspectFit
antialiasing: true
source: "status.png"
sourceSize.width: 715
sourceSize.height: 1543
smooth: false
}
To copy to clipboard, switch view to plain text mode
As you can see, I am connecting the properties of the Glow and PropertyAnimation to variables in my main.qml (appWin). The C++ code updates those variables and calls a function in main.qml to 'enable' the Glow and PropertyAnimation:
function gpsUpdate2() {
if( !runningBackground ) {
statusGlowColor = "yellow";
statusGlowOpacity = 100;
statusGlowVisible = true;
statusAnimationRunning = true;
}
}
function gpsUpdate2() {
if( !runningBackground ) {
statusGlowColor = "yellow";
statusGlowOpacity = 100;
statusGlowVisible = true;
statusAnimationRunning = true;
}
}
To copy to clipboard, switch view to plain text mode
Problem is, this only works the FIRST time that 'gpsUpdate2' is called. On subsequent calls to 'gpsUpdate2', the Glow does not appear...Why?
Bookmarks