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

Wrong enum value from QString using Qt 6

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.5.0, 6.6.0
    • 6.3.2, 6.4.1, 6.5.0 Beta2
    • Core: Other
    • Windows 10 Version 22H2 build 19045.2364
    • All
    • 66a1a71f1 (dev), 46f6a1066 (6.5)

    Description

      Hello!

      I want to report the critical issue with Qt 6. For example, I created this method to read the QSettings ini file.

      QVariant ManageProgram::loadSettings(QString group, QString property, QVariant defaultValue)
      {
          QSettings appSettings(APP_SETTINGS_PATH, QSettings::IniFormat);
          appSettings.beginGroup(group);
          QVariant valueVariant = appSettings.value(property, defaultValue);
          appSettings.endGroup();
          return valueVariant;
      }
      

      Then, I want to get the value from my enum: Connection::State

      Connection::State wlanConnectionState = ManageProgram::loadSettings("AppSettings", "WlanState", Connection::State::Unknown).value<Connection::State>();
      

      INI file:

      [AppSettings]
      WlanState=2
      

      The stored value is: 2 but it returns as 0 on Qt 6.3.2 & Qt 6.4.1, which breaks some of the features in my program. On Qt 5 this works well and returns the correct enum value: 2. Please, fix this issue. Thank you.

      Attachments

        Activity

          People

            chehrlic Christian Ehrlicher
            cobra91151 Ruslan Sydorvych
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: