'Deprecation warning in Qt 6.2.3

I migrated my code from Qt 5.15 to Qt 6.2. I've figured out all of the major issues and everything is working correctly. I've almost figured out all of the warnings, except for one. My original code is

if (PhaseEncodeAngle == "") q3.bindValue(":PhaseEncodeAngle", QVariant(QVariant::Double)); /* for null values */
else q3.bindValue(":PhaseEncodeAngle", PhaseEncodeAngle);

which produces the warning

warning: ‘QVariant::QVariant(QVariant::Type)’ is deprecated: Use the constructor taking a QMetaType instead.

Applying the fix that Qt documentation suggests, the code becomes

if (PhaseEncodeAngle == "") q3.bindValue(":PhaseEncodeAngle", QVariant(QMetaType::Double)); /* for null values */
else q3.bindValue(":PhaseEncodeAngle", PhaseEncodeAngle);

but now this produces an error

error: use of deleted function ‘QVariant::QVariant(QMetaType::Type)’

How can I fix the original warning?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source