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. QSettings not connecting to .ini file

QSettings not connecting to .ini file

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.4k Views 1 Watching
  • 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.
  • B Offline
    B Offline
    bluestreak
    wrote on last edited by
    #1

    Hi,

    I have a .ini file states.ini which I am trying to connect to QSettings. To test it out, in my .ini file I have
    @
    [screen]
    position="one"
    [myConnection]
    ip="162.30.0.5"
    port=6543
    @
    In my Qt c++, I have
    @
    QSettings settings(QString("folderWithinHome/subfolder/states.ini"), QSettings::IniFormat);
    QString someValue = settings.value("myConnection/ip", "none").toString();
    qDebug() << someValue;
    @
    However, this returns "none." Any ideas as to why it doesn't correctly find the ip address in the .ini file?

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

      You have provided a relative file path to the ini file. My bet is that the current working directory of the running program is not what you think it is.

      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