QSettings-ini文件的位置在哪里? [英] QSettings - where is the location of the ini file?

查看:1913
本文介绍了QSettings-ini文件的位置在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用QSettings在Windows中将某些数据存储为ini文件. 我想查看ini文件,但是我不知道ini文件的位置.

I'm using QSettings to store some data as ini file in Windows. I want to see the ini file, but I don't know what is the location of the ini file.

这是我的代码:

QSettings *set = new QSettings(QSettings::IniFormat, QSettings::UserScope, "bbb", "aaa");
set->setValue("size", size());
set->setValue("pos", pos());

我要去哪里看?还是我想念将其写入文件的代码? QSettings何时写入其值?

Where do I have to look? Or may be I miss the code which write it to the file? When does the QSettings write its values?

推荐答案

要打印出设置文件的确切位置,请使用QSettings类的方法fileName方法.

To print out the exact location of your settings file use method fileName method of QSettings class.

QSettings settings("folderName", "fileName");
qDebug() << settings.fileName();

控制台输出如下:

/home/user/.config/folderName/fileName.conf

这篇关于QSettings-ini文件的位置在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆