On Wednesday 21 September 2011 19:09:11 ext Thiago Macieira wrote:
> > Is it really nessecairy that _everyone_ has public access to the signal?
> > What if only QObject had access to it? Would that work? If so, it could
> > work to just make QObject a friend class of every class that has the
> > Q_OBJECT macro defined, right? Could that work?
>
> I don't know what you mean here. The access rights are only these: public,
> protected, private.
>
> If I need to write &MyClass::signalName in my code, then I need signalName
> to be public or that my code is a friend of MyClass. Listing all possible
> classes that may want to connect to the signals is an impossible task.
>
> So public is the only option.
Why doesn't a class simply provide public connector method templates for the
not so public signals?
// Very simplified example
class Xyz
{
private:
void eventHasHappened(); // A signal
public:
template<...>
void connectToEventHasHappened(...)
{
connect(...);
}
};
Xyz xyz;
xyz.connectToEventHasHappened(...);
I admit that figuring out the template syntax is not something for everybody.
_______________________________________________
Qt5-feedback mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback