Details
-
Bug
-
Resolution: Duplicate
-
P1: Critical
-
None
-
5.10.1
-
None
Description
I found a regression in Qt 5.10 when using Loader.
I have an app with main window, containing some properties and a loader. Loader loads few app's screens.
ApplicationWindow {
id: mainwindow
visible: true
title: qsTr("Loader test")
property string backgroundSource : "qrc:/background1.png"
Loader {
id: loader
anchors.fill: parent
source: "qrc:/screen1.qml"
}
}
There is some code which I have to execute after loader changed its source. In this code I use properties of the main window. For example:
MouseArea {
id: area
anchors.fill: parent
onClicked: {
console.log('Button on screen 1 pressed')
console.log('Setting loader source')
loader.setSource('qrc:/screen2.qml')
console.log('Changing background')
mainwindow.backgroundSource = 'qrc:/background2.png'
console.log('Everything is ok')
}
}
Everything was ok up to Qt 5.10.0:
D libloader_test.so: qrc:/screen1.qml:31 (onClicked): qml: Button on screen 1 pressed
D libloader_test.so: qrc:/screen1.qml:32 (onClicked): qml: Setting loader source
D libloader_test.so: qrc:/screen1.qml:34 (onClicked): qml: Changing background
D libloader_test.so: qrc:/screen1.qml:36 (onClicked): qml: Everything is ok
But since Qt 5.10.1 I have this error:
D libloader_test.so: qrc:/screen1.qml:31 (onClicked): qml: Button on screen 1 pressed
D libloader_test.so: qrc:/screen1.qml:32 (onClicked): qml: Setting loader source
D libloader_test.so: qrc:/screen1.qml:34 (onClicked): qml: Changing background
W libloader_test.so: qrc:/screen1.qml:35 ((null)): qrc:/screen1.qml:35: ReferenceError: mainwindow is not defined
Attached small example with code to reproduce bug
Attachments
Issue Links
- is duplicated by
-
QTBUG-66822 Reference Error when looking up global context property
- Closed