Search code examples
windowsqtstatic-linking

QApplication static linkage


I build a Main App/plugin application using qt 5.1 for multi platform purpose.

In windows, the Main app is statically linked whereas the plugins are dynamically linked (the first one is a requirement, the second more of a choice :) )

Up until now, everything worked fine.

Now I want the plugin to be able to show some stuff (mostly configuration...) and everything is not working fine on windows. When I intend to show something i got a "QWidget: Must construct a QApplication before a QPaintDevice". after a little bit of research, i understand that everything relying on a UI must have a instance of QApplication running, so qApp should not be NULL, but it is with my plugins but not my main app.

Anyone knows how to set/assign a QApplication ?

thanks in advance :)


Solution

  • discussed it in Qt-project forums and the only way to make it work is to create a QApplication in the plugins when it does not exists (which is only the case when the app it statically linked against Qt)

    And I make the plugin also statically linked against Qt too and it works fine :)