QSettings settings("MyCompany", "MyApp"); settings.beginGroup("Window"); settings.setValue("Position", QPoint(100, 100)); settings.setValue("Size", QSize(800, 600)); settings.endGroup();
QSettings settings("MyCompany", "MyApp"); QStringList keys = settings.allKeys(); foreach (const QString& key, keys) { if (key.startsWith("User/")) { QString value = settings.value(key).toString(); qDebug() << key << "=" << value; } }This code reads all the keys in the settings file for "MyApp" that start with the prefix "User/" and prints out their values to the console. It uses the method QSettings::allKeys() to get a list of all the keys in the settings file, and then filters them with a QString::startsWith() method to find only the ones that start with "User/". Package library: Qt.