Qt: Issue getting the settings ini file from application/executable directory
<p>I am using Qt5.7 on Windows7.<br>
In my current app, I have my own settings manager class, that looks like this:   </p>

<p><strong>Header:</strong></p>

<pre><code>class SettingsManager
{
public:
    void     write(const QString &amp; key, const QVariant &amp; variant);
    QVariant read (const QString &amp; key) const;

private:
    static QSettings settings;
};
</code></pre>

<p><strong>Source cpp:</strong></p>

<pre><code>QSettings SettingsManager::settings("settings.ini", QSettings::IniFormat);

void SettingsManager::write(const QString &amp; key, const QVariant &amp; variant)
{
    settings.setValue(key, variant);
}

QVariant SettingsManager::read(const QString &amp; key) const
{
    return settings.value(key);
}
</code></pre>

<p>My problem is: I gave the app to some friends and probably they launched it with different working directory or something, and the app didn't find the <code>settings.ini</code> file, hence it didn't work as it should...      </p>

<p>So, the question is: How can I modify the code above to be able to get the <code>settings.ini</code> file from the application/executable directory? Obviously, The <code>settings.ini</code> file is always in the same folder as the app itself.    </p>