MVVM / MVP and QML
I am comletely new to phone development, but watching a few videos, tutorials, and knowing a great deal of C++, I have come to the conclusion suggested by others, that the best approach to cross-platform development, is to try to write the application logic once, and then write the UI multiple times for each platform.
Making friends with XAML for WP8 further strengthened this opinion of mine. Creating UI with Visual Studio Blend is extremely fast, and editing the generated XAML file is as easy as it can get. Wonderful tools, really. The entire VS+Blend+XAML is designed around the pattern MVVM. It seems to me as if Qt would be goind something very similar.
XAML >> QML
INotifyProperty >> Q_PROPERTY
Delegates/Commands >> Signal/Slot
- Are my assumptions right, that the very same MVVM pattern could be implemented using QML?
Unfortunately, the MVVM pattern uses the Model solely to store data, and most of the application logic is inside the ViewModel, plus Views yet again are platformspecific. I wanted to put most, if not all of my logic into the Model, that would be completely portable, as it would be pure C++11. The ViewModel would only mediate between the View and the Model, converting the data (or simply exposing it) using platform specific machinery. In WinRT case, that would be XAML and it's data binding, and in Qt's case it would be it's own data binding mechanism. Some logic (mostly 3D) that is dependant on the type of View even at the Model level naturally have to be elevated to the ViewModel level, in which case it would do actual work. Other than these performance-critical sections, ViewModel need not do anything, than relaying the Model data.
- Is this MVVM at all? Does this make sense in terms of Qt? (and in terms of WinRT?)
I do not believe in me being able to rapidly prototype an Android, WP8 type interface quickly. I would like to idea of having to use only a single tool and get natively looking UI on all platforms, and Qt has proven it's capabilities on the desktop, but I have doubts about WP8.
- Can QML create WP8 UI that translates to something looking completely identical to the built-in HUB, etc. WinRT Views?
I got the exact same feeling that Qt/QML and .NET/WPF cover the same pattern and that MVVM could be implemented in Qt/QML as well. I found an example on the web, that tries to give an example of how to do this:
Also, there was a talk on the Qt Dev Days 2013 about a related topic:
However, I am as well pretty new to QML and cannot tell you anything from real live experiences. So I would be really interested in the opion of the community, too.