QThread or QTimer
Hi, I'm writing a GUI programme that receives and sends some data through serial port.
I'm using the approach showed in the Qt documentation where data is read when a readyRead signal is emitted, and I do this in the mainwindow.
But now, I want to write data every 50 ms, so I thought about using the QTimer class. However I don't know if this is a good idea. Besides, I've read that it's a better advice to do this kind of processing in a separated thread, in the background, and leave the UI for simpler tasks.
So, which approach do you think it's a better practice?
Hi. I think it's all right to use a QTimer, because QSerialPort is a buffered device. Calling the write method will not block your main thread. Give it a try. If you feel some performance decrease, then you may start considering using threads.
I use qml to make it work.WorkerScript