On Wednesday 21 September 2011 19:20:06 Thiago Macieira wrote:
> We've been looking at this for a year. If anyone has more interesting ideas,
> they are more than welcome. But please try to write the proof of concept
> first.


I almost managed to get the signal private:


class Foo {
public:
    class Signal {      //This would be in the Q_OBJECT macro.
        ~Signal() {}; // private destructor
        friend class Foo; //<- problem: Q_OBJECT macto does not know "Foo"
    };

    Signal bar(); //New way of declaring signals, moc detect the return type
};

int main()
{
    Foo::Signal (Foo::*sig)() =  &Foo::bar; // works
    Foo f;  f.bar(); // error, ~Signal is private
    return 0;
}


But this mean signals are now private instead of protected (which i think is 
maybe a good thing)  and that Q_OBJECT should be changed to know which class 
it it in so it can put the friend.
But the error is not really friendly,  and signal cannot return real value 
anymore (which work currently despite not being documented).

> Our conclusion is that if you want compile-time checking of the arguments,
> you need to give up the protectedness of the emission.

Yes, I think public signals are not a huge issue.


_______________________________________________
Qt5-feedback mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback

Reply via email to