Qt application is a 'QApplication' / not respecting qt.conf

We are deploying two different Qt applications via rpm. One is a QGuiApplication and the other is a QApplication.

We are using Qt version 5.4.1 on RHEL7( v.7.1 ).

We are deploying a qt.conf alongside the Qt Application binary. It has a [Paths] groups followed by a Prefix = /path/to/Qt/Installation.

When we turn on QT_DEBUG_PLUGINS, the application that is a QGuiApplication is respecting the settings in qt.conf while the application that is a QApplication is not. When I looked through the Qt code, I thought that a QApplication is derived from a QGuiApplication which, in turn, is a subclass of QCoreApplication. Shouldn't an application of class QApplication respect the settings in qt.conf?

Well I have been at trying to create a scaled down app. Here is what I think I know:

The main application is declared as a QApplication

The main.cpp is instantiating three objects -- all of type QObject.

One of these objects is our DatabaseMgr object and it is trying to connect to an SQLite database.

With the QT_DEBUG_PLUGINS environment variable set to 1, we see

QSqlDatabase: available drivers:
QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
QSqlDatabase: QSQLITE driver not loaded
QSqlDatabase: available drivers:
QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
QSqlDatabase: QSQLITE driver not loaded
QSqlDatabase: available drivers:
QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
This application failed to start because it could not find or load the Qt platform plugin "xcb".```
Is the problem that those three objects are all instantiated as *QObject* and that is why *qt.conf* is not respected?

I don't think Qt 5.6 would have helped in this case. The root cause was that the source code was referencing a plugin before the qt.conf file was loaded. The loading of the qt.conf file is what has been set up to tell the application where to find the Qt libraries. Since the qt.conf file was not loaded yet, it was unable to determine where the plugin was and erred out. This would still be the case even with a newer version of Qt.