PDA

View Full Version : custom plug-in widget in another custom plug-in widget.



MrGarbage
24th August 2007, 17:46
Hi,

I have created a simple custom LED plug-in widget.
I can use this plug-in from within QT Designer and also build and use a form
created within QT Designer in my app.

In QT Designer I have now created another custom plug-in widget which uses
this custom LED widget.

When I try to build this plug-in, it fails to link complaining about:

Creating library C:\Projects\Gen2_GUI\My Designer Widgets\CollapsibleGroup\Debug\P1_CollapsibleGrp.l ib and object C:\Projects\Gen2_GUI\My Designer Widgets\CollapsibleGroup\Debug\P1_CollapsibleGrp.e xp
Collapsegrp.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const P1LED::staticMetaObject" (?staticMetaObject@P1LED@@2UQMetaObject@@B)
Collapsegrpplugin.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const P1LED::staticMetaObject" (?staticMetaObject@P1LED@@2UQMetaObject@@B)
moc_Collapsegrp.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const P1LED::staticMetaObject" (?staticMetaObject@P1LED@@2UQMetaObject@@B)
C:\Projects\Gen2_GUI\My Designer Widgets\CollapsibleGroup\Debug\P1_CollapsibleGrp.d ll : fatal error LNK1120: 1 unresolved externals


I thought this sort of thing is usually related to linking the release build with a debug
lib or vice versa, but I have verified that I am building and linking the release versions
of everything.

This is windows and QT 4.3

Any suggestions?

Many Thanks,
Mark

jpn
24th August 2007, 19:06
Could you describe the structure of the project? A custom widget can be either built into a designer plugin or the widget can be built as a separate library to which the designer plugin links to. Which is the case of yours? Is the led a separate library or does it get built into the another plugin or what? :)

MrGarbage
25th August 2007, 03:12
LED is a designer plug-in that I wrote and copied to the plugins directory.
It correctly appears in my QT Designer widget box and I have used it in several forms.

I am creating a new designer plug-in.
In QT Designer I have designed my new widget and one of the controls in that
widget is the LED control which I have pulled on from the QT widget box.

It previews and operates as desired in QT Designer.

When I try to build the actual plug-in for this new widget I get the link errors
described earlier.

Mark

jpn
25th August 2007, 10:01
LED is a designer plug-in that I wrote and copied to the plugins directory.
Do you have sources of LED included to this designer plugin project or is LED a separate library to which this designer plugin links to?


I am creating a new designer plug-in.
In QT Designer I have designed my new widget and one of the controls in that
widget is the LED control which I have pulled on from the QT widget box.
Do you have sources of LED included to this designer plugin project too, or is LED a separate library to which this designer plugins also links to?

MrGarbage
25th August 2007, 14:12
The LED plug-in is source only. It does not link to any libraries.

The new plug-in which includes the LED widget links with the LED library generated by
the building of the LED plug-in. This is the same library that I copy to plugins\designer directory to make the LED widget available to QT Designer.

Thanks in advance!

Mark

marcel
25th August 2007, 14:18
I think you have to include the moc result for LED in the other plugin, at the end of the file that generates the errors.

MrGarbage
27th August 2007, 15:38
Thanks, that did in fact take care of the problem.

I must say however I don't entirely understand why this is necessary.

If I create a custom control and in it I include an existing QT widget from the toolkit, I am able to build that widget without including the moc files for that widget in my build.

It seems as if I should be able to build my custom LED widget such that it behaves like
an existing QT widget and can be included in another custom control without having to deal with the moc files.

Mark