Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QUiLoader Usage.

QUiLoader Usage.

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 2.6k 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.
  • V Offline
    V Offline
    Vijaeendra
    wrote on last edited by
    #1

    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;;
    file.open(QFile::ReadOnly);
    QWidget *formWidget = loader.load(&file, this);
    file.close();
    
    
    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(formWidget);
    setLayout(layout);
    
    setWindowTitle(tr("UI_from_UI"));
    

    }@

    the main() is

    @#include <QApplication>

    #include "mainwindow.h"

    int main(int argc, char *argv[])
    {
    Q_INIT_RESOURCE(ui_from_ui);

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

    }@

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

    Somebody Help...

    Thanks..

    1 Reply Last reply
    0
    • V Offline
      V Offline
      Vijaeendra
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vsorokin
        wrote on last edited by
        #3

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

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

        --
        Vasiliy

        1 Reply Last reply
        0
        • V Offline
          V Offline
          Vijaeendra
          wrote on last edited by
          #4

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

          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