Important: Please read the Qt Code of Conduct -

How to load customWidget using QUiLoader

  • Hi,

    I've created a custom widget and its designer plugin. I've copied the customwidget dll into the "plugins\designer" folder. i was able to see and i can add it into the ui file via designer,but when i tried to load the ui file using QuiLoader to load the ui file then i've got the follwoing error "QFormBuilder was unable to create custom widget of the class, defaulting to QWidget." and i see no control in loaded Ui.
    I've also observed that my custom widget is not listed in the QUiLoader's available widgets.
    How can i register my custom widget so the QUiloader detects it?


  • @ramsailesh Did you find the solution to this problem? I too am trying to do the same thing. Widget shows up in designer but QUiLoader will not instantiate it.

  • @graphicsRat
    Yes i was able to load custom widgets through QUiLoader.
    I've added the path of the customWidget binary to the loader's plugin path

    QWidget * MainWindow::loadUiFile(const QString filename)
    QUiLoader loader;
    QFile file(filename);;
    QWidget* widget = (QWidget*)loader.load(&file);
    return widget;

Log in to reply