Вопрос

Using the QT Bridge:

myWebView->page()->mainFrame()->addToJavaScriptWindowObject("MyObj", myObjInstance);

myObj has a slot which returns raw data from a table in QList format, but the Javascript side does not understand the data type and returns:

"Error: cannot call myFunction(): unknown type `QList<QVariantMap>' "

I know the Qt Bridge can pass Qlists and QVariantMaps individually, is there a way to send a list of maps?

Это было полезно?

Решение

Instead of passing QList, I'm just passing the output as a QVariantList. Reading up on the documentation, it appears that Qt will sort out the conversions for only the most basic raw types, and QVariantList will accommodate the table structure I'm aiming for.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top