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] How to prevent recompile to see QML-changes?
Forum Updated to NodeBB v4.3 + New Features

[Solved] How to prevent recompile to see QML-changes?

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 4 Posters 5.1k 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.
  • K Offline
    K Offline
    kaivolde
    wrote on 5 Nov 2014, 12:49 last edited by
    #1

    Hi folks,

    I have the following (standard) project-setup:
    main.cpp-file which loads then main.qml-file
    some qml-files which are placed in a resource-file (qrc)
    I have done some qml-extensions in c++ how it is described here: http://qt-project.org/doc/qt-5/qml-extending-tutorial-index.html

    Problem: If I do a change in a qml-file, I don't see an effect, if I just restart the application (in Creator). I always have to recompile the code. I would expect this behaviour for changes in the C++-code, but for the QML?

    What am I doing wrong?

    Thanks in advance.
    Best regards Kai

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leonardo.ramosantos
      wrote on 5 Nov 2014, 12:59 last edited by
      #2

      Hi there.

      This happens because the qml file you are editing is inside the resource file. Resource files are compiled and stay inside executable. Thus, when you modify a qml that is within resource file, the compiler needs to recompile the resource file to put within executable and recompile the executable.

      I hope I have helped you.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kaivolde
        wrote on 5 Nov 2014, 14:18 last edited by
        #3

        So,

        during development it's not a good idea to put qml's into qrc's.

        Thanks a lot. Best regards
        Kai

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rolias
          wrote on 6 Nov 2014, 03:31 last edited by
          #4

          I don't know, I like putting my qml into the qrc during development. I just click on the (big green) run button after making QML changes and it saves, compiles and builds in a few seconds so I don't consider it a hardship. At one point nested QML wasn't automatically rebuilding but in the latest releases it works. The compile only builds what it needs to (as opposed to a rebuild), so it's typically pretty fast in my experience.

          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
          • T Offline
            T Offline
            Torgeir
            wrote on 10 Nov 2014, 15:04 last edited by
            #5

            I also put qml files into qrc right from the start.

            In addition I hook up a shortcut F5 to reload qml from disk. This way I can edit qml files and instantly see the changes in the running application.

            My shortcut reload slot has the lines

            @
            view->engine()->clearComponentCache();
            view->setSource(
            QUrl::fromLocalFile("c:/path/to/main.qml"));
            @

            It's after setting up this you really get to experience the Quick in QtQuick :-)
            I used to believe it was about rendering performance, but it's as much about developer productivity.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kaivolde
              wrote on 14 Nov 2014, 21:07 last edited by
              #6

              Thanks again, it is always a pleasure to get such qualified answers.

              • I had this strange misbehaviour, which I described in my first post.
              • To test the problem again, I started the same project from scratch.
                This time the problem did not occur. So I was able to see my
                QML-changes at once without recompile. So I think I had a
                misconfiguration in my old project or there is a (little) bug somewhere
                in the build-system.
              • @Rolias: Same with me. Having the qml's in the qrc is comfortable. You
                don't have to care for file locations and so on.
              • @Torgair: If I understand correctly, you bind the shortcut into every
                application which you develop, so you can edit and test your qml at
                runtime. Is it correct? Perfect trick.

              Thanks again
              Kai

              1 Reply Last reply
              0

              1/6

              5 Nov 2014, 12:49

              • Login

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