Am 10.05.2021 um 10:04 schrieb Fabian Kosmale:
Regarding the API: I think the most common pattern in Qt would be to
add a static get method to the private class.
@Arno: But would that accessor actually be enough for you? As in, do
you know in your case that the QVariant contains a QFuture? If you
get a generic QVariant instead, you may still need a way to detect
that the contained type is in fact a QFuture (though QMetaType::name
might be enough in that case).
Yep, I was thinking of just checking QMetaType::name().
Still, getting this right without relying on UB will be more work than I
expected.
Suppose the QVariant contains a QFuture<int>. How would I generically
extract the QFuture<T> to then call QFuturePrivate::get() on it?
One way to possibly be to convert this unconditionally to a
QFuture<void>, but then QVariant needs to generically know about QFuture
conversion operators/constructors. All doable, but this is going to be
my first "deep dive" into QtCore internals :-)
Regards,
Arno
--
Arno Rehn
Tel +49 89 189 166 0
Fax +49 89 189 166 111
a.r...@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@qt-project.org
https://lists.qt-project.org/listinfo/development