[Interest] using a custom class as parameter of signal/slot, used in QML

Sylvain Pointeau sylvain.pointeau at gmail.com
Fri Mar 1 22:46:28 CET 2019


On Fri, Mar 1, 2019 at 10:29 PM Jérôme Godbout <godboutj at amotus.ca> wrote:

> Why is the struct deleted one the signal is finished? You create a
> structure only for the signal? it’s not an object or data that will outlive
> that call in the end? If so, you really need to make a copiable
> representation of the struct.
>

Yes it is just an object created for the time of the signal, to avoid
having 5 parameters to my signal.


>
>
> What kind of data live into your struct? are they all basic type or
> pointer? or do you have QObject into it?
>
> QVariantMap seem like an easy way out.
>

it is (for now) just integers, I just tried QVariantMap (just after my
previous email), I find it good enough, I will stay with this I think.


> JSON serialization or even better QDataStream (which is really fast
> compare to JSON) could help you do it. You could do an operator<<() and
> operator>>() with QDataStream on your struct to do it. QByteArray are
> copiable.
>
>
>
> If you can provide more information about your struct data that could help.
>

it is just basic data for now.

But I would really wish that Qt could do that for us so I can just keep on
using my structure.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190301/6a9ba775/attachment.html>


More information about the Interest mailing list