[Interest] Requesting QObject::bind() method

Prashanth Udupa prashanth.udupa at gmail.com
Wed Mar 22 07:11:53 CET 2017


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 in a label. Sure, we can use a spin box also. But the point is that such a use case is not inconceivable. Another example: we might want to offer color selection on a color palette, but show its name in a label OR its RGB values in 3 separate labels (or line edits).

> But let's say we're connecting a slider to a QProgressBar. You can  just write:
> 
> QObject::connect(slider, &QSlider:valueChanged, &progressBar, &QProgressBar::setValue);

Yes, of course. I suggest QObject::bind() for other cases.

We have classes with properties having notification signals, but they don’t emit the changed value as parameter in the signal. I am not talking about classes in Qt library, but other Qt based libraries. For such classes QObject::bind() would be useful, I think.

Thanks,
Prashanth




More information about the Interest mailing list