[Ctk-developers] Get QWidgets from plugins

Sascha Zelzer s.zelzer at dkfz-heidelberg.de
Wed Jul 17 11:02:10 EDT 2013


Hi Forian,

Could you please elaborate on when exactly the segmentation fault 
happens? Is it already when retrieving the widget as a service via 
ctkPluginContext::getService() or later on when you try to "use" it 
(e.g. adding it to a layout in your main application).

Further, you probably know about the parent / child relationships in 
QObject classes and the associated life-times. So one crucial question 
is, how the life-time of your "widget-services" is managed. In general, 
I see no problem with registering widgets as services though.

An alternative might be to register "widget factories" as services 
instead of the widget instances themselves, so the main application 
controls the creation and destruction of the widgets constructed via the 
factories.

Hope this helps,

Sascha

On 07/16/2013 09:07 PM, Florian Ganglberger wrote:
> Hi all,
> thanks for you help last time! Currently we have a new problem in our
> group. We are developing a framework for Image Guided Surgery. We have
> a main app which should load all components (Dicom loading, image
> registration, navigation, tracking) as plugins, so we can reuse or
> exchange them later. The loading works fine, also the communication
> between the plugins. Unfortunately there is one problem: We have the
> GUI as QWidgets in every plugin class and we want that the main class
> loads a QWidget when the plugins are initialized. We have registered
> the QWidgets as services (within the plugins), but so far we get only
> segmentation faults after we received them in the main app (it seems
> the services are not really made for exchanging GUI elements...).
>
> Du you have any suggestions how to solve this problem? Is there a
> better solution for loading the gui dynamically?
>
> Thank you for your help!
>
> Best regards,
> Florian
> _______________________________________________
> Ctk-developers mailing list
> Ctk-developers at commontk.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers




More information about the Ctk-developers mailing list