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. QQuickWidget no such file issue
Forum Updated to NodeBB v4.3 + New Features

QQuickWidget no such file issue

Scheduled Pinned Locked Moved Solved QML and Qt Quick
8 Posts 2 Posters 2.3k 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
    RCtaf
    wrote on last edited by
    #1

    Hi,

    i'm having some problems displaying a qml code into a QWidget.
    i'm using in this case QQuickwidget. But every time i use setLocationfrom, its telling me no such file or directory. see the code below !
    i have change the location of the qml file and changed the syntax but still nothing.
    my goal is to display a map in a QWidget
    thanks for your help

        w = new QQuickWidget;
        w->setSource(QUrl::fromLocalFile("file:///D:/ProjetRC/mainie.qml"));
    
    and 
    
    file:///D:/build-ProjetRC-Desktop_Qt_5_10_1_MinGW_32bit-Debug/file:///D:/ProjetRC/mainie.qml: No such file or directory
    1 Reply Last reply
    1
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Did you add

      QT += quickwidgets
      

      to your pro file ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        RCtaf
        wrote on last edited by
        #3

        Yes i did add it.
        and thank you for the welcome.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Did you de-run qmake after doing that ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • R Offline
            R Offline
            RCtaf
            wrote on last edited by
            #5

            Yes , i did ! i cleaned and rebuilded and even close and reopened the project just to be sure but still.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Sorry, I just realized that I missed the real missing file issue.

              Remove the file:/// from your path. Since you are using QUrl to build it, just pass it the path to your file.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • R Offline
                R Offline
                RCtaf
                wrote on last edited by
                #7

                Thank you, its worked ! the error has gone but this appeared instead although the program is running :

                QQuickWidget does not support using windows as a root item. 
                If you wish to create your root window from QML, consider using QQmlApplicationEngine instead. 
                
                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  You have to change the main element of your QML file.

                  Can you share it ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  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