Important: Please read the Qt Code of Conduct -

How do you decide which part(s) of an application should use QML?

  • If you're designing a new application, would you try to use QML as much as possible, to the exclusion of traditional widgets? Trying to decide the pros and cons of each. I love the Qt widget set and feel like I'm missing out if I go too far with QML. OTOH QML is probably easier to use in the long run.

    Also trying to figure out if the scope of QML can handle what I need for my next project. I was planning to do it in C++ with traditional widgets but might consider QML if it can handle it. I need:

    • Full HTTP/REST client support - the ability to send arbitrary HTTPS requests including PUT and DELETE, with arbitrary headers, and the ability to parse return headers in Javascript
    • Good JSON integration, both sending and receiving via said REST calls. Should be possible to construct views out of JSON models.
    • Local storage. Looks like this is possible with SQLite

    Would something like this work well with only QML?

    If it would work in QML, then all users would need is qmlviewer or qmlscene, instead of a native compiled executable on each platform.

  • Actually I might need to read other arbitrary local files.

    Maybe I should ask it this way: What kinds of things, if you need to do them, will make you say "oh crud, I can't do that!" if you try in QML?

  • Well, if you have high performance logic, that pretty much has to be C++, since JavaScript is much slower, even on V8 and JIT-ed.

    This goes to all the low level stuff that is not yet supported in QML as well - just do it in C++ and interface what you need to QML.

    Last but not least - QML s still very barebone, and the only way to extend it is... by using C++. You can still do your own components entirely in QML in many cases, but you are limited to what QML provides out of the box.

    QML is MUCH easier than C++, not simply as a language, but as the means to define program structure markup, if you try to substitute QML with the existing C++ APIs you will realize you will need about 10 times as much time to do the same. That is one of the primary reasons "a lot of people have been calling for a modern C++ API": that exposes the QtQuick backend to a neat public API to build Qt Quick applications imperatively in C++ and avoid the extensive interfacing to QML, which is not really applicable in scenarios with a lot of custom functionality with low reuse.

  • Full HTTP/REST, JSON and localStorage is completely possible with QML - I personally used this in several apps. Reading local files will need to be done by extending QML using C++.

Log in to reply