PDA

View Full Version : Need your help with designer plugin built with Creator



high_flyer
18th November 2010, 20:27
Hi,

I admit that although I like the edit environment of creator, I never got to be friends with it, event though I really want to.
Anyway, now I am trying it again, and I have the following problem, which COULD be a fault on my part, which is where I need your help.
I made a small plugin for designer which is a QML widget (is my first playing around with QML).
The plugin works well in designer.
BUT - the lib created with the DLL, is doesn't have my custom widgets symbols in it!
This made me to take a close look at the Makefile.
First, creator was generating a pri file, with the custom widget sources in it, in ADDITION to adding the files to the mail pro, which resulted double occurring of the compile and linkage in the Makefile. (Creator gave a warning about double occurrence, and that it was ignoring the second one)
Ok, I removed the pri file, and now it looks to be correct.

However, still, the sybombls found in my custom widgets obj file, are not in the lib file, so if you try to use the plugin in your project, you wont be able to link to it, or rather, you can link to it, but you get undefined reference to the custom widget.

The fact the plugin works well in designer, shows to me, that the DLL has all the info in it.

Attached is a zip with the project, and I will be really thankful if you could have a run on your creator and see what you get.
Am I looking at a creator bug (not linking the custom widget obj in to the lib file - not likely) or am I just not doing something I should - or doing something wrong (probably)?

I left my original make files in the zip, maybe they can tell you something I missed.

You are free to use the custom plugin :-)

P.S
This code was just written on the fly more or less, so don't expect and gems in there.

Thanks!

P.P.S
I had to split the files in zips because it was too large.
Just put the images in to the root of the project where the sources are.

high_flyer
27th November 2010, 00:57
Ok, I had a second look and the solution is:
Since Qt 4.1, the custom widgets in the plugin need to be exported as well with the following macro:
QDESIGNER_WIDGET_EXPORT.

Since as in the documentation they wrote:


This macro is used when defining custom widgets to ensure that they are correctly exported from plugins for use with Qt Designer.

On some platforms, the symbols required by Qt Designer to create new widgets are removed from plugins by the build system, making them unusable. Using this macro ensures that the symbols are retained on those platforms, and has no side effects on other platforms.


As you can see, I haven't made any plugins in a while... at least not since 4.1... ;)

glafauci
27th November 2010, 07:58
Hi, high-flyer.

I have a trouble like yours, a bit different.

I made one custom widget with the DESIGNER_WIDGET_EXPORT class declarator. The widget work fine, but when I design an application using that widget the linker shows that error:



debug/mainwindow.o:C:\Documents and Settings\glafauci\Documenti\Programmi-QT\ProvaK-build-desktop/./ui_mainwindow.h:51: undefined reference to `KLineEditEx::KLineEditEx(QWidget*)'

collect2: ld returned 1 exit status

I'm crazing about that problem. It seems that I wrong something about the .pro file or the linker can't find the widget DLL file.

Have you any suggestion?

wysota
27th November 2010, 09:48
I have a trouble like yours, a bit different.
Please don't hijack threads. This is a completely different problem.

glafauci
27th November 2010, 15:46
Ok, I apologize with you all.

For the record, I resolved the problem: I missed to insert in the .pro file the path and the name of DLL, using:

LIB += -L[dirpath]
LIB += -l[nameOfDLL]

Now I have another problem, but I arrange to open a new thread... :-)

Hi to all.