Hi, I have a problem writting and reading QSettings...
void clientGui::read_settings() {
tab_counter = settings.value("counter").toInt();
for(quint32 i=0;i<tab_counter;i++) {
tab_names.append(settings.value("tab"+tab_counter).toString());
}
}
void clientGui::write_settings() {
/* TODO: spremeni ti dve imeni v dejanski imeni: ime_firme : ime_programa */
/* counter - number of additional tabs */
settings.setValue("counter", tab_counter);
/* save the schema names */
settings.setValue("tab"+tab_counter, tab_name);
}
void clientGui
::change_settings(QString name,
bool read_write
) {
/* i++ the counter - add one new tab */
if(read_write) {
tab_counter += 1;
/* save the tab name */
settings.setValue("tab"+tab_counter, name);
}
else if(tab_counter > 0) {
tab_counter -= 1;
/* remove the name */
settings.remove(name);
}
/* save the counter */
settings.setValue("counter", tab_counter);
}
void clientGui::read_settings() {
QSettings settings(COMPANY, PRODUCT);
tab_counter = settings.value("counter").toInt();
for(quint32 i=0;i<tab_counter;i++) {
tab_names.append(settings.value("tab"+tab_counter).toString());
}
}
void clientGui::write_settings() {
/* TODO: spremeni ti dve imeni v dejanski imeni: ime_firme : ime_programa */
QSettings settings(COMPANY, PRODUCT);
/* counter - number of additional tabs */
settings.setValue("counter", tab_counter);
/* save the schema names */
settings.setValue("tab"+tab_counter, tab_name);
}
void clientGui::change_settings(QString name, bool read_write) {
QSettings settings(COMPANY, PRODUCT);
/* i++ the counter - add one new tab */
if(read_write) {
tab_counter += 1;
/* save the tab name */
settings.setValue("tab"+tab_counter, name);
}
else if(tab_counter > 0) {
tab_counter -= 1;
/* remove the name */
settings.remove(name);
}
/* save the counter */
settings.setValue("counter", tab_counter);
}
To copy to clipboard, switch view to plain text mode
The problem is that my settings look like this:
[General]
ab=fadf
counter=0
b=erf
tab=
where it should look like this:
counter=0
tab0=X
tab1=X
tab2=X ... etc (where X is some name)
change_settings should add new tab[number] variable with a name...
What is the problem...any ideas?
Bookmarks