Hello,

I use QSerialPort and I don't manage to display the information "QIODevice::write (QSerialPort): device not open" when I try to send some data if the serial port is not yet open. I can see the message in the output application of Qt Creator, but the SIGNAL(errorOccurred(QSerialPort::SerialPortError) is not emit; I guess it's because the serial port is not yet open?

I've got this source code (everything else is working well when I open the serial port):


Qt Code:
  1. connect(uart, SIGNAL(errorOccurred(QSerialPort::SerialPortError)), this, SLOT(handleError(QSerialPort::SerialPortError)));
  2.  
  3. ...
  4.  
  5. void UART::handleError(QSerialPort::SerialPortError error)
  6. {
  7. if (error == QSerialPort::ResourceError)
  8. {
  9. emit errorDetected(uart->errorString()); //emit error string to the GUI
  10. if(uart->isOpen())
  11. {
  12. uart->close();
  13. }
  14.  
  15. }
  16. }
To copy to clipboard, switch view to plain text mode 

Do you have a clue?
Thanks