[Qt-interest] Adding custom widget plugins error/problem

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Wed Mar 11 11:42:37 CET 2009


Miroslav wrote:

> Hi All,
> 
> unfortunately am still having a problem. 
> The point is that when I create a library (*.so) from the QtCreator
> example - worldtimeclock, everything was compiled OK.
> 
> Question is that what everything I have to do to plug it to 
> for example
> a MainWindow.
> 
> 1 - move it to Qcreator/designer/plugin folder (or other appropriate
> path)
> 2 - restart QtCreator
> 3 - move the new plugin to your MainForm - in the designer 
> view (this is
> what I have already done)
> 4 - copy appropriate header file
> 5 - WHAT ELSE? 
>    - do I have to include the lib file also in the *.pro file?
>    - some special code in the MainFrame?
> 
> 
> 
> I have added the include in the *.pro file and now I'm not 
> getting build
> errors, but when I execute the application I'm ending up with:
> "error while loading shared libraries: libworldtimeclockplugin.so:
> cannot open shared object file: No such file or directory"
> 
> Is costom widget plugin a shared library? 
> 
> Thank you in advance,... ;o)
> 
> Miroslav

Have a look at the Qt Assisstant article "Using a Designer .ui File in Your
Application".  There are various options to choose from when using the
generated header file.  In my case, I use the "single inheritance approach".
Have you tried compiling any of the form examples? Which example did you
base your application on? 

The *.ui file is converted to the ui_*.h containing the code to create your
widget. The designer plugin is only used by designer - your application
should not use it, and the plugin does not need to be distributed with your
application. 

Note also that if you declare both the widget and its plugin in the same
header file, as I do, then you need to define your own preprocessor variable
and make the plugin definition and its code conditionally compiled. Then put
the define only in the plugin's .pro file, not the application's .pro.
Hopefully that will stop the application trying to load the plugin. 

Regards, 

Tony.





More information about the Qt-interest-old mailing list