Re: [Interest] Requesting QObject::bind() method

2017-03-24 Thread alexander golks
Am Fri, 24 Mar 2017 10:52:47 +0100 schrieb Jean-Michaël Celerier : > On Fri, Mar 24, 2017 at 12:50 AM, Thiago Macieira > wrote: > > > > > The new value is already carried by the signal. We don't need the getter: > > my > > code examples already compile. > > > > I really think that we do. >

Re: [Interest] Requesting QObject::bind() method

2017-03-24 Thread Sean Harmer
On 23/03/2017 23:57, Thiago Macieira wrote: On quarta-feira, 22 de março de 2017 16:09:25 PDT Alejandro Exojo wrote: 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://wobo

Re: [Interest] Requesting QObject::bind() method

2017-03-24 Thread Jean-Michaël Celerier
On Fri, Mar 24, 2017 at 12:50 AM, Thiago Macieira wrote: > > The new value is already carried by the signal. We don't need the getter: > my > code examples already compile. > I really think that we do. For instance in the following code: #include #include #include #include int main(int arg

Re: [Interest] Requesting QObject::bind() method

2017-03-23 Thread Thiago Macieira
On quarta-feira, 22 de março de 2017 16:09:25 PDT Alejandro Exojo wrote: > 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.htm

Re: [Interest] Requesting QObject::bind() method

2017-03-23 Thread Thiago Macieira
On quarta-feira, 22 de março de 2017 03:26:21 PDT André Somers wrote: > That's not quite true. First of all, you are not referencing the getter > in the example above. Then, a ::bind would also initialize the receivers > value to the current value. Qt::connect does not do that. Also, a ::bind > sug

Re: [Interest] Requesting QObject::bind() method

2017-03-23 Thread Thiago Macieira
On quarta-feira, 22 de março de 2017 05:50:47 PDT Jean-Michaël Celerier wrote: > > QObject::bind(sender, &Sender::signalName, receiver, &Receiver::setter); > > > > This is exactly connect() we already have. > > I think that bind adds one more step : it does the set. ie. bind would be : > >

Re: [Interest] Requesting QObject::bind() method

2017-03-22 Thread Alejandro Exojo
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 prope

Re: [Interest] Requesting QObject::bind() method

2017-03-22 Thread Jean-Michaël Celerier
> QObject::bind(sender, &Sender::signalName, receiver, &Receiver::setter); > This is exactly connect() we already have. I think that bind adds one more step : it does the set. ie. bind would be : QObject::bind(sender, &Sender::signalName, &Sender::getter, receiver, &Receiver::setter); and

Re: [Interest] Requesting QObject::bind() method

2017-03-22 Thread evilruff
>> This is exactly connect() we already have. >> > That's not quite true. First of all, you are not referencing the getter > in the example above. Then, a ::bind would also initialize the receivers > value to the current value. Qt::connect does not do that. Also, a ::bind > suggests that the conne

Re: [Interest] Requesting QObject::bind() method

2017-03-22 Thread André Somers
Op 22/03/2017 om 07:49 schreef Thiago Macieira: > Em terça-feira, 21 de março de 2017, às 22:58:38 PDT, Thiago Macieira > escreveu: >> Em terça-feira, 21 de março de 2017, às 19:38:19 PDT, Prashanth Udupa >> >> escreveu: >>> QSlider *slider = ... >>> QLabel *label = >>> QObject::bind(slider

Re: [Interest] Requesting QObject::bind() method

2017-03-22 Thread Prashanth Udupa
Hi Thiago, > But let me put it this way: will not accept new text-based API for signal, > slots and properties in QObject. You can do that externally, as you've done > it, but I won't take it in QtCore. Ok. > So we need the compile-time checking. What can we use to identify the > property > c

Re: [Interest] Requesting QObject::bind() method

2017-03-21 Thread Thiago Macieira
Em terça-feira, 21 de março de 2017, às 22:58:38 PDT, Thiago Macieira escreveu: > Em terça-feira, 21 de março de 2017, às 19:38:19 PDT, Prashanth Udupa > > escreveu: > > QSlider *slider = ... > > QLabel *label = > > QObject::bind(slider, "value", label, "text”); > > This is a bad example be

Re: [Interest] Requesting QObject::bind() method

2017-03-21 Thread Prashanth Udupa
Hi Thiago, > This is a bad example because "text" is a string and would require a > conversion. True, but it is something that comes up a lot in applications. For instance, I want to allow users to (say) alter opacity using a slider. As the user changes opacity, I might want to show that value

Re: [Interest] Requesting QObject::bind() method

2017-03-21 Thread Thiago Macieira
Em terça-feira, 21 de março de 2017, às 19:38:19 PDT, Prashanth Udupa escreveu: > QSlider *slider = ... > QLabel *label = > QObject::bind(slider, "value", label, "text”); This is a bad example because "text" is a string and would require a conversion. But let's say we're connecting a slider

[Interest] Requesting QObject::bind() method

2017-03-21 Thread Prashanth Udupa
Hello All, QML offers property binding, which is supremely useful. So, in a QML code like this Item { id: oneItem width: anotherItem.width * 2 } Whenever anotherItem’s width changes, oneItem’s width is recomputed. From what I have seen we don’t have a direct way to make this kind of thi