title: Qt Creator - write serial received data to UI
body: <p>I'm working with qt creator and I want to get a QByteArray to the class that implements to UI, lets say class A. Class B implements a serial connection (RS232) and receives data in the following way:</p>
  
  <pre><code>QSerialPort::connect(serialport,SIGNAL(readyRead()),this,SLOT(SerialPortManager::GiveReceivedDataToUI()));
  </code></pre>
  
  <p>So in my method <code>SerialPortManager::GiveReceivedDataToUI(){}</code> I will read all the data from my serial connection like this: <code>serialport-&gt;readAll();</code> The data (stored in a QByteArray) is still in Class B. Now I want to get this data to a textbox in Class A.</p>
  
  <p>I red some threads about accessing UI elements from a different class. Tried it with another connect, but I juist could figure out how to connect my data to a method in Class A(UI) that writes a textbox. I want to write it in decent OO, not just by making this public.</p>
  
  <p>Any suggestions?</p>
  
  <blockquote>
    <p>UPDATE </p>
  </blockquote>
  
  <pre><code>class SerialPortManager : QMainWindow
  {
       Q_OBJECT
  private:    
      static SerialPortManager* instance;    
  protected:
      SerialPortManager();
  public:
      static SerialPortManager* GetInstance();
      void OpenSerialConnection();
      void CloseSerialConnection();
      void WriteSingleACLCommand(QString);
      void WriteMultipleACLCommands();
  
  public slots:
      void GiveReceivedDataToUI();
  signals:
      void Send(QByteArray&amp; s);
  
  };
  #endif // SERIALPORTMANAGER_H
  </code></pre>