Important: Please read the Qt Code of Conduct -

QUiLoader Usage.

  • I have a .ui file ... I am trying to render the same using QUiLoader... the code is as below

    #include <QtUiTools>
    #include <QtGui>

    #include "mainwindow.h"

    UI_from_UI::UI_from_UI(QWidget *parent)
    : QWidget(parent)
    QUiLoader loader;

    QFile file&#40;":/form/mainwindow.ui"&#41;;;
    QWidget *formWidget = loader.load(&file, this);
    QVBoxLayout *layout = new QVBoxLayout;


    the main() is

    @#include <QApplication>

    #include "mainwindow.h"

    int main(int argc, char *argv[])

    QApplication app(argc, argv);
    UI_from_UI ui;;
    return app.exec();


    But the UI that I have created is not being rendered...

    Somebody Help...


  • Could it be a problem with the .ui format or is it the usage??... my reference is the Calculator Builder Example...

  • bq. QFile file(":/form/mainwindow.ui");

    Just hypothesis: Are you sure that path to UI is right? Did not forget prefix or alias, etc?

  • Its reading the file properly.., no issues with that :-o

Log in to reply