Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt: data binding

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?

like image 209
pmf Avatar asked Nov 01 '22 18:11

pmf


1 Answers

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.

like image 155
Silicomancer Avatar answered Nov 15 '22 09:11

Silicomancer