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. How to load customWidget using QUiLoader
Forum Updated to NodeBB v4.3 + New Features

How to load customWidget using QUiLoader

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.9k Views 1 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.
  • R Offline
    R Offline
    ramsailesh
    wrote on 25 Nov 2013, 12:48 last edited by
    #1

    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?

    Thanks,
    RamSailesh

    1 Reply Last reply
    0
    • G Offline
      G Offline
      graphicsRat
      wrote on 21 May 2015, 11:20 last edited by
      #2

      @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.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        ramsailesh
        wrote on 15 Jun 2015, 08:22 last edited by
        #3

        @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;
        loader.addPluginPath(qApp->applicationDirPath());
        QFile file(filename);
        file.open(QFile::ReadOnly);
        QWidget* widget = (QWidget*)loader.load(&file);
        file.close();
        return widget;
        }

        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