Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-96916

Qt 6 breaks compatibility of QVariant streaming into QDataStream

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 6.2.3, 6.3.0 Alpha
    • 6.0, 6.1.0, 6.2.0 Beta4
    • Core: I/O
    • None
    • All
    • 46dc8e453a (qt/qtbase/dev) 46dc8e453a (qt/tqtc-qtbase/dev) f3842c09b7 (qt/qtbase/6.2) 4263ea6169 (qt/qtbase/6.3) f3842c09b7 (qt/tqtc-qtbase/6.2) 4263ea6169 (qt/tqtc-qtbase/6.3)

    Description

      I have a complex QVariantMap data structure and serialize it to QDataStream in one shot as below:
      stream << map;

      Some values of the data structure are of type PairDouble, which is an alias for QPair<double, double>:
      using PairDouble = QPair<double, double>;
      Q_DECLARE_METATYPE(PairDouble);

      The problem I faced is that my app built with Qt5 and Qt6 produces mutually incompatible files, because the app built with Qt6 prints "QVariant::load: unknown user type with name PairDouble" and the app built with Qt5 outputs "QVariant::load: unknown user type with name std::pair<double,double>".

      I suppose that the problem is in making QPair an alias for std::pair (see https://bugreports.qt.io/browse/QTBUG-80309).

      Attachments

        1. main.cpp
          2 kB
        2. QPairStoreLoad.zip
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            fabiankosmale Fabian Kosmale
            nikolaj Nikolay Larin
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: