Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] BlackBerry 10 - Error QML " Expected token `;’ "
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] BlackBerry 10 - Error QML " Expected token `;’ "

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 3.3k 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 don't know the problem because some tutorial of Qt using this simple method to write a dinamic string:

    QML is a simple container:
    @
    Container {
    id: meteoGiornaliero
    preferredHeight: 75
    background: Color.Blue

    Label { 
        text: interface.interfacciaMeteoLocale("dnksandjksa") // error Expected token `;' 
        textStyle.color: Color.White
    }  
    

    }
    @

    in my Cpp i register class like this

    @ QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    AbstractPane *root = qml->createRootObject<AbstractPane>();
    // set created root object as a scene
    appl->setScene(root);
    cout << "Lancio Parsing"<< endl;

    // QmlDocument *qmlList = QmlDocument::create("asset:///MeteoGiornaliero.qml").parent(this);
    qml->setContextProperty("interface", InterfacciaDataModel::instance());@

    the class InterfacciaDataModel is correct because the method declarated whit macro Q_INVOKABLE

    @

    class InterfacciaDataModel: public QObject {
    Q_OBJECT
    public:
    static InterfacciaDataModel* instance();
    virtual ~InterfacciaDataModel();
    MeteoLocale* mappaMeteo;
    QList<MeteoLocale*> calListaInteressata(QString path);

    Q_INVOKABLE QString interfacciaMeteoLocale(QString path);

    private :
    static InterfacciaDataModel* s_instance;
    InterfacciaDataModel();
    };
    @

    this error is very unusually because the error is not for sintax error, the IDE when building can't know the Interface and can't know if existing a problem.

    i think that the problem is some import or sonting like this... anyone can help me???

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

      Solved whit this:
      @
      qml->setContextProperty("Interface", InterfacciaDataModel::instance()); @

      and then i have use First caps letter!!

      1 Reply Last reply
      0
      • B Offline
        B Offline
        BelenMuñoz
        wrote on last edited by
        #3

        I've had errors like those when something is not right in any header file included.

        Hope it helps you.

        Me casé con un enano pa jartarme de reí.

        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