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 useful if you know C++?
Forum Updated to NodeBB v4.3 + New Features

QML useful if you know C++?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
9 Posts 8 Posters 811 Views 2 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.
  • transistor47T Offline
    transistor47T Offline
    transistor47
    wrote on last edited by
    #1

    Hello everyone,

    a question. If you know C ++, is learning QML useful? I do not understand what real use it has (I do not want to cause discomfort to anyone)

    Thanks in advance

    KroMignonK T 2 Replies Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      It depends on the type of application you are going to write.

      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
      • fcarneyF Offline
        fcarneyF Offline
        fcarney
        wrote on last edited by
        #3

        There are things QML just won't do, or won't do easily. For our applications we do visual stuff in QML and the working meat of the program in C++.

        C++ is a perfectly valid school of magic.

        1 Reply Last reply
        1
        • johngodJ Offline
          johngodJ Offline
          johngod
          wrote on last edited by
          #4

          After I started using Qml, I only use c++ if absolutly need. Qml is much fun and faster to write. The Qml declarative language, the bindings and event handlers, after you get the grip of how it works, can make the logic easier and the code cleaner. Of course all depends of the type of app.

          1 Reply Last reply
          2
          • R Offline
            R Offline
            Ray Gray
            wrote on last edited by
            #5

            There is no need for qml - if you like the feel and look of Windows 3.1!

            1 Reply Last reply
            0
            • transistor47T transistor47

              Hello everyone,

              a question. If you know C ++, is learning QML useful? I do not understand what real use it has (I do not want to cause discomfort to anyone)

              Thanks in advance

              KroMignonK Offline
              KroMignonK Offline
              KroMignon
              wrote on last edited by
              #6

              @transistor47 QML is not required to develop a Qt application, but I can help you to quickly create a graphic user interface. Much more as doing all in pure C++.

              But there are some dark sides when using QML:

              • QML is a JavaScript based language, and uses a embedded JavaScript engine.
              • QML is slow and requires much more memory as a pure C++ application
              • QML is compiled on the fly, so you can never be sure there is no typo is your QML as long as not all code has been covered!
              • When a QML error occurs, the QML engine just stop execution at the error and all rest of your QML is not executed, this can be very hard to find!

              So my recommendation is to use QML only to create the GUI, do all logical work in C++. This will save you many time and avoids you even more frustration!
              Doing this at the beginning of development is the best you can do.
              Of course you could do many things in QML, don't get caught by the dark side of the force ;-)

              It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

              6thC6 1 Reply Last reply
              2
              • transistor47T transistor47

                Hello everyone,

                a question. If you know C ++, is learning QML useful? I do not understand what real use it has (I do not want to cause discomfort to anyone)

                Thanks in advance

                T Offline
                T Offline
                Tom_H
                wrote on last edited by
                #7

                @transistor47 IMO, QML is much nicer to work with than C++. It is by far the best declarative UI language I've seen. The classic advice you'll hear, as @KroMignon said, is to do the UI in QML and the application logic in C++. But once you've taken the decision to use QML for UI, there's nothing to stop you from using it for application code, other than dogma. I chose a hybrid approach. In addition to UI, I use QML for sqlite database access, because it is so much easier and nicer to do it in QML than C++. Just take a look at some examples and you'll see what I mean. Also, because all my database access is in response to UI events, it's natural to handle it from QML. Furthermore, there's no performance hit because it simply wraps the sqlite C library which does all the real work.

                Don't be afraid of the dark ;-)

                1 Reply Last reply
                0
                • KroMignonK KroMignon

                  @transistor47 QML is not required to develop a Qt application, but I can help you to quickly create a graphic user interface. Much more as doing all in pure C++.

                  But there are some dark sides when using QML:

                  • QML is a JavaScript based language, and uses a embedded JavaScript engine.
                  • QML is slow and requires much more memory as a pure C++ application
                  • QML is compiled on the fly, so you can never be sure there is no typo is your QML as long as not all code has been covered!
                  • When a QML error occurs, the QML engine just stop execution at the error and all rest of your QML is not executed, this can be very hard to find!

                  So my recommendation is to use QML only to create the GUI, do all logical work in C++. This will save you many time and avoids you even more frustration!
                  Doing this at the beginning of development is the best you can do.
                  Of course you could do many things in QML, don't get caught by the dark side of the force ;-)

                  6thC6 Offline
                  6thC6 Offline
                  6thC
                  wrote on last edited by
                  #8

                  @KroMignon

                  hopefully it's not too long we will see native typed QML and finally never speak of javascript (I think I could be sick) again.

                  KroMignonK 1 Reply Last reply
                  0
                  • 6thC6 6thC

                    @KroMignon

                    hopefully it's not too long we will see native typed QML and finally never speak of javascript (I think I could be sick) again.

                    KroMignonK Offline
                    KroMignonK Offline
                    KroMignon
                    wrote on last edited by
                    #9

                    @6thC I think you talking about Qt6/QML3, but as far as I know this is a completely new implementation, which kick-out the JavaScript engine to made it compilable and strong typed.
                    So nothing comparable with actual Qt5/QML2, and not necessary compatible too!

                    It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                    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