QSerialPort::readyRead() is not emitted, but QTCPSocket::readyRead() works fine.
-
-
Okay, now I tried it and the static way QCoreApplication::exec() doesn't block but throw : QApplication::exec: Please instantiate the QApplication object first
@Rufledore said in QSerialPort::readyRead() is not emitted, but QTCPSocket::readyRead() works fine.:
QApplication::exec: Please instantiate the QApplication object first
Then you should do this in our main() in the first line.
-
@Rufledore said in QSerialPort::readyRead() is not emitted, but QTCPSocket::readyRead() works fine.:
QApplication::exec: Please instantiate the QApplication object first
Then you should do this in our main() in the first line.
@Christian-Ehrlicher said in QSerialPort::readyRead() is not emitted, but QTCPSocket::readyRead() works fine.:
@Rufledore said in QSerialPort::readyRead() is not emitted, but QTCPSocket::readyRead() works fine.:
QApplication::exec: Please instantiate the QApplication object first
Then you should do this in our main() in the first line.
In principle yes, but I don't want the user of the library to bother with Qt staff as QApplication. And the main question for me is how it works okay for TCPSocket but not for SerialPort?
-
You need a working QCoreApplication - everything else simply works by accident and may not work suddenly.
-
@Rufledore said in QSerialPort::readyRead() is not emitted, but QTCPSocket::readyRead() works fine.:
Could you give me an idea, how to proceed?
Quick answer - nohow, it makes not sense to use Qt stuff from the non-qt libraries.
-
@Rufledore said in QSerialPort::readyRead() is not emitted, but QTCPSocket::readyRead() works fine.:
could be started only in main thread
Q(Core|Gui)Application can also be started in another thread but then all gui operations must be done inside this thread too.
-
Then how to use Qt specific features as signals and slots in a library? QCoreApplication could be started only in main thread... If I start it on the background it doesn't work well. Could you give me an idea, how to proceed?
@Rufledore said in QSerialPort::readyRead() is not emitted, but QTCPSocket::readyRead() works fine.:
Then how to use Qt specific features as signals and slots in a library? QCoreApplication could be started only in main thread... If I start it on the background it doesn't work well. Could you give me an idea, how to proceed?
It is a Qt library but not for Qt application :)
-
@Rufledore said in QSerialPort::readyRead() is not emitted, but QTCPSocket::readyRead() works fine.:
Then how to use Qt specific features as signals and slots in a library? QCoreApplication could be started only in main thread... If I start it on the background it doesn't work well. Could you give me an idea, how to proceed?
It is a Qt library but not for Qt application :)
@Rufledore
I don't think you can use Qt library calls for TCP/serial port without being in a Qt application. As in, they don't work properly, as you have discovered. They need parts of theQ(Core|Gui)Application-type architecture.,