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. [SOLVED] Qt Quick Application: empty window
QtWS25 Last Chance

[SOLVED] Qt Quick Application: empty window

Scheduled Pinned Locked Moved QML and Qt Quick
8 Posts 5 Posters 7.1k 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.
  • S Offline
    S Offline
    Sht1rlitz
    wrote on last edited by
    #1

    Default project 'Qt Quick Application' created and maked. It shows "Hello World" on 'Ctrl+R', but exe running give empty window. Any idea? Thanks!

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      Looks like your qmls are located in wrong path.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dialingo
        wrote on last edited by
        #3

        Unfortuantely the default project does not pack the qml file into a resource. That means the qml-file may get lost easily. The build script has deployment options to copy the qml file, however I find this very brittle. Bottom line:

        • Make sure that the qml file is located where it is expected by the executable.
        • To get a stable solution put the qml file in a resource.
        1 Reply Last reply
        0
        • S Offline
          S Offline
          Sht1rlitz
          wrote on last edited by
          #4

          Ok. Thank you!
          Can you explain me about putting qml into resource, please?

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dialingo
            wrote on last edited by
            #5

            Sure:
            Select in Creator: File->New->Qt->Resource file
            This will add a resource file to your project and give you a graphical editor that permits to select files which will be included in the binary file. Next step is to access the files that reside inside your executable:

            As URL:

            @QDeclarativeView view;
            view.setSource(QUrl("qrc:qml/myqmlfile.qml"));@

            To access the file itself:
            @QFile file(":qml/myqmlfile.qml");@

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Sht1rlitz
              wrote on last edited by
              #6

              Yeah! Excellent! Thanks a lot!

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

                I'm having the same issue, but these suggestions didn't help.

                I'm using the newest version of QT Creator on Windows 8.

                It works perfectly if I go to the debug build directory and double click on the .exe file, but when I run the applications from Qt Creator using the big great play button it just shows an empty window.

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  Rolias
                  wrote on last edited by
                  #8

                  The latest versions of Qt Creator take care of the original problem stated here because the main.qml file is put inside a qml.qrc resource file by default. Did yours do this? If not you might not be on the latest (right now 5.2.3 - but its been doing this for a while). Other than that I would suggest taking a look at the Projects mode and switch to the Run tab and see if possibly something got mucked up on the Working Directory line. It should point to that same folder where you are manually double-clicking.

                  Check out my third course in the trilogy on Qt
                  "Integrating Qt Quick with C++"
                  http://bit.ly/qtquickcpp
                  published by Pluralsight

                  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