Hi guys..

Previously i'm using external library for accessing RS232 serial port. Now i want to try to use Qserialport in Qt5.1.
however, i have some problems as i'm using multithreading program (Qthread).

Main thread
Qt Code:
  1. void MainWindow::on_plotButton_clicked()
  2. {
  3. //Initialize thread for acc
  4. Thread_Acc = new QThread;
  5. Sensors* Acc = new Sensors();
  6. Acc->moveToThread(Thread_Acc);
  7. connect(Thread_Acc, SIGNAL(started()), Acc, SLOT(FetchData_AW()));
  8. connect(Acc, SIGNAL(finished()), Thread_Acc, SLOT(quit()));
  9. connect(Acc, SIGNAL(finished()), Acc, SLOT(deleteLater()));
  10. connect(Thread_Acc, SIGNAL(finished()), Thread_Acc, SLOT(deleteLater()));}
To copy to clipboard, switch view to plain text mode 

Worker thread
Qt Code:
  1. void Sensors::FetchData_AW()
  2. {
  3. foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) {
  4. qDebug() << "Name : " << info.portName();
  5. qDebug() << "Description : " << info.description();
  6. qDebug() << "Manufacturer: " << info.manufacturer();
  7.  
  8. if(info.portName() == "COM24")
  9. {
  10. cport_nr_Acc.setPort(info);
  11. cport_nr_Acc.close();
  12. if (cport_nr_Acc.open(QIODevice::ReadWrite))
  13. {
  14. cport_nr_Acc.setBaudRate(57600);
  15. cport_nr_Acc.setDataBits(QSerialPort::Data8);
  16. cport_nr_Acc.setParity(QSerialPort::NoParity);
  17. cport_nr_Acc.setStopBits(QSerialPort::OneStop);
  18. cport_nr_Acc.setFlowControl(QSerialPort::NoFlowControl);
  19. }else
  20. return;
  21. break;
  22. }
  23. }
  24. Fetch_ACC = new QTimer (this);
  25. connect(Fetch_ACC,SIGNAL(timeout()),this,SLOT(Loop_DataAW()));
  26. Fetch_ACC->start(55);
  27. }
To copy to clipboard, switch view to plain text mode 

the program can run but it display warning as below and the input from the device is also not as expected (value not stabilize) comparing if i use external rs232 library.
Qt Code:
  1. QObject: Cannot create children for a parent that is in a different thread.
  2. (Parent is QSerialPort(0x127bac98), parent's thread is QThread(0x10b40ed0), current thread is QThread(0x128967f0)
  3. QObject: Cannot create children for a parent that is in a different thread.
  4. (Parent is QSerialPort(0x127bac98), parent's thread is QThread(0x10b40ed0), current thread is QThread(0x128967f0)
  5. QObject: Cannot create children for a parent that is in a different thread.
  6. (Parent is QSerialPort(0x127bac98), parent's thread is QThread(0x10b40ed0), current thread is QThread(0x128967f0)
To copy to clipboard, switch view to plain text mode 

is there any interruption of the port if I'm using it from other than main thread?
i already make the Qserialport as the variable in worker-thread class instead of global variable.
what can i do to solve this issues because i really want to use readyRead signal.

Thanks in advance... =)