Version 2.0

60min: How to interface non-Qt Model code with QML?

What is the bridge from a non-Qt Model to a QML View layer


The Model-View-ViewModel (MVVM) pattern allows separation of concerns
which is compatible with Qt/QML guidelines. However, some challenges
remain which can be resolved with particular design of the ViewModel

Implementing a standalone QML UI is easy and quick. When complexity
grows, it can make sense to move some parts of the implementation to
C++, using QObject subclasses with Q_INVOKABLE and Q_PROPERTY macros
to interface to QML code. That can work well, particularly when the
lifetime of those QObjects is compatible with QML object lifetimes. In
this scenario, the C++ QObjects have a role of Model or ViewModel, in
an MVVM design.

However, when the Model in the design does not use Qt, or when the
lifetime or ownership concepts used for Model objects don't correspond
well to QML ownership semantics, things get more complex.

This talk explores some of the possible solutions and variables in the
design space to create a maintainable, declarative and testable ViewModel
layer to interface between a non-Qt Model and a QML View.


Day: 2016-09-02
Start time: 11:30
Duration: 01:00
Track: Best practices



Click here to let us know how you liked this event.