Command pattern with QML
-
I want my business logic to be in C++ and front end in QML. I also want do/undo functionality. How can we implement command pattern emanating from QML and disptach to model?
The problem I see is I don't know if its possible pass back C++ classes between QML and C++ model? Any clues will be deeply appreciated. Thanks.
-
Hi,
Did you try "QML Plugin":http://doc.qt.io/qt-5/qtqml-modules-cppplugins.html? I think in your case this will be a best way. If you create a QML plugin with logic on C++ you can porting it to another platform.
If you need to send some datas from QML to C++ you can create a method which you will call from QML. If you need to get datas from C++ you can use method or signal. Please read documentation about QtQuick Plugin for more information.
-
Did you get a chance to look at how to integrate C++ and QML ? QtAssistant provides good examples for this integration. You will be able to solve your issue.