My program continuously reads from serial port. Firstly, I used QTimer and set the interval to 300 mlscnd, this makes UI interaction very slow. I though of converting QTimer to QThread, as QTimer runs in the UI Thread, so, I added QThread class and used msleep() inside the while() loop to control the trigger.
Unfortunately, the program is still slow, I can clearly understand this when I enter digits in the UI. My last guess of where the speed reduction might have come from is emit, as you see below:

Qt Code:
  1. void PlcTimer::run(){
  2. while(1)
  3. {
  4. qDebug() << "updateJack()";
  5.  
  6. const char str[]={UPDATE_m};
  7. #if DEBUG
  8. QByteArray built(str, 3);
  9. qDebug() << built.toHex();
  10. #endif
  11. emit m_sendToRS((char* )str, 3);
  12. this->msleep(500);
  13. //sleep(300);
  14. }
  15. }
To copy to clipboard, switch view to plain text mode 

emit is a UI object, so whatever it is I am suspicious of its interconnection over the UI. do you have any idea how I can resolve the low speed?