一杯清酒邀明月
天下本无事,庸人扰之而烦耳。
posts - 3121,comments - 209,views - 578万
简述

  我有一个配置文件,其中一个组General ,怎么都读不出正确的值,全是空,但是别的组能读出来,改General2试试, 果然可以,就怀疑是不是组名称被内置了。
打开QSettings的帮助文档,搜索General ,有内容,看下解释

The INI file format has severe restrictions on the syntax of a key. Qt works around this by using % as an escape
character in keys. In addition, if you save a top-level setting (a key with no slashes in it, e.g., "someKey"),
it will appear in the INI file's "General" section. To avoid overwriting other keys,
if you save something using a key such as "General/someKey",
the key will be located in the "%General" section, not in the "General" section.

大概意思是说General 被内置了。。他就不能带个qt啥的么,影响我起名字

方法1

  不要指组名称,直接读写就是General 中的信息,value(“key”)就可以了

方法2

  显式用General读 ,如value(“General/key”),在ini文件中被存为[%General ]

方法3

  换个组名称,避免冲突

posted on   一杯清酒邀明月  阅读(166)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全网最简单!3分钟用满血DeepSeek R1开发一款AI智能客服,零代码轻松接入微信、公众号、小程
· .NET 10 首个预览版发布,跨平台开发与性能全面提升
· 《HelloGitHub》第 107 期
· 全程使用 AI 从 0 到 1 写了个小工具
· 从文本到图像:SSE 如何助力 AI 内容实时呈现?(Typescript篇)
历史上的今天:
2021-04-29 Qt QSS教程 QComboBox
2020-04-29 OpenCV提取图像中的颜色直方图(RGB、HSV)
2020-04-29 OpenCV常用库函数
2020-04-29 OpenCV图像处理:灰度化和二值化
2020-04-29 OpenCV 加载并显示图片
2020-04-29 OpenCV函数大全
2020-04-29 Qt的QImage 与 OpenCV的Mat 之间的转换
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示