Important: Please read the Qt Code of Conduct -

QSettings not connecting to .ini file

  • 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
    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?

  • 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.

Log in to reply