c++ - Move QGLWidget with only slots to different thread -


i have qt program receives qbytearray's kinect , processes them visible images on screen in qglwidget. qglwidget runs in gui thread, rest of gui. class fires kinect images runs in different thread. comminutation done trough signals , slots.

sometimes gui thread locks , openglwidget locks , want fix that. this, need qt slot run in different thread rest of gui. know possible, examples saw use run method, gets started in different thread , runs on own.

but use slot receive images, means not run if there image available rendering. can create thread , put slot in thread?

in recent project "solved" shaving yaks, err, write routing wrappers.

class fooclass : public qthread { q_object    /* ... */  public slots: /* thread loopback signals */ void setbuffercount(     unsigned int buffercount ) {         qmetaobject::invokemethod(this, "_priv_loslot_setbuffercount",             qt::queuedconnection,             q_arg(unsigned int, buffercount) );      }  private slots: /*  * private loopback slots  * ^^^^    ^^       ^^^^  *  * these slots connected coresponding frontend  * signals. calling frontend signal send invocation  * between threads, calling loopback slots within  * worker thread.  */ void _priv_loslot_setbuffercount(unsigned int buffercount);    /* ... */ } 

by calling or connecting public slots internal wrapping calling invokemethod on qt::queuedconnection did trick.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -