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 because "text" is a string and would require a > conversion. But let's say we're connecting a slider to a QProgressBar. You > can just write: > > QObject::connect(slider, &QSlider:valueChanged, > &progressBar, &QProgressBar::setValue);
And your other example: > QSlider *slider = .... > QLabel *label = .... > QObject::bind(slider, "value", label, "text", [](const QVariant &v) { return > v.toInt()*2; }); Would be: QObject::connect(slider, &QSlider::valueChanged, &label, [label](int value) { label->setText(QString::number(value * 2)); }); 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. 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. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest