[Development] QMetaType support for QFuture
Sona Kurazyan
sona.kurazyan at qt.io
Fri May 7 17:11:05 CEST 2021
Hi Arno,
You could use the QFutureInterfaceBase (non-templated) class directly to build a type-erased future, that's basically what QFuture is using underneath. Although it's internal (not documented and is considered to be private), but it's declared in a public header (qfutureinterface.h) and you can still use it. QFutureInterfaceBase's methods for accessing its internals are public (with a few exceptions that you probably won't need to use).
I hope that helps.
Best regards,
Sona
> -----Original Message-----
> From: Development <development-bounces at qt-project.org> On Behalf Of
> Arno Rehn
> Sent: Friday, May 7, 2021 4:07 PM
> To: Qt development mailing list <development at qt-project.org>
> Subject: [Development] QMetaType support for QFuture
>
> Hey everyone,
>
> I'm currently working on making QFuture return types work transparently in
> QtWebChannel. For remote clients, method return values are received
> asynchronously via callbacks anyway.
>
> However, QFuture introspection is not supported by the meta-type (yet) and
> there's no other way to register a generic QVariant-based continuation for
> "any" QFuture. All implementation details are private or protected and only
> some friend classes have access.
>
> I was wondering if I should add a local "workaround" to QWebChannel only
> (like QWebChannel::registerFutureType<int>() to support QFuture<int>) or
> if I should push something more general to QtCore. Maybe just some
> additional private API that supports the necessary private member access?
>
> Looking forward to some feedback.
>
> Regards,
> Arno
>
> --
> Arno Rehn
> Tel +49 89 189 166 0
> Fax +49 89 189 166 111
> a.rehn at menlosystems.com
> www.menlosystems.com
>
> Menlo Systems GmbH
> Bunsenstrasse 5, D-82152 Martinsried, Germany Amtsgericht München HRB
> 138145
> Geschäftsführung: Dr. Michael Mei, Dr. Ronald Holzwarth USt.-IdNr.
> DE217772017, St.-Nr. 14316170324
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development
More information about the Development
mailing list