c++ - QThread communicate threadsafe -


i know it's not allowed call function of thread in mainthread. allowed call signal form thread without problems? lets code in mainwindow:

thread->movetothread(obj); emit obj->signal();

thank you


or way go:

 obj.h signals:     void testsignal();  public slots: void func();      mainwindow.h     void testsignal();       mainwindow.cpp     thread->movetothread(obj);      connect(this,signal(testsignal()),obj,signal(testsignal()));     emit testsignal();       obj.cpp     connect(this,signa(testsignal()),this,slot(func())); 

yes! signal can called thread long use default automatic connection signal. such slots/functors execute in context object's thread. can emit signals callbacks 3rd party libraries, example, if these libraries don't use qt.

warning: explicitly directly connected slots/functors execute in thread signal invoked.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo