Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Odd problem with QSettings::setValue in Twitter o2 library
QtWS25 Last Chance

Odd problem with QSettings::setValue in Twitter o2 library

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 946 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gryffster
    wrote on last edited by
    #1

    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!!

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chronoes
      wrote on last edited by
      #2

      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!

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved