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

Problems while deserialization of QSettings

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Not Evaluated
    • None
    • 5.11.1
    • Core: Other
    • None
    • FC28
    • Linux/Wayland

    Description

      The attempt to persist a QList<QString> using the QSettings.setValue() method seems to work well, but after restarting the application, the attempt to deserialize gives the error message:

      QVariant::load: unknown user type with name QList<QString>

      persisting code:

      QSettings settings; 
       QList<QString> data {"first", "second", "third"};
       settings.setValue("sourceList", QVariant::fromValue(data));

      primitive types of objects are working well.

      I am porting an existing application written for macOS and Windows to Linux. On Windows and macOS it seems to work, but I cannot verify this.

      After analyzing the existing code, I identified, that a registration of an stream operator, before the QApplication is instantiated, solves the problem.

      qRegisterMetaTypeStreamOperators<QList<QString>>("Data");
      QApplication a(argc, argv);

      Why this seems not to be necessary on non linux environment is not clear to me.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            pulsar07 Rainer Stransky
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes