Results 1 to 2 of 2

Thread: Plugin with widget

  1. #1
    Join Date
    Jun 2008
    Posts
    33
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Plugin with widget

    Hi

    I need to make a plugin which when I load some widget will be added to main window.

    For example I have widget with label and button with some functions, signals, slots etc.
    And I want to build this widget as a plugin, dll file, and after loading in another application I want this widget to show there.
    For example on other widget.

    How can I do that? I have never worked with plugins before

    PS: Sorry about my english...

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Plugin with widget

    Take a look at Qt's plugin system. A common mistake is to try to inherit the plugin class from QWidget. Instead of that, you should define a function which creates and returns a widget when asked:
    Qt Code:
    1. class PluginInterface
    2. {
    3. public:
    4. virtual ~PluginInterface() {}
    5.  
    6. virtual QWidget* createWidget(QWidget* parent = 0) const = 0;
    7. };
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

Similar Threads

  1. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 07:06
  2. Replies: 4
    Last Post: 9th August 2007, 08:20
  3. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 14:13
  4. Replies: 12
    Last Post: 15th February 2006, 10:46
  5. Managing widget plugin in Qt Designer
    By yellowmat in forum Newbie
    Replies: 8
    Last Post: 31st January 2006, 09:58

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.