QSettings settings("MyCompany", "MyApp"); settings.beginWriteArray("MyArray"); for(int i=0; i<10; i++){ settings.setArrayIndex(i); settings.setValue("MyInt", i); } settings.endArray();
QSettings settings("MyCompany", "MyApp"); QStringList myStrings; int size = settings.beginReadArray("MyArray"); for(int i=0; iIn this example, we create a QSettings object for our application and use the beginReadArray method to indicate we are beginning to read an array. We then retrieve the size of the array using the return value of beginReadArray and use a for loop and the setArrayIndex method to read each string value from the array. Finally, we call the endArray method to signal the end of the array. Package library: Qt