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": 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.

  • Qt Champions 2017

    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.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.