[Qt-interest] QSettings never saves anything
Konrad Rosenbaum
konrad at silmor.de
Wed Aug 19 16:23:54 CEST 2009
On Wednesday 19 August 2009, Thomi Richards wrote:
> 2009/8/19 Matthias Pospiech <matthias.pospiech at gmx.de>:
> > If I want to use QSettings in its native OS way, I can never get the
> > value after I saved it:
>
> I believe you need to call QSettings::sync() after setting a value to
> save data to disk.
No, QSettings auto-saves when the QSettings-object is destroyed (or the code
leaves its scope of visibility).
As far as I know this class this can happen only in two instances:
a) the OP tries to read settings while the writing object still lives
b) the settings object tries to write to a file (Unix/Mac) or part of the
registry (Windows) onto which it does not have write access.
Make sure you set a vendor and application name with QApplication before you
use any QSettings object. And if this is Unix: make sure the user has write
access to his own homedir, if it is Windows the user should be able to
alter his profile.
Konrad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090819/d2ba50d9/attachment.bin
More information about the Qt-interest-old
mailing list