#include <random>
#include <iostream>
using namespace std;
void generator(int& answer, int& x, int& c) {
random_device random_device;
mt19937 generator(random_device());
uniform_int_distribution<> distribution(1, 10);
x = distribution(generator);
c = distribution(generator);
answer = x * c;
}
int main() {
int answer, x,c;
generator(answer, x,c);
cout << answer << " " << x << " " << c;
}
class SerialClass: public QObject
{
Q_OBJECT
public:
SerialClass(QString);
void Start();
void Stop();
void RecieveMsg(QByteArray data);
bool StatusConnection();
QSerialPort *serial;
private:
QSerialPort *serialPort;
QString portName;
int baudRate;
int dataBits;
int parity;
int stopBits;
int flowControl;
signals:
void readyRead(const QByteArray& data);
public:
void ReadData();
};
void SerialClass::ReadData()
{
const auto data=serialPort->readAll();
emit readyRead(data);
}
SerialClass *serial;
serial =new SerialClass("Device");
connect(serial, &SerialCalss::readyRead, this, &MainWindow::readData);
serial->Start(); // вызывать после connect
private slots:
void readData(const QByteArray& data);
readyRead
У вас его в классе SerialClass нет.