0

I am currently working on this topic: http://doc.qt.io/qt-5/qtwebkit-bridge.html

I have a C++ class that maps a Javascript object and I want my C++ function to return any Javascript data types, such as object, array, string, number etc.

What's the corresponding Qt data types to JS data types?

e.g. (I don't know if this mapping is correct)

Javascript data type                 Qt data type

string                                QString
array                                 QList, QVariantList
.....

I just want to know how the data type maps to each other.

2
  • 1
    I'm not sure how much attention did you pay to the documentation you cited, but all you need is there: doc.qt.nokia.com/4.7-snapshot/qtwebkit-bridge.html#data-types. Commented Nov 28, 2010 at 16:32
  • Thanks for the reminding. I've tried several qt types, such as QObjectList and QVariantList, but seemed the javascript engine couldn't recognize them Commented Nov 28, 2010 at 23:16

1 Answer 1

1

You might find some clues here:

http://doc.qt.io/qt-5/qscriptvalue.html

Sign up to request clarification or add additional context in comments.

2 Comments

As of Qt 4.7, QtScript doesn't have anything to do with the JavaScript <-> Qt bridge that's available in QtWebKit.
True, but it is still based on the same idea and core tech, which is QVariant.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.