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. Where is my QML?
Forum Updated to NodeBB v4.3 + New Features

Where is my QML?

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 550 Views
  • 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.
  • Q Offline
    Q Offline
    qwe3
    wrote on last edited by
    #1

    Hi,

    I have very simple QML test app. It looks like this:

    Main ( no changes ):

    #include "mainwindow.h"
    
    #include <QApplication>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        MainWindow w;
        w.show();
        return a.exec();
    }
    

    QML:

    import QtQuick 2.0
    import QtQuick.Controls 2.11
    Item {
        Button {
            text: "Ok"
        }
    }
    

    MainWindow.cpp:

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
        widget = new QQuickWidget(this);
        widget->setSource((QUrl(QStringLiteral("qrc:/test.qml"))));
        widget->move(10,10);
        widget->resize(400,400);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    

    When I run this app from QTCreator, eveything is ok ( I see Button "ok" ). When I run this application from my folder on Desktop I don't see a Button ( my app of course is running ).

    My folder on desktop with qmlTest app:
    qmltest.png

    So I think I need other files and copy it to my folder on Desktop. But which one?

    VRoninV 1 Reply Last reply
    0
    • Q qwe3

      @VRonin But I see that Button when I run it on QT Creator

      EDIT: Please a link

      EDIT2: My goal was to have QT Widgets app with QML

      J.HilkJ Online
      J.HilkJ Online
      J.Hilk
      Moderators
      wrote on last edited by
      #4

      @qwe3
      use the https://doc.qt.io/qt-5/windows-deployment.html tool

      keep an eye on the --qmldir argument, that is important, when you deploy a qml app or a widget app that uses qml parts


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      3
      • Q qwe3

        Hi,

        I have very simple QML test app. It looks like this:

        Main ( no changes ):

        #include "mainwindow.h"
        
        #include <QApplication>
        
        int main(int argc, char *argv[])
        {
            QApplication a(argc, argv);
            MainWindow w;
            w.show();
            return a.exec();
        }
        

        QML:

        import QtQuick 2.0
        import QtQuick.Controls 2.11
        Item {
            Button {
                text: "Ok"
            }
        }
        

        MainWindow.cpp:

        #include "mainwindow.h"
        #include "ui_mainwindow.h"
        
        MainWindow::MainWindow(QWidget *parent)
            : QMainWindow(parent)
            , ui(new Ui::MainWindow)
        {
            ui->setupUi(this);
            widget = new QQuickWidget(this);
            widget->setSource((QUrl(QStringLiteral("qrc:/test.qml"))));
            widget->move(10,10);
            widget->resize(400,400);
        }
        
        MainWindow::~MainWindow()
        {
            delete ui;
        }
        

        When I run this app from QTCreator, eveything is ok ( I see Button "ok" ). When I run this application from my folder on Desktop I don't see a Button ( my app of course is running ).

        My folder on desktop with qmlTest app:
        qmltest.png

        So I think I need other files and copy it to my folder on Desktop. But which one?

        VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #2
        This post is deleted!
        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          qwe3
          wrote on last edited by qwe3
          #3

          @VRonin But I see that Button when I run it on QT Creator

          EDIT: Please a link

          EDIT2: My goal was to have QT Widgets app with QML

          J.HilkJ 1 Reply Last reply
          0
          • Q qwe3

            @VRonin But I see that Button when I run it on QT Creator

            EDIT: Please a link

            EDIT2: My goal was to have QT Widgets app with QML

            J.HilkJ Online
            J.HilkJ Online
            J.Hilk
            Moderators
            wrote on last edited by
            #4

            @qwe3
            use the https://doc.qt.io/qt-5/windows-deployment.html tool

            keep an eye on the --qmldir argument, that is important, when you deploy a qml app or a widget app that uses qml parts


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            3
            • Q Offline
              Q Offline
              qwe3
              wrote on last edited by
              #5

              @J-Hilk Thank you, but maybe there is a simple solution?

              I check examples: .....\Examples\Qt-5.15.1\quick\quickwidgets and when I move that .exe to folder to the Desktop - I still don't see qml. So:

              qrc:quickwidget/rotatingsquaretab.qml is not a proper path?

              J.HilkJ 1 Reply Last reply
              0
              • Q qwe3

                @J-Hilk Thank you, but maybe there is a simple solution?

                I check examples: .....\Examples\Qt-5.15.1\quick\quickwidgets and when I move that .exe to folder to the Desktop - I still don't see qml. So:

                qrc:quickwidget/rotatingsquaretab.qml is not a proper path?

                J.HilkJ Online
                J.HilkJ Online
                J.Hilk
                Moderators
                wrote on last edited by
                #6

                @qwe3 said in Where is my QML?:

                Thank you, but maybe there is a simple solution?

                thats the simplest solution you can find, literally one command in the command line terminal


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                1 Reply Last reply
                0
                • Q Offline
                  Q Offline
                  qwe3
                  wrote on last edited by
                  #7

                  @J-Hilk I see that you are a person, who understand my problem. I don't undesrtand why in QT Creator it works and on the desktop not.

                  And I would like to have solution, where I don't need extra tools. I would like to solve this using only my app's source code.

                  1 Reply Last reply
                  0
                  • Q Offline
                    Q Offline
                    qwe3
                    wrote on last edited by
                    #8

                    @J-Hilk My problem is not a qrc: I change qrc to QUrl::fromLocalFile. Qt Creator - works, run app from Desktop - not works. So maybe some dll?

                    J.HilkJ 1 Reply Last reply
                    0
                    • Q qwe3

                      @J-Hilk My problem is not a qrc: I change qrc to QUrl::fromLocalFile. Qt Creator - works, run app from Desktop - not works. So maybe some dll?

                      J.HilkJ Online
                      J.HilkJ Online
                      J.Hilk
                      Moderators
                      wrote on last edited by
                      #9

                      @qwe3 you need to deploy your application, if you want to use it outside of qt creator, simple as that

                      to deploy it you can either copy and past by hand everything needed, or you let the windeployqt tool do that job for you, like I suggested


                      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                      Q: What's that?
                      A: It's blue light.
                      Q: What does it do?
                      A: It turns blue.

                      1 Reply Last reply
                      2

                      • Login

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