[SailfishDevel] QML Loader: unloading problem
markotor at ovi.com
markotor at ovi.com
Tue Oct 1 14:24:32 UTC 2013
Hi,
I get the following error when I set empty string to (Loader) source property immediately after receiving rejected/accepted signal from earlier loaded dialog. If I delay unloading for a while then it's working ok. Am I doing something wrong or how could I check when it's ok to unload the dialog?
file:///usr/lib/qt5/qml/Sailfish/Silica/private/PageStackIndicator.qml:139: TypeError: Cannot read property '_forwardDestination' of null
Here is simple code I was using ...
FirstPage.qml
Page {
id: page
...
Button {
id: test
text: "Click here"
onClicked: {
if(loaderTest.status === Loader.Null) {
loaderTest.source = "TestDialog.qml"
}
else
{
if(loaderTest.status === Loader.Ready)
{
loaderTest.source = "" // after 'accept' case, this works ok.
}
}
}
}
Loader { // test loader
id: loaderTest
onLoaded: console.log("QML: loaded")
onStatusChanged: console.log("QML: loader status " + status)
}
Connections {
target: loaderTest.item
onAccepted: {
console.log("QML: OK")
//loaderTest.source = "" // unload later
}
onRejected: {
console.log("QML: NOK")
loaderTest.source = "" // unload -> generates error
}
}
...
TestDialog.qml:
Dialog // nothing special here, Sailfish dialog
{
id: tD
DialogHeader {
id: dialogHeader
dialog: tD
title: "Title..."
}
Rectangle {
id: rec
anchors.centerIn: parent
width: parent.width
height: 50
color: "black"
Text {
id: testing
anchors.centerIn: rec
color: Theme.secondaryHighlightColor
font.pixelSize: Theme.fontSizeLarge
text: "Here we are..."
}
}
Component.onCompleted: tD.open()
}
Br,
Marko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20131001/4a0544ed/attachment.html>
More information about the Devel
mailing list