[Interest] Are slots even needed these days?

Constantin Makshin cmakshin at gmail.com
Thu Mar 17 21:35:46 CET 2016


Yes, but, as you said, it's just a hack meant to circumvent C++'s member
visibility system. A rather ugly hack easily detectable by simply grepping
the source code (in a pre-commit hook, for example -- presence of
QMetaObject::invokeMethod() calls outside some parts of Qt itself may be a
good sign that somebody wants to do something weird).
Direct method call, on the other hand, is less likely to both cause
suspicion in anyone looking at the code and to be found by automatic tools.
On Mar 17, 2016 6:37 PM, "Thiago Macieira" <thiago.macieira at intel.com>
wrote:

> On quinta-feira, 17 de março de 2016 08:23:48 PDT Constantin Makshin wrote:
> > Another thing I personally don't like in the new connection syntax is
> > that it forces signals to be public, making it possible to do all type
> > of wonders by faking/simulating events on behalf of other objects.
> >
> > For example:
> > QLineEdit* edit = new QLineEdit("foo");
> > // ...
> > edit->textChanged("bar");
>
> You could do it in a round-about way in Qt 4 by using
> QMetaObject::invokeMethod.
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160317/04ccddd2/attachment.html>


More information about the Interest mailing list