[Interest] [Qt6] Inject a QML enum from C++ at runtime

Ulf Hermann ulf.hermann at qt.io
Thu Jan 20 16:13:20 CET 2022


> Well, the number of names isn't fixed is the point - they're loaded at 
> runtime and will change (increase) from time to time.

Then an enumerator won't really help you. The point of an enumerator is 
that each entry is a constant.

If the names and values can change at runtime, you should use a 
QVariantMap or a JavaScript object.

If for each version of the program the set of names is fixed, and only 
the values change, then properties on a singleton are the better choice.

best regards,
Ulf


More information about the Interest mailing list