[Qt-interest] Forcing a signal "emit" to be queued
Anton Chernov
mechernov at gmail.com
Mon Mar 21 13:29:56 CET 2011
I think another solution would be to the class QSignalMapper. Just embed it
as a member in your class and you have rich control over signal slot
managing.
By the way, signals are not public:
#define signals protected
2011/3/21 Andre Somers <andre at familiesomers.nl>
> Op Ma, 21 maart, 2011 12:54 pm, schreef Mandeep Sandhu:
> >> No, actually that will allow you to do this without using a private
> >> signal
> >> at all. You can invoke a signal using invokeMethod() with a queued
> >> connection, or you can use the single shot timer connected to your
> >> public
> >> signal. Both methods would rid you of the private signal, and hence of
> >> the
> >> private class (if you did not need this for other purposes anyway).
> >
> > Oh yes, I forgot that I could give a signal name to invokeMethod()
> > too. Though the only 'technical' limitation here is the number of args
> > that one can pass to invokeMethod (max is 10). Though it might not be
> > much of an issue in most cases.
> >
> > As for the singleShot approach, will it have an overhead of creating a
> > OS specific timer underneath (even for a timeout of 0)? Not sure how
> > heavy creation/destruction of such timer is.
> >
> > Thanks again for all your ideas.
> If you are worried about that, then perhaps look into QObject::startTimer
> and QObject::timerEvent(). It is the low-level way of using a timer, and
> it is already available in your object. A timer with a timeout of 0 will,
> AFAIK, just post a message to the eventqueue anyway.
>
> André
>
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110321/1e208acb/attachment.html
More information about the Qt-interest-old
mailing list