> > I still see a problem in making signals public, this > > completely breaks encapsulation, and makes it possible > > for everyone to emit any signal. > > There's no way around it. Since we're using the function pointer > (actually,
One way around it would be "on-the-fly inheriting": https://qt.gitorious.org/~syntheticpp/qt/qtbase-staging-improvements/commit/c1cf86f08fca7efbbf03106756d4c5bbd991664c Maybe this commit could be the starting point for a better 'QObject::connect' replacement. Peter > the PMF) to identify the signal, you must have C++ access to the signal > function. That means you must be able to call it. > > Other template-based signal libraries have the same problem. It cannot be > avoided unless you have a way to identify the signal which doesn't include > access to the actual signal implementation. > > One solution to that would be to have an enum of signals, instead of > identifying by an object or by a PMF. However, handling enums is not very > easy, since extending the range becomes cumbersome -- how do you add a new > signal to a class that has been derived from? > > As the old adage says, "all problems in C++ can be solved with another > level > of indirection". So we can create an indirection layer to the enums (the > numeric IDs) and map at runtime. The easiest way of doing that is to have > a > string-based approach. However, C++ has no reflection mechanism, so either > you're forced to write the string-matching code yourself, or you have to > use a > code generator. > > And then we're right back where we started: moc and the current syntax. > > -- > Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org > Software Architect - Intel Open Source Technology Center > PGP/GPG: 0x6EF45358; fingerprint: > E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358 -- NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie! Jetzt informieren: http://www.gmx.net/de/go/freephone _______________________________________________ Qt5-feedback mailing list [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback
