Loadable module questions: `setBuiltIn()` and set module active

Hi,

I’m becoming familiar with creating loadable modules.

I write some module and I think it should be built in. I can see that there is a method setBuiltIn() that is provided by qSlicerLoadableModule. I tried to:

qSlicerStackLoadModule::qSlicerStackLoadModule(QObject* _parent)
  : Superclass(_parent)
  , d_ptr(new qSlicerStackLoadModulePrivate)
{
  setBuiltIn(true);
}

but can’t understand what that brings up. What setBuiltIn(true) changes?

Also how to programmatically set some module active? i.e. display my module in Slicer app’s module tab via C++ when some signal is emited.

The built-in property is set when the module is loaded, based on its location in the install tree. The value is not expected to change, therefore if you change it then it will be ignored at most places, but the inconsistency between the initial and current value may cause some issues. If you want to add a “built-in” module then you need to add it to Slicer in your custom application and not install it as an extension. Modules that are in extensions bundled with the custom application probably show up as built-in, too.

1 Like

2 posts were split to a new topic: How to initialize module widget at application startup