Results 1 to 4 of 4

Thread: QPluginLoader doesn't accept plugin name

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2011
    Posts
    31
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Exclamation QPluginLoader doesn't accept plugin name

    I'm weird. Just made plugin as described in books. All looks fine. In main application I try load it but got unexpected problem:

    Qt Code:
    1. MainWindow::MainWindow(QApplication* a, QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::MainWindow)
    4. {
    5. QDir dir( QApplication::applicationDirPath() );
    6. QString abspath = dir.absoluteFilePath( "EmptyPlugin.dll" ); // name correct in abspath
    7. QPluginLoader PluginLoader( abspath );
    8. abspath = PluginLoader.fileName(); // name empty!!! ?????????
    9. QObject * plugin = qobject_cast<QObject*>( PluginLoader.instance() );
    10. QString errstr;
    11. if( ! plugin )
    12. errstr = PluginLoader.errorString(); // contains "Unknown error"
    13. }
    To copy to clipboard, switch view to plain text mode 

    1st time abspath is correct, but 2nd time it... is empty

    tried this:

    Qt Code:
    1. MainWindow::MainWindow(QApplication* a, QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::MainWindow)
    4. {
    5. QDir dir( QApplication::applicationDirPath() );
    6. QString abspath = dir.absoluteFilePath( "EmptyPlugin.dll" ); // name correct
    7. QPluginLoader PluginLoader( "" );
    8. PluginLoader.setFileName( abspath );
    9. abspath = PluginLoader.fileName(); // name empty!!! ?????????
    10. QObject * plugin = qobject_cast<QObject*>( PluginLoader.instance() );
    11. QString errstr;
    12. if( ! plugin )
    13. errstr = PluginLoader.errorString(); // contains "Unknown error"
    14. }
    To copy to clipboard, switch view to plain text mode 

    effect is the same, no plugin file name assigned

    why this can happen? PLEASE HELP!
    Last edited by Gourmet; 8th June 2011 at 12:52.

Similar Threads

  1. QPluginLoader not load plugin
    By Thyago.celler in forum Qt Programming
    Replies: 9
    Last Post: 20th May 2011, 19:01
  2. QPluginloader load plugin from RAM
    By meCHAoT in forum Qt Programming
    Replies: 3
    Last Post: 3rd February 2011, 17:23
  3. Replies: 8
    Last Post: 27th December 2009, 14:57
  4. QPluginLoader doesn't load plugin
    By BeS in forum Qt Programming
    Replies: 6
    Last Post: 26th November 2008, 19:12
  5. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 14:13

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
  •  
Qt is a trademark of The Qt Company.