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

QSettings - default file location changed between Qt5 and Qt6 on Android

    XMLWordPrintable

Details

    • Android
    • beaaa0bf0 (dev), faf04010a (6.5), b49593c0c (6.6), 4195ec9ae (tqtc/lts-6.2)

    Description

      I am currently porting my app "OpenTodoList" from Qt5 to Qt6 (at this point: big kudos to everyone involved in Qt6; yes, there were some changes needed, but over all the migration was relatively smooth ).

      I noticed one "issue" (for this reason, I picked "bug" as issue type, feel free to change this to something else). Anyway: I am using QSettings to store some application data persistently. I noticed that on Android (and for now, this seems to be the only affected platform) the default file path for the settings have changed.

      I create the QSettings object like this:

      ApplicationSettings::ApplicationSettings(...)
          : QObject(parent),
            m_settings(new QSettings(QSettings::IniFormat, QSettings::UserScope,
                                     QCoreApplication::organizationName(),
                                     QCoreApplication::applicationName(), this)),
      

      With Qt5, this yielde the following settings file path:

      /data/user/0/net.rpdev.opentodolist/files/.config/RPdev/OpenTodoList.ini

      However, on Qt6, this yields

      /data/user/0/net.rpdev.opentodolist/files/settings/RPdev/OpenTodoList.ini
      

      I assume there were good reasons to change the default file path used on Android (and hence, reverting back is most likely not an option, especially as new, Qt6 based apps already might have been started that rely on the new location), however:

      1. I think it would be great if the documentation of the QSettings class would mention this change - I spent some time finding this issue; if there was a clear note that on Android - compared to Qt5 - the file locations changed, this might have helped quite a bit.
      2. I also think that the current documentation of the class is incorrect. For example, in the documentation of the QSettings::setPath() method's documentation, there is a table summarising the default locations per platform and format. For Unix (as there is no dedicated Android row) and IniFormat, it mentions that the default path is $HOME/.config, but in the case of Android it seems to be $HOME/settings. 

      Thanks for considering!

      Attachments

        Issue Links

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

          Activity

            People

              assam Assam Boudjelthia
              mhoeher Martin Höher
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: