c++ - Updating GUI form elements continuously so that Form does not hang -


as title states attempting update gui form element continuously via thread form still seems busy. cannot understand.here how approaching it.

connect(this,signal(sigupdateform),this,slot(myupdatemehtod)); 

now whenever form needs updated following.i launch method in new thread . new thread triggers above signal.

boost::thread t(&someclass::somemethod(),this); 

now once somemethod started here do

void somemethod() {       sigupdateform(); //launch signal update form } 

the sigupdateform calls myupdatemehtod() since signal (whether queued or direct not launch thread seems form hung.) confuses me because signal being called independent thread why form hanging ? can make work ?

qt has own thread. don't need thread. qtimer you. here example.

void updateform() {  ui->bla->settext("bla");  // bla bla method }  qtimer timer; connect(&timer, signal(timeout()), this, slot(updateform())); timer.start(3000); 

now updateform() called every 3s. gui not hang. way of doing processing event loop,

while(....) {  // lengthy task  qapp->processevents(qeventloop::allevents); } 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -