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

问题解决.

原文地址:https://www.cnblogs.com/rohens-hbg/p/14072799.html