[Qt-interest] Using Qt in a shared library
Arnold Krille
arnold at arnoldarts.de
Thu May 7 21:29:08 CEST 2009
On Thursday 07 May 2009 20:58:19 Murphy, Sean M. wrote:
> > Hmm, this sounds as if you should call show() already in Start() and
> in
> > Callback() simply call qApp->processEvents() so the Qt event loop
> processes
> > the events. That "emulates" what exec() does, but doesn't block longer
> > than one run through the loop needs (i.e. it processes all events in
> the
> > queue and then returns, instead of waiting for more events to get into
> the
> > queue like exec() does).
> Yep, works pretty well! The only downside is that the Qt GUI is a bit
> sluggish. It appears that Callback() gets called at about 2-4 Hz, so
> there is a noticeable lag between typing/clicking and the Qt repaint,
> but I don't think there's really too much I can do about it - unless I
> try putting all the Qt stuff in a separate thread.
You can't put the gui-stuff in something different than the main-thread. See the
Qt docs for the reason;-)
But maybe you can make the callback function check how much time passed for
the run of processEvents and have it repeat processEvents() as long as the set
interval isn't exceeded. That way you get more event-processing then just the
2-4Hz. Maybe you have to delay the loop a bit with a sleep...
Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090507/9f7c6027/attachment.bin
More information about the Qt-interest-old
mailing list