开发者

Qt and JavaScript mapping data

开发者 https://www.devze.com 2023-04-05 00:55 出处:网络
What is the correct way to map Qt data types in JavaScript. I pass a Qt object to JavaScript that I load in the QWebView control. It\'s not a problem to call an object method from JavaScript if there\

What is the correct way to map Qt data types in JavaScript. I pass a Qt object to JavaScript that I load in the QWebView control. It's not a problem to call an object method from JavaScript if there's no parameters buf if a method has parameters the code doesn't work. For example I have the structure Location:

struct Location
{
    QString country;
    QString city;
};

I have the method:

void UpdateLocation(const Location& loc开发者_StackOverflowation);

How to call this method from JavaScript?


How to call this method from JavaScript?

Location should inherit from QObject

struct Location : pubilc QObject {
Q_OBJECT

0

精彩评论

暂无评论...
验证码 换一张
取 消