我用的是Qt自带的串口类,首先我定义了一个Serial类,继承QObject,在该类中实现串口的相关操作,然后在主界面类中将Serial和一个QThread声明为它的成员,在构造函数中使用Serial->moveToThread(readDataThread); 使得串口的读写操作在子线程中执行, 读串口可以运行,写串口就出现Cannot create children for a parent that is in a different thread. (Parent is QSerialPort(0x12e52b98), parent's thread is QThread(0x12e2d8c0), current thread is QThread(0x12e617b0)。 有哪位高手可以解决,万分感谢!!