View Single Post
Old 01-08-2021, 10:05 AM   #56
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,893
Karma: 6120478
Join Date: Nov 2009
Device: many
Yes, QMetaType of Qt already defines a QVariant for QStringList, QVariantList and QList of Variants but does not define other basic QList or QVector types such as QList<int> and QList<double>.

In order to properly store and retrieve these from QVariant, their custom QMetaTypes must be created and registered so proper QVariant typing for introspection can be used by EmbeddedPython.

So when I wrote Sigil's EmbeddedPython I only supported the predefined QMetaTypes in mapping them to their equivalent python types. Since QVariantList can contain both lists of any type and therefore can hold and pass any structure data members even of mixed types, I did not add support for other non-predefined Qt types.

I will add and register a QMetaType for QList<int> and expand EmbeddedPython code to support it so your one line conversion of a QList of int to a single QVariant will work.

I will push those changes to Sigil master today.

Until them building a QVariant from a QVariantList is the way to go and should work even on older versions of Sigil.

Last edited by KevinH; 01-08-2021 at 10:08 AM.
KevinH is offline   Reply With Quote