×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    89

    How to export a C++ method to QML?

    I write a c++ extension to QML.

    Now the property "name" can be referenced in QML/JS file.

    But how can I make the method "void abc()" also available in QML/JS file?

    Currently, the error note is:
    logic.js:30: TypeError: Result of expression 'filereader.abc' [undefined] is not a function.

    Code:
    class FileReader: public QObject
    {
        Q_OBJECT
        Q_PROPERTY(QString name READ name WRITE setName )
        Q_PROPERTY(int counter READ counter)
      
    public:
        FileReader(QObject* parent = 0);
        
        QString name();
        int counter();
    
        void setName(QString str);
    
        void abc();
    private:
        QString m_name;
        int     m_counter;
    }

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: How to export a C++ method to QML?


  3. #3
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    89

    Re: How to export a C++ method to QML?

    Thanks.All exist is in QObject document

    They should put them together with that example demos export "property" method.

Similar Threads

  1. How to call/load another QML file from QML ?
    By cadlg in forum [Archived] Qt Quick
    Replies: 5
    Last Post: 2011-07-28, 09:15
  2. How to debug qml app to nokia n97
    By Supernova746 in forum [Archived] Beginning Qt
    Replies: 1
    Last Post: 2011-03-14, 20:57
  3. How to export files in bld.inf to specific location?
    By AshramArzephucque in forum Symbian
    Replies: 1
    Last Post: 2008-01-09, 09:17
  4. How to export Notes files to PC
    By gbuico in forum Symbian
    Replies: 0
    Last Post: 2003-04-01, 17:18

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×