QSettings - 如何清除错误?

发布于 2024-12-26 00:46:52 字数 183 浏览 2 评论 0原文

调用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅听莫相离 2025-01-02 00:46:52

来自 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文