遍历整个ini
QSettings *machine_data = new QSettings("/home/u/cnc/configs/ppmc/xxx.ini",QSettings::IniFormat);
machine_data->setIniCodec("UTF-8");
QStringList str = machine_data->allKeys();
qDebug() <<"allKeys : " << str << endl;
foreach(QString key,str)
{
qDebug() << machine_data->value(key).toString()<< endl;// 读取 savePath 的值
}
读取ini
int flag;
QSettings *machine_data = new QSettings("/home/u/cnc/configs/ppmc/xxx.ini",QSettings::IniFormat);
machine_data->setIniCodec("UTF-8");
machine_data->beginGroup("BigGroup");
gpib_kaiguan=machine_data->value("ChildKey").toInt();
machine_data->endGroup();
delete machine_data;
写ini
int flag=1;
QSettings *machine_data = new QSettings("/home/u/cnc/configs/ppmc/xxx.ini",QSettings::IniFormat);
machine_data->setIniCodec("UTF-8");
machine_data->beginGroup("BigGroup");
machine_data->setValue("ChildKey",flag);
machine_data->endGroup();
delete machine_data;