Details
-
Bug
-
Resolution: Fixed
-
P4: Low
-
5.15, 6.8
-
None
-
e8e818df9 (dev), 450fdee83 (6.7), 9452e8d7d (6.6)
Description
Calling allKeys() beforehand makes it work:
#include <QCoreApplication> #include <QSettings> #include <QDebug> #include <QFile> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); const QString settingsFilePath = QString::fromUtf8(APP_SOURCE_DIR) + "/settings.conf"; if (!QFile::exists(settingsFilePath)) { qWarning() << settingsFilePath << "doesn't exist"; return 1; } qDebug() << "Found settings file at" << settingsFilePath; QSettings settings(settingsFilePath, QSettings::IniFormat); settings.beginGroup("Material"); // This makes it work: // qDebug() << "allKeys" << settings.allKeys(); const QByteArray themeValue = settings.value("Theme").toByteArray(); qDebug() << "themeValue" << themeValue; return 0; }
The syntax in the INI file was taken from the comment here. I would think it should be ignored (since it has no values under it), rather than cause faulty behaviour:
[Controls] Style=ResourceStyle FallbackStyle=Material [Material] Theme=Dark [Material\Font]
Attachments
For Gerrit Dashboard: QTBUG-121035 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
532118,3 | Doc & Test: fix syntax of QSettings sub-groups | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
532328,2 | Doc & Test: fix syntax of QSettings sub-groups | 6.7 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
532493,2 | Doc & Test: fix syntax of QSettings sub-groups | 6.6 | qt/qtdeclarative | Status: MERGED | +2 | 0 |