Applying MVVM pattern in a QtQuick

2019-03-16 04:33发布

问题:

How can i apply MVVM pattern in QtQuick applications?
Can anybody give me any sample (simple) code?

Thanks

回答1:

With a C++ ViewModel

I know someone has done the same thing with a QML ViewModel and bi-directional binding for the text element for example.

Bi-directional binding is done through the binding of the text property to the viewmodel property. Then, add a Binding node to bind the viewmodel property to the text property of the textinput.



标签: qt mvvm qt-quick