0

My work Environment : Qt 5.8 MSVC2015 64bit, Windows 7 64 bit.

I am calling C++ method from java script successfully. But failed to get return value of C++ method in JavaScript. So I try to use Q_PROPERTY to get return value of C++ method in JavaScript code.

class ExportedObject : public QObject
{   
    Q_OBJECT
    Q_PROPERTY(QString myprop MEMBER m_buffer READ GetValue WRITE GetTile)

public:
    Q_INVOKABLE void GetTile(int row, int col, int level);
    Q_INVOKABLE QString GetValue();
    QString m_buffer;

It gives me below error :

error: C2660: 'ExportedObject::GetTile': function does not take 1 arguments

JavaScript Code :

var image =  window.interface.GetTile( row , col ,level);

Any clue what I am missing in Q_PROPERTY ?

Is their better option to get C++ return value in JavaScript?

Sandip
  • 51
  • 11

1 Answers1

0

I just found simple solution for it, No need of Q_PROPERTY :

window.interface.GetTile( row , col ,level, function(returnValue) {
    alert(returnValue);
});
Sandip
  • 51
  • 11