5

Coming from Java and .NET, I have become used to declaratively binding domain objects to UI controls. It seems like there is not really an established idomatic way of bidirectionally connection (non-Qt) domain objects and Qt-objects. Implementing the signal-slot mechanism in the domain objects would obviously pollute the core domain model and introduce unwanted dependencies.

I know that database binding is available, but this is not my use case.

What's the practice for large Qt projects in this regard?

1
  • 3
    Have you had a look at 'QAbstractItemModel` as an adapter between your domain objects and the Qt world and QDataWidgetMapper for your binding?
    – RobbieE
    Aug 30, 2014 at 6:58

1 Answer 1

2

Signals and slots are the way to go if you want to use loose coupling in Qt. Of course you need Qt objects for this. And yes, you will "pollute" your core model that way. If you want to avoid this kind of "pollution" (which is accepted in most Qt projects) you need to use standard C++ patterns.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.