On Tuesday 10 September 2024 06:08:34 GMT-7 Eirik Aavitsland via Development wrote: > > Thank you Aavit. Did already QFlags have the enum_type typedef in this > > commit? > > > > Another question: did QVariant in this commit already have userType()? > > You're welcome, Thiago! > No enum_type or userType or similar anywhere in src at this point, no.
Ok, so it looks like this code is legacy based on porting what Qt 3 did, before QVariant had the ability to store the enum_type itself. It looks like QMetaProperty::write() was kept using int for the Qt 4.x duration: https://github.com/qt/qt/blob/4.5/src/corelib/kernel/qmetaobject.cpp#L2167-L2183 Note how it converts from the enum's metatype ID to int too. That code is still there in 5.15: https://codebrowser.dev/qt5/qtbase/src/corelib/kernel/ qmetaobject.cpp.html#3237 For Qt 6, commit 46f407126ef3e94d59254012cdc34d6a4ad2faf2 changed the behaviour: - if the input QVariant is a QString and the metatype for the enum does not have an associated meta object, then we pass as int - otherwise, we convert to the enum's metatype Therefore, I conclude that creating ints and passing them to the qt_metacall is faulty behaviour we never fixed. That means: 1) I will fix moc to *not* manipulate int for property enum types, which means it will not use QFlag at all 2) I will not add QFlag64 3) I will make the QFlags constructor taking QFlag and the QFlag cast operator enable_if'ed on sizeof(QFlags) == sizeof(int) 4) I will not mark them or QFlag as deprecated Any objections? -- Thiago Macieira - thiago.macieira (AT) intel.com Principal Engineer - Intel DCAI Platform & System Engineering
smime.p7s
Description: S/MIME cryptographic signature
-- Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development