Results 1 to 5 of 5

Thread: Need your help with designer plugin built with Creator

  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,709
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Need your help with designer plugin built with Creator

    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.
    Attached Files Attached Files
    Last edited by high_flyer; 18th November 2010 at 20:59.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,709
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Need your help with designer plugin built with Creator

    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...
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Nov 2010
    Location
    Milazzo, Italy
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Need your help with designer plugin built with Creator

    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?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Need your help with designer plugin built with Creator

    I have a trouble like yours, a bit different.
    Please don't hijack threads. This is a completely different problem.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Nov 2010
    Location
    Milazzo, Italy
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Need your help with designer plugin built with Creator

    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.

Similar Threads

  1. Build two programs in one project in creator
    By Gunnar in forum Qt Tools
    Replies: 1
    Last Post: 13th October 2010, 08:52
  2. Cannot build anytin'...Qt Creator 1.2.1
    By Peppy in forum Installation and Deployment
    Replies: 7
    Last Post: 16th June 2010, 14:34
  3. Replies: 1
    Last Post: 13th January 2010, 23:35
  4. build static Qt Creator
    By rubenvb in forum Qt Tools
    Replies: 3
    Last Post: 18th November 2009, 20:16
  5. A build problem in Qt creator 1
    By Dante in forum Qt Programming
    Replies: 6
    Last Post: 13th March 2009, 17:37

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.