Skip to content

Draft: Replaced Qt6 deprecated QMetaType::Type with QVariant::Type

Mladen Milinkovic requested to merge work/fix-qt6-deprecated into master

Fixes compiling code that defines QT_DISABLE_DEPRECATED_BEFORE=0x60000

This likely is not good way to solve this just wanted to bring it up. This is a quick hack.

Replacing QVariant::Type with QMetaType::Type doesn't work (apart that it breaks API) as QVariant(QMetaType::Type) is deleted in Qt6:

    // QVariant::Type is marked as \obsolete, but we don't want to
    // provide a constructor from its intended replacement,
    // QMetaType::Type, instead, because the idea behind these
    // constructors is flawed in the first place. But we also don't
    // want QVariant(QMetaType::String) to compile and falsely be an
    // int variant, so delete this constructor:
    QVariant(QMetaType::Type) = delete;

QVariant(QVariant::Type) is called at least here in kservicetype.cpp:

Merge request reports