Hi,

I have code similar to this
Qt Code:
  1. void MyThread::run(void) //QThread function
  2. {
  3.  
  4.  
  5. for(int i=0;i < 100; i++)
  6. emit signal_AddTextTo_QPlainTextEdit(/* */);
  7.  
  8. //then I want to auto scroll to the top so I emit a signal
  9.  
  10. emit signal_QPlainTextEdit_scroll(QTextCursor::Start);//its not working correctly without msleep() after for loop
  11.  
  12. }
To copy to clipboard, switch view to plain text mode 
but its not working correctly without some delay so I use msleep(100) between signal_AddTextTo_QPlainTextEdit and signal_QPlainTextEdit_scroll.

I dont like using msleep, it there any other solution ? wait for event (signal) finishes or something else ?