qtqt5iniqsettings

QSettings of ini file from internet


Im using this function so far:

bool MSSQL::checkSettings()
{
    QString settingsFile = "someDir/setup.ini";
    QString fileName(settingsFile);
    QFile file(fileName);
    if(QFileInfo::exists(fileName)) {
        return true;
    }
    else {
        qDebug() << "Error: No INI File Found on path:" << settingsFile;
        return false;
    }
}

which works fine.

However when I wish to use an online ini file which is reachable (because can be opened via browser link), then its a false, for example if i use:

QString settingsFile = "http://localhost/something/setup.ini";

which QT should be able to read, then it doesnt work...

any ideas?


Solution

  • I dont see where you are using QSettings at all. You are using QFile, which is representation of a local file. To your question: QSettings does not able to read/write setting from URL. You have to download it manually before instantiating QSettings, See QNetworkAccessManager. Or you may try to make your own settings provider, by using: QSettings::registerFormat() static function.