Results 1 to 3 of 3

Thread: Multiple plugins in the same library

  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Multiple plugins in the same library

    Hi Qt community,
    I have to add on my ui form some custom widgets (i.e. myLineEdit, myPushButton, myLabel, etc) to perform some specific operations.

    I read that this can be done by just dragging on the form some qt widget (e.g. a QLabel or a QLineEdit) and then promote it by selecting the *.h of the custom widget I would use.

    Now I am a bit confused because in the Qt doc it says that this is done by using Qt plugins, so i created many plugins, one for each custom I should use. I also read that for each plugin you have to declare the metadata through the macro

    Q_PLUGIN_METADATA(IID "some metadata")
    So I set it and got the error:

    multiple definition of `qt_plugin_query_metadata`
    So seems that is not possible to create a single project ( single pro file ) containing many plugins.

    Can I have a help in better understanding the scenario? It is mandatory to use plugins to create some custom widget in the form?

    Thank you very much,
    Franco
    Franco Amato

  2. #2
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiple plugins in the same library

    Solved by using QDesignerCustomWidgetCollectionInterface
    Franco Amato

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Multiple plugins in the same library

    It is mandatory to use plugins to create some custom widget in the form?
    If all you want to do is to add a custom widget to your form, you do not need to create a plugin. You simply add a QWidget (or QLineEdit or whatever if your widget is derived from a Qt widget) and promote it to the custom widget type. This allows the UI file to be compiled and for the runtime loader to create the widgets through the setupUi() call.

    However, if your custom widget has properties, signals, etc. beyond those in the base class widget that you want to customize using Qt Designer, then you need a plugin because promotion does not give access to those. Even if your custom widget doesn't add capabilities, the plugin allows you to add them to the form as their actual types instead of having to go through the promotion step for each each time you add one.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Qt Creator Include internal library to project - Library dropdown list is empty
    By bilgenratte in forum Qt Tools
    Replies: 2
    Last Post: 5th January 2017, 12:17
  2. Replies: 1
    Last Post: 6th June 2012, 02:41
  3. Replies: 17
    Last Post: 2nd January 2011, 18:11
  4. Mac OS, plugins that user designer plugins
    By Royceybaby in forum Qt Programming
    Replies: 0
    Last Post: 9th May 2010, 02:40
  5. Multiple inherittance in plugins
    By KShots in forum Qt Programming
    Replies: 13
    Last Post: 24th April 2007, 21:27

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.