I used to save settings in closeEvent , now i found that's bit of flaw , because when you close a window , that function will be called as well. ( my app have a system tray , and hide to system tray ability )

So when should i save the settings with QSettings ? I shouldn't be calling this in destruction function , right ?

有帮助吗?

解决方案

It's definitely fine to use QSettings in destructors. I've done that for years and not had any problems.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top