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++?
QtWS25 Last Chance

QML useful if you know C++?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
9 Posts 8 Posters 634 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.
  • T Offline
    T Offline
    transistor47
    wrote on 14 May 2020, 16:57 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

    K T 2 Replies Last reply 17 May 2020, 15:32
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 14 May 2020, 16:59 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
      • F Offline
        F Offline
        fcarney
        wrote on 14 May 2020, 17:14 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
        • J Offline
          J Offline
          johngod
          wrote on 15 May 2020, 12:23 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 17 May 2020, 11:24 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
            • T transistor47
              14 May 2020, 16:57

              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

              K Offline
              K Offline
              KroMignon
              wrote on 17 May 2020, 15:32 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)

              6 1 Reply Last reply 19 May 2020, 04:23
              2
              • T transistor47
                14 May 2020, 16:57

                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 18 May 2020, 16:49 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
                • K KroMignon
                  17 May 2020, 15:32

                  @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 ;-)

                  6 Offline
                  6 Offline
                  6thC
                  wrote on 19 May 2020, 04:23 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.

                  K 1 Reply Last reply 19 May 2020, 06:16
                  0
                  • 6 6thC
                    19 May 2020, 04:23

                    @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.

                    K Offline
                    K Offline
                    KroMignon
                    wrote on 19 May 2020, 06:16 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

                    2/9

                    14 May 2020, 16:59

                    topic:navigator.unread, 7
                    • Login

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