[Solved] Qt Creator plugins. ExtensionSystem :: IPlugin :: removeObject()
I’m working on a plugin for Qt Creator and have faced the following problem.
There’s Core::IOutputPane subclass (say, OutputPane) implemented because the plugin needs to show some data in a output pane. The instance of OutputPane is added to plugin manager’s pool in Plugin::initialize() using IPlugin::addObject(). However if the user changes plugin options I need to hide the pane when the Qt Creator is running. I’m trying to do this with IPlugin::removeObject() but it won’t work. If I, however, add the pane and immediately remove it from the pool within Plugin::initialize(), then the pane is hidden.
Does it mean that IOutputPane instances can be only added or removed while a plugin is initializing?
Once something is initialized an object may be in use somewhere (e.g. in the combobox to select a output view, etc.), so removing it will generally not work. In general we do not support removal of objects anywhere in Qt Creator (with the exception of application shutdown of course:-)
Yes, I was suspecting this, espessialy after looking through PluginManager and PluginManagerPrivate sources. Thanks a lot for confirmation.