
Originally Posted by
high_flyer
define "nothing is happening".
Thanks for the reply.
With the following qDebug lines, im getting the expected output:
code:
QSettings settings
("/home/test/Documents/Wave/signalgenerator.ini",
QSettings::IniFormat);
qDebug() << settings.allKeys();
settings.beginGroup("values1");
QHash<QString, QString> values1;
foreach
(const QString &childKey, childKeys
) {qDebug() << childKey << "-->" << settings.value(childKey).toString();
values1.insert(childKey, settings.value(childKey).toString());}
settings.endGroup();
qDebug() << "values1 hash" << values1;
QSettings settings("/home/test/Documents/Wave/signalgenerator.ini", QSettings::IniFormat);
qDebug() << settings.allKeys();
settings.beginGroup("values1");
const QStringList childKeys = settings.childKeys();
QHash<QString, QString> values1;
foreach (const QString &childKey, childKeys)
{qDebug() << childKey << "-->" << settings.value(childKey).toString();
values1.insert(childKey, settings.value(childKey).toString());}
settings.endGroup();
qDebug() << "values1 hash" << values1;
To copy to clipboard, switch view to plain text mode
output:
("board1/name", "board2/name", "values1/nmulti", "values1/nsine", "values1/nsquare", "values1/ntri", "values2/nmulti", "values2/nsine", "values2/nsquare", "values2/ntri")
"nmulti" --> "8.56"
"nsine" --> "8.56"
"nsquare" --> "8.56"
"ntri" --> "13.8"
values1 hash
QHash(("nsine",
"8.56")("nmulti",
"8.56")("ntri",
"13.8")("nsquare",
"8.56"))
("board1/name", "board2/name", "values1/nmulti", "values1/nsine", "values1/nsquare", "values1/ntri", "values2/nmulti", "values2/nsine", "values2/nsquare", "values2/ntri")
"nmulti" --> "8.56"
"nsine" --> "8.56"
"nsquare" --> "8.56"
"ntri" --> "13.8"
values1 hash QHash(("nsine", "8.56")("nmulti", "8.56")("ntri", "13.8")("nsquare", "8.56"))
To copy to clipboard, switch view to plain text mode
So the values from the .ini file are being read.
My goal is to assign these values to the variables(nsine,nsquare, nmulti, ntri) that i have in my program when i choose "board1" from my comboBox. I have a combo box which has an option "board1" and when i choose "board1", I want these values(8.56, 8.56, 8.56, 13.8) to be assigned to the variables(nsine,nsquare, nmulti, ntri) in my program under the function generate_sine() which uses these variables.
So what I meant by "nothing is happening" was that the variables in my function generate_sine() aren't being assigned those values. Is there something that I am missing?
Sorry for not being more clear earlier.
Bookmarks