[Qt-interest] Force the emission of a signal

Andrea Franceschini therealmorpheu5 at gmail.com
Fri Mar 20 17:21:43 CET 2009


Obviously I can make appropriate private functions that emit the
signals and declare the application class as a friend.

-- 
Andrea

2009/3/20, Andrea Franceschini <therealmorpheu5 at gmail.com>:
> Hello everybody.
>
> Is it possible to force a QObject derived class to emit a particular
> signal, which of course is one of the signals of that class? Suppose
> you have the following:
>
> class MyObject : public QObject {
>    Q_OBJECT
> /* ... */
> signals:
>    void signal();
> };
>
> and suppose that the class itself has no way to know whether it is
> appropriate to emit that signal, instead the application in which it
> resides knows it perfectly. Is there a way to make the application
> make an instance of MyObject emit that signal? Or is it necessary to
> add a public emitSignal() method which is called by the application
> and simply emits the signal?
>
> Thanks,
> --
> Andrea
>



More information about the Qt-interest-old mailing list