How to use QSettings without removing other arrays?
-
So for example we have Mainwindow.conf, text inside:
@[General]
timeSlider=9
preview=true
random_images=false[listwidgetitem]
1\item=/home/citybong/Pictures/Graffiti/Graffiti(1).jpeg
2\item=/home/citybong/Pictures/Graffiti/Graffiti(2).jpg
3\item=/home/citybong/Pictures/Graffiti/Graffiti(3).jpeg
size=3
@When a user for example adds another item to listwidget we won't to change only [listwidgetitem] array and make the MainWindow.conf become :
@ [General]
timeSlider=9
preview=true
random_images=false[listwidgetitem] 1\item=/home/citybong/Pictures/Graffiti/Graffiti(1).jpeg 2\item=/home/citybong/Pictures/Graffiti/Graffiti(2).jpg 3\item=/home/citybong/Pictures/Graffiti/Graffiti(3).jpeg 4\item=another image path.jpeg size=4
@
instead of that it becomes:
@ [listwidgetitem]
1\item=/home/citybong/Pictures/Graffiti/Graffiti(1).jpeg
2\item=/home/citybong/Pictures/Graffiti/Graffiti(2).jpg
3\item=/home/citybong/Pictures/Graffiti/Graffiti(3).jpeg
4\item=another image path.jpeg
size=4@deleting completely the general array...
What am i doing wrong?@QSettings settings( "Wallch4", "MainWindow" );
settings.beginWriteArray("listwidgetitem");
int listwidget_count=ui->listWidget->count();
for (int i = 0; i < listwidget_count; ++i) {
settings.setArrayIndex(i);
settings.setValue("item", ui->listWidget->item(i)->text() );
}
settings.endArray();@