[quote author="mlong" date="1314218770"]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.
[/quote]
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:
@ QSettings settings("/home/test/Documents/Wave/signalgenerator.ini", QSettings::IniFormat);
qDebug() << settings.allKeys();//qdebug
settings.beginGroup("values");
const QStringList childKeys = settings.childKeys();
QHash<QString, QString> values;
foreach (const QString &childKey, childKeys) {
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) :
@QSettings settings("/home/test/Documents/Wave/signalgenerator.ini", QSettings::IniFormat);
settings.beginGroup("values");
const QStringList childKeys = settings.childKeys();
QHash<QString, QString> values;
foreach (const QString &childKey, childKeys) {
values.insert(childKey, settings.value(childKey).toString());
if (childKey.toInt() == ui->comboBox->currentIndex()+1) {calfactor = settings.value(childKey).toFloat();}
}
settings.endGroup();@