problem using QSerialPort
-
@mzimmers
IIRC you're using a static build? so its probably not the latest Qt Version on what are you running?If it isn't the error @kshegunov pointed out
-
@jsulm I'm not using a thread exclusively for the serial port work; my worker thread essentially does all my non-UI stuff(encoding/decoding messages, etc.)
@kshegunov sorry; I was engaging in a bit of shorthand. m_serialPort is a member variable of SerialPort. The connect is correct, though.
@J-Hilk I'm currently using (non-static) 5.12.5.Last night it occurred to me that long ago, I'd come across a problem with transferring objects to new threads, in which some sub-objects don't get transferred properly.
I might try Dorfman's idea, though I'd prefer not to have to do that.
Thanks...
-
@mzimmers said in problem using QSerialPort:
@J-Hilk I'm currently using (non-static) 5.12.5.
And there is your problem
https://bugreports.qt.io/browse/QTBUG-78086please update
-
Hi,
IIRC, your QSerialPort object won't get moved if your don't parent it.
-
@mzimmers said in problem using QSerialPort:
Good eye. Thanks for catching that. I'll update immediately.
Any way, your initialization seems not correct to me:
SerialPort::SerialPort(QObject *parent) : QObject (parent) { QSerialPort m_serialPort; connect(&m_serialPort, &QSerialPort::readyRead, this, &SerialPort::readSerial); ... }
should be, I think:
SerialPort::SerialPort(QObject *parent) : QObject (parent) , m_serialPort(new QSerialPort(this)) { connect(m_serialPort, &QSerialPort::readyRead, this, &SerialPort::readSerial); ... }
-
@KroMignon thanks...so a QByteArray object wouldn't be affected then.
It looks like the mechanics of updating have changed since I last used them. Is there a pre-built 5.14 for Windows available somewhere on github? EDIT: looks like the answer is "no;" I guess everyone builds their own now. Given my recent troubles trying to build a static Qt, I hope the directions in the 5.14 README are accurate.
I'm going to mark this solved, in anticipation that when I get a new Qt built, it'll work. Thanks for everyone's input on this.
-
You need now to use your Qt account to access the pre-built binaries (the same you use to post here)
-
The bug tracker is your friend :-)