using .INI file[SOLVED]
Page |
3 |
To solve the kind of questions of why a snippet of code like you show us does not work as you expect it, please learn to use a debugger. Set a breakpoint at the top of your function, and then step through your function one line at a time. It allows you to follow the programs flow through your function, thus giving you insight in why it doesn’t work the way you expect it.
I would suspect, then, that your original problem wasn’t in reading the values from the ini format, but rather where you were setting the values to the boards themselves. I don’t think you had shared that code.
Thnks for all your help so far. You are right, my problem was setting the values to the boards. sorry. I had shared all the code i had for the problem. What I did was I modified this code:
- qDebug() << settings.allKeys();//qdebug
- settings.beginGroup("values");
- qDebug() << childKey << "->" << settings.value(childKey).toString();//qdebug
- values.insert(childKey, settings.value(childKey).toString());
- if (childKey.toInt() == 1) {
- calfactor = settings.value(childKey).toFloat();
- ui->comboBox->setItemData(0, calfactor);
- qDebug()<<"index:" << ui->comboBox->itemText(1)<<" value:"<<ui->comboBox->itemData(1);//qdebug
- }
- if (childKey.toInt() == 2) {
- calfactor = settings.value(childKey).toFloat();
- ui->comboBox->setItemData(1, calfactor);
- qDebug()<<"index:" << ui->comboBox->itemText(1)<<" value:"<<ui->comboBox->itemData(1);//qdebug
- }
- }
- settings.endGroup();
- qDebug() << "values hash:" << values;//qdebug
to get this one(which worked(but only if I put it under each onpushButton function) :
- settings.beginGroup("values");
- values.insert(childKey, settings.value(childKey).toString());
- if (childKey.toInt() == ui->comboBox->currentIndex()+1) {calfactor = settings.value(childKey).toFloat();}
- }
- settings.endGroup();
You must log in to post a reply. Not a member yet? Register here!


