Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unable to load custom widgets in UI file with QUiLoader
Forum Updated to NodeBB v4.3 + New Features

Unable to load custom widgets in UI file with QUiLoader

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 845 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    graphicsRat
    wrote on last edited by graphicsRat
    #1

    I'm trying to use QUiLoader to load a UI file that contains a custom widget resident in a path, which I have registered with QUiLoader as shown below. Yet QUiLoader is unable to find the my plugin.

    QUiLoader loader;
    loader.addPluginPath( "folder/containing/MySnazzyWidgetDll" );
    QStringList paths = loader.pluginPaths();  // returns path to plugin
    
    QStringList availableWidgets = loader.availableWidgets();
    if( availableWidgets.contains( "MySnazzyWidget" ) )
    {
        QFile file( "File.ui" );
        file.open( QFile::ReadOnly );
        QWidget* widget = loader.load( &file );
    }
    else
    {
        LOG_ERROR << "Unable to instantiate MySnazzyWidget";    // ALWAYS
        return;
    }
    

    I'm not even sure what sort of plugin that's supposed to be loaded. A designer plugin or a widget plugin i.e. a widget class compiled as a DLL.

    Please advise.

    Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      I can't answer for the plugin part however "folder/containing/MySnazzyWidgetDll" is a relative path so are you sure that the plugin is searched ?

      On thing you can do to check that is to run your application with QT_DEBUG_PLUGINS=1

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved