What is the best way for connecting for example a double signal to a QString slot in QT? Since these signals and slots are incompatible, a direction connection is not possible. Is there any mechanism similar to the Value Converters used in WPF data binding for achieving this in QT?
I could implement my own double slot which then emits my own QString signal, but it just feels like a lot of work for a simple value conversion. Are there other ways?
Other than creating an adapter QObject, there is no such thing, unfortunately. The weirdest subversion of argument passing Qt allows is to connect a signal with arguments to a slot without parameters (the arguments are ignored) and to mix and match Type
and const Type&
(I'm not 100% sure on this).
You can go crazy with the adapter though, by reimplementing the qt_metacall
method and using different strategies for conversion and signal/slot arity. It's a considerably big (and fun) task if compared to simply creating a double slot.