Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QML not show string that return from Q_INVOKABLE method
Forum Updated to NodeBB v4.3 + New Features

QML not show string that return from Q_INVOKABLE method

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vetryaspa
    wrote on last edited by
    #1

    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.0

    TabbedPane {
    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.0

    Container {
    background: Color.Cyan
    Label {
    text: Interface.interfacciaMeteoLocale("test") // this call run correctly
    }
    ListView {
    id: listViewLocale

        listItemComponents: [
            ListItemComponent {
                id: listComponent
                type: "listItem"
                MeteoGiornaliero {
                }
            }
        ]
        dataModel: ArrayDataModel {
            id: arrayMeteoGiornaliero
            objectName: "arrayMeteoGiornaliero"
        }
        
        function itemType(data, indexPath) {
                return "listItem";
            }
    }
    

    }
    @

    MeteoGiornaliero.qml
    @import bb.cascades 1.0

    Container {
    id: meteoGiornaliero
    background: Color.Blue

    Label { 
        text: Interface.interfacciaMeteoLocale("dnksandjksa") // this call not run 
        textStyle.color: Color.White
    }  
    

    }@

    why in MeteoGiornaliero not run this method

    1 Reply Last reply
    0
    • V Offline
      V Offline
      Vetryaspa
      wrote on last edited by
      #2

      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: listViewLocale

          listItemComponents: [
              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?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved