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");

问题解决.

 

posted @ 2020-12-02 11:37  hbg-rohens  阅读(1911)  评论(0编辑  收藏  举报