Qt配置⽂件读写在这⾥⽤了两个按钮触发配置⽂件读写操作当pushButton_read按下时读取配置⽂件内容pushbutton_write时分别对三个配置⽂件关键字写⼊新内容。
settings.setValue("mainFun",25);
settings.setValue("subFun",40);
settings.setValue("service",1);
配置⽂件格式如下:
[DevOption]
mainFun=50
subFun=40
service=1
1void tcp_client::WriteSettings()
2 {读取配置文件失败
3    QSettings settings("Option.ini", QSettings::IniFormat); // 当前⽬录的INI⽂件
4    settings.beginGroup("DevOption");
5    settings.setValue("mainFun", 25);
6    settings.setValue("subFun", 40);
朵的拼音7    settings.setValue("service", 1);
8    dGroup();
9 }
10
11void tcp_client::ReadSettings()
12 {
13    QSettings settings("Option.ini", QSettings::IniFormat);视频聊天怎么开美颜
14
沙尘暴是怎么形成的
15int mainFun = settings.value("DevOption/mainFun").toInt();
16int subFun = settings.value("DevOption/subFun").toInt();
17    QString service = settings.value("DevOption/service").toString();
18
19    qDebug() << "service" << service;
20    qDebug() << "mainFun" << mainFun;
怎么醒酒
21    qDebug() << "subFun" << subFun;
22 }
23
24
25void tcp_client::on_pushButton_read_clicked()
26 {
27    ReadSettings();
28 }
洪金宝有几个儿子
29
30void tcp_client::on_pushButton_write_clicked()
31 {
32    WriteSettings();
33 }