diff --git a/pttyhandler.cpp b/pttyhandler.cpp index 8457021..4a5516c 100644 --- a/pttyhandler.cpp +++ b/pttyhandler.cpp @@ -4,10 +4,11 @@ #include #include -#include +#ifndef Q_OS_WIN #include #include #include +#endif // Copyright 2017-2021 Elliott H. Liggett & Phil Taylor @@ -37,11 +38,15 @@ void pttyHandler::openPort() bool success=false; #ifdef Q_OS_WIN + port = new QSerialPort(); port->setPortName(portName); port->setBaudRate(baudRate); port->setStopBits(QSerialPort::OneStop);// OneStop is other option success = port->open(QIODevice::ReadWrite); - connect(port, SIGNAL(readyRead()), this, SLOT(receiveDataIn(0))); + + if (success) { + connect(port, &QSerialPort::readyRead, this, std::bind(&pttyHandler::receiveDataIn, this, (int)0)); + } #else // Generic method in Linux/MacOS to find a pty ptfd = ::posix_openpt(O_RDWR | O_NOCTTY);