On Thu, Sep 22, 2011 at 2:06 PM, Olivier Goffart <[email protected]> wrote:
> 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.
Looks interesting.
- How would one go about using arguments to the signal? Templates?
- What would we be doing with for example the dataChanged(...) signal
from QAbstractItemModel? A protected emitDataChanged(...) function?
> But the error is not really friendly,
That would be:
error: ‘Foo::Signal::~Signal()’ is private
I agree that, although pretty explicit, it is rather obscure in this context.
> and signal cannot return real value
> anymore (which work currently despite not being documented).
Would this be a big problem?
_______________________________________________
Qt5-feedback mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback