Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25

Thread: How to create a plugin

  1. #21
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to create a plugin

    Yes, you need to add the void showSettingsDialog() function to MyPlugin

  2. #22
    Join Date
    Jun 2010
    Posts
    142
    Thanks
    11
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to create a plugin

    My main application now "unexpectedly finishes" if I uncomment the commented out line:

    Qt Code:
    1. dirIter.next();
    2. QPluginLoader loader(dirIter.filePath());
    3. QPanelAppletInterface *plugin = qobject_cast<QPanelAppletInterface*>(loader.instance());
    4. //ui->appletLayout->addWidget(plugin->getWidget());
    To copy to clipboard, switch view to plain text mode 

  3. #23
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to create a plugin

    Most probably, plugin is 0 resulting in the crash.

    To prevent the crash, but not solve it do this:
    Qt Code:
    1. if (plugin)
    2. ui->appletLayout->addWidget(plugin->getWidget());
    To copy to clipboard, switch view to plain text mode 

    Now, to solve the plugin problem.
    1. check if loader does point to the correct file. This means that dirIter.filePath() should be the same as "/home/you/where/the/plugin/is/myplugin.so"
    2. Check if the cast can actually be performed. Therefor, the instance returned by the plugin loader needs to be correct at least.

  4. #24
    Join Date
    Jun 2010
    Posts
    142
    Thanks
    11
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to create a plugin

    It finally works!!!

    The problem is that it was trying to load the files "." and "..".

  5. #25
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to create a plugin

    Nice, well done.

Similar Threads

  1. Replies: 7
    Last Post: 11th April 2013, 11:55
  2. Plugin and shared class between plugin and application
    By wishper in forum Qt Programming
    Replies: 7
    Last Post: 23rd August 2010, 18:00
  3. Create plugin in Visual Studio
    By estel in forum Installation and Deployment
    Replies: 2
    Last Post: 10th March 2010, 00:40
  4. Replies: 4
    Last Post: 1st May 2009, 12:00
  5. Replies: 7
    Last Post: 23rd August 2007, 13:33

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.