[SailfishDevel] Binding weirdness on Jolla device after deploy with screen locked

christopher.lamb at thurweb.ch christopher.lamb at thurweb.ch
Sun Jan 26 12:42:16 UTC 2014


Hi all

I have come across some weird behaviour on the Jolla:

Bindings don't seem to work immediately after an app has deployed when  
the screen is locked.

To demonstrate this I have created the code snippet at the end of this  
mail. To reproduce, create a default Sailfish project, paste the code  
into FirstPage.qml.

My code has:
1) an Item "dummy" with an enabled property bound to applicationActive.
2) a BackgroundItem with an enabled property bound to dummy.enabled
3) a Label in the BackgroundItem with with text property bound to  
dummy.enabled

When the app is active, the label should display "Correct Label"

However, if the app is deployed when the screen is locked, on  
unlocking and activating the app
the label text shows "Oops Wrong label" even though console.log output  
suggests that the text has changed to "Correct Label".

Also, when the backgroundItem is clicked, the highlight colour is not  
shown (but an onClicked event is generated).

The app behaves as expected (label correctly displayed, highlight  
colour shown) when:
a) The app is pushed to the left, and then reactivated,
b) The app is deployed while the screen is unlocked (immediately shown  
fullscreen),
c) The app is opened from the app icon direct on the Jolla,
d) The app is deployed to the Emulator.

Grüsse

Chris


//Start FirstPage.qml
import QtQuick 2.0
import Sailfish.Silica 1.0

Page {
     id: page

     Item {
         //represents a much more complex object (e.g. c++ plugin)
         //reduced to item here for demo purposes
         id: dummy
         enabled: applicationActive
         onEnabledChanged: console.log("QML dummy onEnabledChanged: "  
+ enabled);
     }

     BackgroundItem {
         enabled: dummy.enabled
         onEnabledChanged: console.log("QML BackgroundItem  
onEnabledChanged: " + enabled);
         width: parent.width
         height: 160
         anchors.horizontalCenter: parent.horizontalCenter
         anchors.verticalCenter: parent.verticalCenter
         Label {
             anchors.horizontalCenter: parent.horizontalCenter
             anchors.verticalCenter: parent.verticalCenter
             text: dummy.enabled ? "Correct Label" : "Oops! Wrong label"
             onTextChanged: console.log("QML text onTextChanged: " + text);
             color: Theme.primaryColor
         }
         onClicked:console.log("BackgroundItem clicked")
     }
}
//End FirstPage.qml



More information about the Devel mailing list