Starting out with QML, looking to get some recommendations



  • So apparently there are two ways to use QML and c++ together, loading QML bits into C++, or loading C++ bits into a QML app.

    I'm wondering if there is any particular reason I might want to choose one over the other. I'm going to be writing an application that will have a couple of background threads that signal progress to a main window. I know I want my main window to be QML but I keep bouncing back in forth between using qmlRegisterType to load a c++ class into QML or use QmlDocument to load a qml view into c++ class.

    I'm having hard time finding good sources for examples, most of the examples I've found didn't show everything or something, and I had a hard time replicating it. I was hoping I could find QML series of videos like youtube's VoidRealm's Qt series, since thats the majority of where I learned how to program in Qt. Unfortuneatly I just found a dood tutorial of how to make a golden monkey head with dancing penguins! I feel spoiled.



  • This is a difficult topic and it cannot really be answered without knowing more about the scope or type of your project. Here is a recent article about the role of C++ in QML that you might find interesting: http://alan.imagin-itis.net/?p=444

    • If you have a large chunk of existing widget code or you know you will be needing (currently) widget specific functionality such as Dock widgets, tree views, etc, you will anyway have to go for embedding QML. This is what Qt Creator does as it's main code base is based on widgets.

    • If you are writing a new UI in Qt Quick, I would lean towards registering types to QML. This will give you a clean distinction between front end and what have to go into the backend and will make it almost trivial to write a completely new UI on a new platform.





  • Excellent thanks, I think we started off with with pulling QML into qt widgets because it was easier, but we are separating the UI with our back end now, we might swap it for the distinction.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.