Dynamic invokation of page1.qml, page2.qml using Loader. How to set a property of the invoked page conditionally?



  • I've main.qml, page1.qml, & page2.qml files. mail.qml is the default page getting loaded from main.cpp. Basing some condition, I'm able to load page1.qml OR page2.qml using Loader.

    page1.qml has 2 properties and page2.qml DOES NOT have any properties. I would like to set the property values from main.qml only when the loaded file is page1.qml. Generic statement "componentLoader.item["selectedBrandId"] = selBrandId;" is throwing ERROR "Cannot assign to non-existent property" when page2.qml is dynamically loaded when condition is met, as there are no properties in page2.qml.

    How to fetch the details viz., Id etc. of loaded page in order to proceed with property settings?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.