[Interest] Requesting QObject::bind() method
Alejandro Exojo
suy at badopi.org
Thu Mar 23 00:09:25 CET 2017
On Tuesday 21 March 2017 23:49:17 Thiago Macieira wrote:
> So we need the compile-time checking. What can we use to identify the
> property changing? A read-only property that changes has two C++
> identifiers: the getter and the notify signal. And what can we use to
> identify the receiving property? The getter and the setter.
>
> So this new functionality would be:
>
> QObject::bind(sender, &Sender::signalName, receiver,
> &Receiver::setter);
>
> This is exactly connect() we already have.
The challenge is executing a lambda or a slot when any of the depending properties changes. That's
what the QML engine has, and what Olivier blogged about in 2013:
https://woboq.com/blog/property-bindings-in-cpp.html
E.g. imagine that you have two sliders, and the text that you need to display in a label depends on
both. You need to connect to two signals, because you depend on two properties.
--
Alex (a.k.a. suy) | GPG ID 0x0B8B0BC2
http://barnacity.net/ | http://disperso.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170323/b034268a/attachment.html>
More information about the Interest
mailing list