辉煌淘淘:初学QT,也是MOXA卡,我用多线程时,在 QThread 继承类中声明,然后在线程run函数里 serialport = new QSerialPort(); (2015-06-03 00:28)
QSerialPort在多线程环境下需要注意几点: 1.同一种操作(读 or 写)一定要放在同一个线程进行,否则线程间冲突整死人 2.QSerialPort对象的打开和关闭必须在对象的创建线程中执行,否则它的事件通知功能无法正常执行,结果便是waitForReadyRead或waitForBytesWritten这样的等待函数无法正常工作
QObject: Cannot create children for a parent that is in a different thread. (Parent is QSerialPort(0x28fd74), parent's thread is QThread(0x15f10f68), current thread is testThread(0x24257ed8) 楼主,我把串口地址传到线程中总提示这个怎么解决
johnyork
2016-03-03 23:36
踢飞season:QObject: Cannot create children for a parent that is in a different thread. (Parent is QSerialPort(0x28fd74), parent's thread is QThread(0x15f10f68), current thread is testThread(0x24257ed8) 楼主,我把串口地址传到线程中总提示这个怎么解决 (2016-03-03 12:47)