[Interest] Send Data to JavaScript

Jérôme Godbout godboutj at amotus.ca
Mon Apr 12 20:48:40 CEST 2021


Have you tried with a QVariantMap for your Q_PROPERTY instead? Will be dull to convert from QVAriant to list and string for each values, but will probably work.

Jérôme Godbout, B. Ing.

Software / Firmware Team Lead
O: (418) 682-3636 ext.: 114
C: (581) 777-0050
godboutj at dimonoff.com<mailto:godboutj at dimonoff.com>
[signature_487195805]<https://www.dimonoff.com/>
dimonoff.com<https://www.dimonoff.com/>
1015 Avenue Wilfrid-Pelletier,
Québec, QC G1W 0C4, 4e étage


From: Interest <interest-bounces at qt-project.org> on behalf of John Schneiderman <jschneiderman at gog.com>
Date: Monday, April 12, 2021 at 9:17 AM
To: qt qt <interest at qt-project.org>
Subject: [Interest] Send Data to JavaScript
I'm attempting to send data to the JavaScript side of the QWebEngine
code. This data is being emitted via a signal. The registration is
connected correctly as other components work just fine, though they're
emitting only a single int or QString.

An example of what I'm attempting is below:

class Demo : QObject

{

     Q_OBJECT

public:

         Q_PROPERTY(
             QMap<QString, QStringList> mappings
                 MEMBER mappings_
                 NOTIFY mappingsChanged
         )

};


What I'm expecting is that mappings would be transformed on the
JavaScript side as:

mappings {

     "key" : ["abc", "def"]...

}

However, when I try to view the data in the emitted signal it's always
null. Any suggestions where I should look for more answers or perhaps
I'm going in an incorrect direction?

Thanks,


--
John Schneiderman
Senior Software Engineer
CDPR Squad
GOG.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210412/e572abf6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 13927 bytes
Desc: image001.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210412/e572abf6/attachment-0001.png>


More information about the Interest mailing list