I have a qt project for which I have created a custom designer plugin. It works fine in designer if I copy the dll in $QT_DIR/plugins/designer or set QT_PLUGIN_PATH env. Plugin has to be built in Release config (I use cmake) else designer won't load it.

Now when building the actual program I naturally do it in Debug config since I'm developing it. The program is linked against the designer plugin. This however causes program to crash at startup with error 'QWidget: Must construct a QApplication before a QPaintDevice'. If designer plugin is also built in Debug config it will work (but then it won't load in designer).

So a bit confused what's going on here. Is it wrong to link debug code against release code ?

I'm also a bit unsure whether I should link my app directly with the designer plugin dll OR should I maybe build another, 'ordinary' shared library from same source code, only omitting QDesignerCustomWidgetInterface QDesignerCustomWidgetCollectionInterface related classes ?

I'm using mingw32 build chain.