[solved]is it a correction
-
everybody,
in the docs for QSettings,
@
void QSettings::beginWriteArray ( const QString & prefix, int size = -1 )
@
Adds prefix to the current group and starts writing an array of size size. If size is -1 (the default), it is automatically determined based on the indexes of the entries written.
If you have many occurrences of a certain set of keys, you can use arrays to make your life easier. For example, let's suppose that you want to save a variable-length list of user names and passwords. You could then write:
@
struct Login {
QString userName;
QString password;
};
QList<Login> logins;
...QSettings settings;
settings.beginWriteArray("logins");
for (int i = 0; i < logins.size(); ++i) {
settings.setArrayIndex(i);
settings.setValue("userName", list.at(i).userName);
settings.setValue("password", list.at(i).password);
}
settings.endArray
@in the for loop is it list.at(i).userName?? or logins.at(i).userName
alfah
-
It should indeed be logins, not list.
Please either (in order of preference):
Fix in the source code in a Gitorious repository and request a merge for your fix, or
At least report it in "Jira":http://bugreports.qt.nokia.com so your fix will not be lost.
-
:-)
Go to the Qt sources from on "Gitorious":https://qt.gitorious.org/qt and create your own repository clone. Check out your own clone (you need to have Git for that), and find the sources for the QSettings class. The documentation you are looking for will be in the source file. Fix the mistake, and commit your changes (using Git, again). Then, do a merge request for your changes (button in Gitorious). Those are generally not picked up all that will, so best to then start bugging devs in the #qt-labs IRC channel to make someone there accept your changes :-)
Good luck!
Meanwhile, I have added your correction as a doc note for [[Doc:QSettings]].