I need an example for MVVM architecture, where the view is in QML and MODEL, VIEWMODEL in CPP. I want to understand how it works.
-
wrote on 7 Jan 2021, 14:35 last edited by
I am trying to understand MVVM architecture and I need a good example code so that I have a clear understanding of how the architecture actually works . Any kind of help will be greatly appreciated, Thank you in advance.
-
Hi,
From the looks of it, you do not need MVVM using Qt Quick and C++ models. QtQuick already provides the binding part and does not require you to write business logic unless you want to.
-
Hi,
From the looks of it, you do not need MVVM using Qt Quick and C++ models. QtQuick already provides the binding part and does not require you to write business logic unless you want to.
wrote on 8 Jan 2021, 03:09 last edited by@SGaist hello, I have worked with model view architecture before and integrated CPP and QML and it worked fine, but I want to know how to develop the communication using MVVM architecture.
-
It is hard to give such an ready made example.
Just give high level view- ViewModel(C++ class) provides the data bindings directly to View(QML)
- Model may be simple c++ class, gets the data from appropriate sources & keeps it. This may or may not be Qt Model.
- ViewModel get the only required data from Model. It may apply filters or format it or convert & makes it presentable to view directly using the bindings.
1/4