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. QML to .exe
Forum Updated to NodeBB v4.3 + New Features

QML to .exe

Scheduled Pinned Locked Moved QML and Qt Quick
27 Posts 7 Posters 18.4k 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.
  • T Offline
    T Offline
    tobias.hunger
    wrote on last edited by
    #21

    This is mostly interesting to demo something on a mobile device and not so much for a desktop application.... but try this to get a .pro file that can get used to build an executable able to display your QML:

    • Update creator to 2.1 beta. We did improve the templates for QML based projects there a lot.
    • Set up a new project: File->New File or Project.
    • Select "Qt Quick Project" and then "Qt Quick Application". A wizard opens when you click on OK.
    • Provide a new project name and a directory to store the project (in a subfolder named like the project name you are giving!) in. Next.
    • Select a Qt version (4.7.1 is preferred nowadays) in Desktop. Add mobile devices if required (and you have the support installed). Next.
    • You can ignore the next page of the wizard, it is only relevant for mobile devices. Next.
    • Select "new main.qml file". Next.
    • Click next on the summary page. Next.

    Now you will have a .pro-file based project that displays a freshly generated main.qml file. Copy your existing qml files and resources into the project folder into qml/PROJECTNAME and rename your main qml file to main.qml there. Do Build->Run qmake to force a refresh of the file list in the Makefiles. It should pick these changes up automatically, but it may take a while for it to do so.

    You should now be able to build and run it by clicking on the play button in the lower left of the creator window. You can of course also open the .pro file with the visual studio plugin and build it there.

    For mobile devices you can now create packages of all the contents which are nice and easy to deploy... but for the desktop you get an executable but all the QML files, images, etc. still need to get copied to a place where the exe actually finds them.

    So unfortunately you do not gain much to just copying the qmlviewer (which actually is the program used by creator to preview your QML files) plus your qml files and resources in your use case. In both cases you will need to put the required libraries next to the executable (in windows, Linux usually has Qt packages installed in the system and picks up libraries in a different way, too). This does include the various plugins Qt uses... most straight forward way is to just copy everything in the lib/ directory found in your Qt.

    Please consider filing a feature request describing your use case in "our bug tracker":http://bugreports.qt.nokia.com/. I think this is certainly a valid use case and we should improve creator to handle it better.

    1 Reply Last reply
    0
    • X Offline
      X Offline
      xsacha
      wrote on last edited by
      #22

      QtCreator 2.1 RC is available now and apparently the wrapper (which is the only thing you want) is improved in it.

      Basically, you'll want QtCreator and to follow Tobias' instructions above just to get the wrapper files on disk.
      Then you can open this in msvc afterwards if you prefer and it should work if you have env settings right.

      The wrapper is just a qmlviewer with your qml files wrapped inside it. You'll still need to include whatever dlls the project uses.

      • Sacha
      1 Reply Last reply
      0
      • G Offline
        G Offline
        gcameo
        wrote on last edited by
        #23

        Hi All,
        I have followed this post to the latter but still cant get a simple standalone executable. My application runs fine from the QtCreator 2.1 RC but if I go to the release folder itself and double-click the .exe in there, I get an empty window. I dont know what else to do. I'm using the latest versions of QT and QT Creator.

        The only difference is that my operating System is a 64 bit Vista. I had dll issues before but I have resolved all of them and it doesn't complain about them anymore but the Application window is completely empty.

        Any ideas what I could be doing wrong.

        Also a simple Hello World application tutorial or a zip of the source files that shows the process from a qml file to a standalone executable will be greatly appreciated.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tobias.hunger
          wrote on last edited by
          #24

          gcameo: Did you make sure to put all the required libraries next to the executable?

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gcameo
            wrote on last edited by
            #25

            Hi, I did not put the executables next to it. I put them on the system path so they can always be found. Do I have to put them there? I opened the executable in dependency walker software and it shows the following dlls missing

            SHLWAPI.DLL

            IEFRAME.DLL

            could that be the problem.

            Thanks

            1 Reply Last reply
            0
            • G Offline
              G Offline
              gcameo
              wrote on last edited by
              #26

              [quote author="gcameo" date="1294167925"]Hi, I did not put the executables next to it. I put them on the system path so they can always be found. Do I have to put them there? I opened the executable in dependency walker software and it shows the following dlls missing

              SHLWAPI.DLL

              IEFRAME.DLL

              could that be the problem.

              Thanks[/quote]

              It also says something is missing about this file

              GPSVC.DLL

              Any clues?

              Thanks

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Muhammad
                wrote on last edited by
                #27

                Did any body came with any thing with this?

                I don't have endpoint, I just have Checkpoints.

                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