When my app is started from the autostart of Windows, Qt is not able to open it.
The error that causes this is that QDir().absoluteFilePath("settings.cnf")
returns the path C:/Windows/system32/settings.cnf
even though my file is located in my working directory.
Does someone know what method I must call to get the right path?
Using the default constructor QDir() defaults to the current working directory, which can be anything, depending from where the user or the system started the application. For a UI application, that's a path one should usually ignore completely.
To access data next to your application binary, use QCoreApplication::applicationDirPath(). This is usually used for global read-only data installed with the program.
For user-writable configuration settings and cached data, use QStandardPaths (Qt 5) or QDesktopServices::storageLocation() (Qt 4).