Details
Description
In commit 6c973dee2cb1686ea32657fff7dced3e611b98ce, a change was made to the QCoreApplication constructor, adding this call:
// Store app name (so it's still available after QCoreApplication is destroyed)
coreappdata()->application = d_func()->appName();
This caused some code that we use to break. Essentially, our code is doing the following:
int main(int argc, char *argv[]) { QApplication::setApplicationName("My Application Name"); qDebug() << "before:" << QApplication::applicationName(); QApplication a(argc, argv); qDebug() << "after:" << QApplication::applicationName(); return a.exec(); }
which, for a project named "SetApplicationName", prints:
before: "My Application Name" after: "SetApplicationName"
The net effect is that if you call QApplication::setApplicationName() before the QApplication itself is constructed, then whatever application name you set is overwritten with the executable's name.
This is a problem for us because we call QApplication::setApplicationName() in our application's main() function before the QApplication object itself is created. We do this because we want to control the name of the .ini file created and used by QSettings. Since the QApplication subclass our application uses involves QSettings objects, we need to be able to call QApplication::setApplicationName() before we create the application object and have that name stick.