[SOLVED] One dll for every single plugin ?
-
I will start with my first custom widget plugin.
Is it really correct that I cannot pack multiple custom widgets in one project.Respectively, how is the configuration made, which QDesignerCustomWidgetInterface -subclass of the project should be instantiated?
There is no special instantiation code for it in the AnalogClock example.
or where is the dll startcode ? -
how is the configuration made, which QDesignerCustomWidgetInterface -subclass of the project should be instantiated?
This is done via the Q_PLUGIN_METADATA macro. There can be only one instance of it in the library and it exports the class it is declared in.
Is it really correct that I cannot pack multiple custom widgets in one project.
Not at all. Multiple classes can be contained in a single project. You would then create another class that implements
QDesignerCustomWidgetCollectionInterface
(what a mouthful...) and put the Q_PLUGIN_METADATA in it. It is a collection object that can expose multiple classes implementingQDesignerCustomWidgetInterface
.
I suggest you try to create a ui plugin via Qt Creator's wizard. It has a really nice interface that lets you add multiple plugin classes and generates all the crust. Add a couple of classes and study generated output. It is pretty straightforward. -
@Chris-Kawa
Oh, fine !
Must I use the wizzard template : Library -> Qt Creator Plugin -
No. It's under Other Projects -> Qt Custom Designer Widget.
-
@Chris-Kawa
Wow, never seen before.
Can I reopen the powerfull wizzard for a just created project again to add new classes incl. plugins ? It seem not to be possible.To the QDesignerCustomWidgetCollectionInterface:
I change the project to importing only the interface "with the long name" and must remove the Q_PLUGIN_METADATA macro of all single widgets!