- 使用QSettings读写即可,比较简单
#include <QSettings>
void MainWindow::on_pushButton_6_clicked()
{
QSettings configIniWrite("d:\\1.ini", QSettings::IniFormat);
configIniWrite.setValue("/para1/first", "1111111");
configIniWrite.setValue("para1/second", 2222);
configIniWrite.setValue("para2/third", "3333333");
QSettings configIniRead("d:\\1.ini", QSettings::IniFormat);
QString first = configIniRead.value("/para1/first").toString();
int second = configIniRead.value("/para1/second").toInt();
QString third = configIniRead.value("/para2/third").toString();
qDebug() << first;
qDebug() << second;
qDebug() << third;
}