qt自定義的串口類判斷斷開


QObject::connect: Cannot queue arguments of type 'QSerialPort::SerialPortError'

(Make sure 'QSerialPort::SerialPortError' is registered using qRegisterMetaType().)

 

源代碼如下:

    connect(serial, SIGNAL(errorOccurred(QSerialPort::SerialPortError)),
            this, SLOT(deal_with_error(QSerialPort::SerialPortError)), Qt::QueuedConnection);

 

參考解決方法:

https://blog.csdn.net/weixin_43387612/article/details/108170747

 

在源代碼前加入如下一句:

qRegisterMetaType<QSerialPort::SerialPortError>("SerialThread");

問題解決.

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM