RolandHughes, how to use SerialPort signals/slots from other thread:
//mythread.h
#include <QThread>
{
Q_OBJECT
protected:
virtual void run();
};
//mythread.h
#include <QThread>
class MyThread : public QThread
{
Q_OBJECT
protected:
virtual void run();
};
To copy to clipboard, switch view to plain text mode
//mythread.cpp
#include "mythread.h"
#include <QtAddOnSerialPort/serialport.h>
void MyThread::run()
{
SerialPort port; //do not set parent or read manual for QObject::moveToThread()!
//do some settings to port
//do some signals/slots connections
//do open the port
exec(); //run event loop
}
//mythread.cpp
#include "mythread.h"
#include <QtAddOnSerialPort/serialport.h>
void MyThread::run()
{
SerialPort port; //do not set parent or read manual for QObject::moveToThread()!
//do some settings to port
//do some signals/slots connections
//do open the port
exec(); //run event loop
}
To copy to clipboard, switch view to plain text mode
P.S.: this is standard way to use QObject derived objects with signals and slots from other thread.
Bookmarks