QSettings - 如何清除错误?
调用sync()后,当我检查状态时,我收到AccessError。然后我通过程序修复了权限并再次调用sync()。这同步了设置,但错误并未清除。有什么方法可以在调用第二个sync()之前强制清除它吗?我应该子类化 QSettingsPrivate 并调用 setStatus 来实现此目的吗?如果有人实现了,请分享您的代码。
-卡蒂克
After I call sync(), I get AccessError when I checked the status. Then I fixed the permission through program and call sync() again. This synced the settings but the error is not cleared. Is there any way I can forcefully clear it before calling second sync()? Should I subclass QSettingsPrivate and call setStatus to achieve this? If someone has achieved it, please share your code.
-Karthik
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 QSettings 文档:“返回一个状态代码,指示 QSettings 遇到的第一个错误”。再次调用sync不会改变状态。只需重新启动应用程序即可。
From QSettings docu: "Returns a status code indicating the first error that was met by QSettings". Calling sync again will not change the status. Just restart the application.