Odd problem with QSettings::setValue in Twitter o2 library
-
Hi, I'm using the above to create an app to connect to twitter. o2 uses QSettings to store OAuth tokens received from OAuth at the Twitter end.
However, despite adding the string, the QSettings object appears to remains empty:
@settings_->setValue(fullKey, crypt_.encryptToString(value)); qDebug() << "Fullkey is " << fullKey << " Encrypted key is " << crypt_.encryptToString(value); qDebug() << "Size of settings is now " << settings_->allKeys().size();
@
Produces:Fullkey is "twitter/token.<what the token is> Encrypted key is <encrypted key>
Size of settings is now 0
In short there are no keys on the settings object despite setValue being called. I don't think the parent object is borked or anything of that nature.
Any thoughts? This is driving me NUTS!!
-
This is a little late for the party but I haven't used this library before.
The issue is caused by an QSettings::AccessError and basically means that attempting to write settings failed. Depending on platform, on Windows, it would try to write in registry. If your app does not have proper credentials, it will try to write in default position and thus fail, because it is write-protected.To solve it, you need to add something to identify your app. Fix can be found but is not limited to, courtesy of this post: http://www.qtcentre.org/threads/452-qt4-1-win-g-QSettings-does-not-write-settings?p=2668#post2668
Have fun!