[Solved]Someone already built more complex applications in QML?
-
I would like to create more complex applications using QML. but only find information regarding components, trivial and silly things.
Does anyone have a link on calling QML in QML or using SQL and signs?
-
Well, every application is made out of those trivial and silly things. I am not aware of a complex application already available, but I for sure know there is one in the works, check "this talk":http://www.youtube.com/watch?v=kvWeE3kurEQ&list=PLizsthdRd0YzYe5T3Txgg7TUGVi-ijq4d&index=47 out.
Multiple viewports, 3D geometry, simulations - it is pretty complex IMO.
-
See http://qt-project.org/wiki/QtMediaHub for an example.
Remember that most of the business logic of serious applications should be written in C++, and that QML should just be used for the UI layer - so depending on your definition of "serious application" the amount of actual QML code in it might be quite minimal. I expect that more such applications will be written once the Qt Quick Controls are released, also.Cheers,
Chris. -
I've been developing desktop industrial applications in C++ + QML on Windows for about 1.5 years now. It started because management wanted a clear and consistent and branded design for all applications. Therefore I asked for 1 week to evaluate if QML would be a good fit for our UI/UX needs.
Well... after that 1 week, I not only had evaluated, but had most of the application working! I was a bit shocked about that productivity boost and have never looked back.
We then had a designer that sketched the GUI in Photoshop. After two days we had implemented that design in QML pixel perfect. The guy from management was totally surprised: "You did that in two days? I thought it would take 2-4 weeks!"
Like Chris says, 90% of the application is still C++. The C++ backend exposes Properties, Signals and Models to QML as well as Slots that QML can call. There's practically no code that "looks" like JavaScript. All use of JavaScript is 1-3 liners and they are usually simple boolean or mathematical expressions or aggregations of parameters for a call of a slot in C++.
We don't use Qt Quick Controls (yet), but probably will in the future. We made our own components for Button, ScrollBar, LineEdit, TextArea, DropDownList, Slider as well as several custom controls that are specific for our application.
At first glance at QML I thought "where is PushButton? I have to implement that myself?". Well, I still use that PushButton that was the first thing I did in QML. In fact, for our need it would have been more work to use CSS stylesheets for QPushButton than it was to create it from scratch in QML. Also for the rest of the components we spent surprisingly little time implementing them.
For application specific components, QML really shines. We now have a UX that is exactly what we want. The user can manipulate application specific elements directly and intuitively. Also, it is very easy to get the behavior of the user interface correct wrt enabling or disabling or visibility of controls. In C++, imperative GUI code would be littered with setEnabled(true)/setEnabled(false) for various state changes. In QML it's a one-liner directly on the control itself:
@enabled: thisState || thatState || (lineEdit.activeFocus && lineEdit.hasChangedInput)@
With widgets what we do would only be possible with a lot of custom widgets. It would be a lot of work and we'd probably end up not doing it and stick with many QLineEdits and QPushButtons for the user to affect changes.
Using QGraphicsView directly it would be easier to get the same results, but it would be more code to write and maintain and more work to change the GUI afterwards. Using QML I implemented a hotkey to reload the QML so we are working in a way that is very very close to "live coding". The productivity boost is amazing and the runtime performance of QtQuick 1.1 is essentially the same as QGraphicsView. Now that we are using QtQuick 2.0 it is even much better than that.
-
Another, publicly available example might be "Snoeshow":http://snowshoe.openbossa.org/ (which is now part of the "QtProject":https://qt.gitorious.org/qt-apps/snowshoe).
-
Look at Ubuntu Touch Core apps: https://launchpad.net/ubuntu-phone-coreapps
-
Thanks for the info I feel safe now to develop in Qt