I've been trying to find a way to implement MVVM with PySide but haven't been able to. I think that there should be a way to create Views from ViewModels with QItemEditorFactory, and to do data binding I think I can use QDataWidgetMapper.
Do you have any ideas on how MVVM may be implemented with Qt and PySide? Even if there are some resources in C++ I'll try to translate them to python.
Thanks.
MVVM was a specialization of the MVP (Model-View-Presenter) pattern, and is not specifically unique to WPF, but was part of its inception. I think what you're trying to get at is an MVP to expose your domain model as a view into that domain.
If you want examples in c++, you can see this PDF. However, you can get the gist of it from a terse synopsis in manged c# below:
public class DomainView : IDomainView
{
private IDomainPresenter domainPresenter = null;
///<summary>Constructor</summary>
public DomainView()
{
domainPresenter = new ConcreteDomainPresenter(this);
}
}
Also, I'm wondering you could use the abstract object notation to make passable generics (view models) from your model to your views. Basically, you'd need an intermediary function to flag the relevant parts to serialize.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With