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