QML not show string that return from Q_INVOKABLE method
-
i have a problem whit QML:
in my situation i have 3 level of QML:
main.qlm-> ListMeteoLocale.qml ->MeteoGiornaliero.qml
inside this i invoke a cpp class for set a label text whit this method @Interface.interfacciaMeteoLocale("test")@
inside "ListMeteoLocale" run correctly but not in "MeteoGiornaliero"
where is the problem?
main.qml
@// Tabbed Pane project template
import bb.cascades 1.0TabbedPane {
Tab {
title: qsTr("Home")
NavigationPane {
id: naviHome
Page {
ListMeteoLocale {} } } } onCreationCompleted: { // this slot is called when declarative scene is created // write post creation initialization here console.log("TabbedPane - onCreationCompleted()") // enable layout to adapt to the device rotation // don't forget to enable screen rotation in bar-bescriptor.xml (Application->Orientation->Auto-orient) OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All; } showTabsOnActionBar: true
}
@ListMeteoLocale.qml
@import bb.cascades 1.0Container {
background: Color.Cyan
Label {
text: Interface.interfacciaMeteoLocale("test") // this call run correctly
}
ListView {
id: listViewLocalelistItemComponents: [ ListItemComponent { id: listComponent type: "listItem" MeteoGiornaliero { } } ] dataModel: ArrayDataModel { id: arrayMeteoGiornaliero objectName: "arrayMeteoGiornaliero" } function itemType(data, indexPath) { return "listItem"; } }
}
@MeteoGiornaliero.qml
@import bb.cascades 1.0Container {
id: meteoGiornaliero
background: Color.BlueLabel { text: Interface.interfacciaMeteoLocale("dnksandjksa") // this call not run textStyle.color: Color.White }
}@
why in MeteoGiornaliero not run this method
-
trying to found a solution i have discover that if i modify ListMeteoLocale.qml like this:
@import bb.cascades 1.0
Container {
background: Color.Cyan
Label {
text: Interface.interfacciaMeteoLocale("test")
}
MeteoGiornaliero {
// here the label was write correctly
}
ListView {
id: listViewLocalelistItemComponents: [ ListItemComponent { id: listComponent type: "listItem" MeteoGiornaliero { //here not run } } ] dataModel: ArrayDataModel { id: arrayMeteoGiornaliero objectName: "arrayMeteoGiornaliero" } function itemType(data, indexPath) { return "listItem"; } }
}@
I can see that the List was Created. Maybe The problem is the list?