title: QIODevice::read (QSerialPort) : device not open
body: <p>I'm new with Qt Creator and I'm trying to read data from a light sensor communicating by I2C. I made a class <code>PortListener</code> that should return data received on the console once called.</p>
  
  <pre><code>PortListener::PortListener(const QString &amp;portName)
  {
  this-&gt;port = new QSerialPort();
  port-&gt;setPortName(portName);
  port-&gt;setBaudRate(QSerialPort::Baud9600);
  port-&gt;setDataBits(QSerialPort::Data8);
  port-&gt;setParity(QSerialPort::NoParity);
  port-&gt;setStopBits(QSerialPort::OneStop); 
  port-&gt;setFlowControl(QSerialPort::NoFlowControl); 
  port-&gt;open(QIODevice::ReadWrite);
  QByteArray readData = port-&gt;readAll();
  qDebug() &lt;&lt; "message:" &lt;&lt; readData;
  }
  </code></pre>
  
  <p>But the only message I have is: </p>
  
  <pre><code>QIODevice::read (QSerialPort): device not open
  
  message: ""
  </code></pre>
  
  <p>I don't understand what that mean?</p>