PDA

View Full Version : What is the proper way to link program against custom designer widget plugin ?



jkv
2nd December 2010, 12:44
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.

Lesiok
2nd December 2010, 14:54
1. You must build plugin in both modes (debug and release)
2. Just link to the program this same dll which is used by QDesigner or (as we are doing) for application create a static library with widget.

jlemaitre
9th December 2010, 15:11
2. Just link to the program this same dll which is used by QDesigner or (as we are doing) for application create a static library with widget.

Please can you describe your build chain? In particular, how do you make your application independent from the plugin's DLL? (My application is linked against the plugin's static library but still requires the plugin's DLL at runtime.)

Thanks