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

Roland Hughes roland at logikalsolutions.com
Thu Mar 21 23:37:17 CET 2019


No.

I mean they can always define a copy constructor and assignment operator 
for their own class.

On 3/21/19 9:52 AM, Sylvain Pointeau wrote:
> Do you mean a copy / assignment of a QVariantMap to their classes?
> In the meantime, I also provided the answer that Q_GADGET was working 
> fine.
>
> On Thu, Mar 21, 2019 at 1:21 PM Roland Hughes 
> <roland at logikalsolutions.com <mailto:roland at logikalsolutions.com>> wrote:
>
>     One can define their own copy constructors and assignment
>     operators for
>     their own classes.
>
>     On 3/1/19 11:52 AM, interest-request at qt-project.org
>     <mailto:interest-request at qt-project.org> wrote:
>     > Since signal are not sync all the time but can be async, the
>     argument need to be copiable to allow this. So you need to be able
>     to copy the arguments on the signals. Therefore the QObject is not
>     copiable, they cannot be passed as arguments directly, you need a
>     pointer. The ownership and lifetime of that object is up to you,
>     but you need it to live until all handler have finish processing
>     the signal (this can be longer then the signal emit for queued
>     connection).
>     >
>     > If you can easily copy the structure you probably can
>     serialize/deserialize it or put it into a QVariant, QVariantList
>     or QVariantMap. That would be copiable.
>
>     -- 
>     Roland Hughes, President
>     Logikal Solutions
>     (630)-205-1593  (cell)
>     http://www.theminimumyouneedtoknow.com
>     http://www.infiniteexposure.net
>     http://www.johnsmith-book.com
>
-- 
Roland Hughes, President
Logikal Solutions
(630)-205-1593  (cell)
http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190321/08717a8f/attachment.html>


More information about the Interest mailing list