title: Optimizing QPlainTextEdit Widget When Bombarded with Data?
body: <p>So basically what I have is a Qt application that has a main GUI thread and a worker thread.</p>
  
  <p>The worker thread is something like this:</p>
  
  <pre><code>void Client::readResults(int msgqid, pid_t pid)
  {
      int ret;
      msg_t message;
  
      connect(this, SIGNAL(dataReceived(QString)), this, SLOT(updateDisplay(QString)));
      connect(this, SIGNAL(doneProcessing(QString)), this, SLOT(updateStatus(QString)));
  
      for (;;)
      {
          ret = msgrcv(msgqid, &amp;message, MSGSIZE, pid, 0);
          if (ret == -1)
          {
              showStatusBarError("msgrcv");
              return;
          }
  
          if (ret &gt; 0)
          {
              emit dataReceived(QLatin1String(message.info));
  
              if (message.is_eof)
              {
                  emit doneProcessing("Done!");
                  break;
              }
          }
      }
  }
  </code></pre>
  
  <p>All it does is it reads from a message queue and emits a signal that causes a QPlainTextEdit widget from the main GUI thread (that spawned this thread) to call appendPlainText(message.info) so that the data received from the message queue is appended to the widget. </p>
  
  <p>The problem is if I'm reading huge chunks of data from the queue (it's actually a text file around 30MB or more), the whole GUI just hangs until the worker thread finishes. Is there a way to make it not hang and for the user to actually see the QPlainTextEdit widget scrolling as it received data from the worker thread?</p>
  
  <p>Thanks!</p>