[Qt-interest] Force the emission of a signal

Andrea Franceschini therealmorpheu5 at gmail.com
Fri Mar 20 17:11:18 CET 2009


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