Results 1 to 3 of 3

Thread: About custom widgets , a summarize about its use ....

  1. #1
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default About custom widgets , a summarize about its use ....

    I have some confused about using a custom widget plugin.

    Please confirm my actual knowlegde about it.

    1.- You can use the 'promote' approach. In this case, you have to include all the files used by the custom widget.

    2.- You can create a dll for it, using the plugin interface.
    In this case, you have allways to create the correct EXPORT code ?
    If not, how to use it ?

    I have my own custom widgets dll, with code for export the symbols. It works fine.
    But... when I want to use example widgets I have a lot of undefined errors ?
    (I'm unable to use the multipage example.... Need I to define EXPORT code ? )

    A last question, Can I use the pluginloader to load custom widgets ? (or pluginloader has another mission ?)

    Thanks.




    Thanks

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: About custom widgets , a summarize about its use ....

    I have my own custom widgets dll, with code for export the symbols. It works fine.
    But... when I want to use example widgets I have a lot of undefined errors ?
    (I'm unable to use the multipage example.... Need I to define EXPORT code ? )
    How are u using example widget?
    I don't think you can use them from dll, as you need to build it that way. You can use example widget, if you include them in your project, as done in static build.

    You may need to export only if dynamic linking is required.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: About custom widgets , a summarize about its use ....

    Quote Originally Posted by tonnot View Post
    I have some confused about using a custom widget plugin.
    Please confirm my actual knowlegde about it.
    1.- You can use the 'promote' approach. In this case, you have to include all the files used by the custom widget.
    Yes, you can use the Promote feature in Qt Designer so that the UI file generates code to use your custom widget. In Designer you have to list the file(s) that the user of the widget must #include in order to access the class declaration. When you build the code using the UI you need to ensure that the implementation of the class is found.
    2.- You can create a dll for it, using the plugin interface.
    In this case, you have allways to create the correct EXPORT code ?
    If not, how to use it ?
    If you want to be able to drag and drop your custom widget in Designer then you need to build a plugin for Designer that provides information about widget. The interface your plugin supports provides Designer with information needed to show your widget icon in the tool bar, include the correct files during build, and expose the widget properties in the editor. This is not the same thing as simply building a library containing your custom widget.

    I have my own custom widgets dll, with code for export the symbols. It works fine.
    But... when I want to use example widgets I have a lot of undefined errors ?
    (I'm unable to use the multipage example.... Need I to define EXPORT code ? )
    No information to go on here.

    A last question, Can I use the pluginloader to load custom widgets ? (or pluginloader has another mission ?)
    QPluginLoader is for loading libraries that implement Qt Plugin interfaces. It is designed for safe loading of pluggable implementations of given interfaces and hides much of the complexity of resolving names. Qt also does checks that the plugin contains code that matches the expectations of the main program.

    QLibrary is for run-time loading of arbitrary dynamic libraries.

    If you wrap your custom widget as a Qt Plugin then, yes, QPluginLoader could handle loading for you. If, for example, you had an interface defined for a ClockWidget you could implement an analog clock, digital clock, and a Klingon clock in separate plugins and switch between them at run time.

  4. The following user says thank you to ChrisW67 for this useful post:

    tonnot (24th May 2011)

Similar Threads

  1. Replies: 1
    Last Post: 18th July 2012, 09:59
  2. Custom widgets, where must I put them ?
    By tonnot in forum Newbie
    Replies: 4
    Last Post: 22nd October 2010, 08:56
  3. Custom Widgets
    By walden02 in forum Qt Programming
    Replies: 3
    Last Post: 23rd December 2009, 11:43
  4. Replies: 0
    Last Post: 15th May 2009, 15:38
  5. Help with custom widgets!!
    By superteny in forum Qt Programming
    Replies: 4
    Last Post: 29th April 2009, 12:43

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.