Search code examples
qtserial-portqbytearray

Display value of QByteArray


I am making simple serial communication app. Connection works well and I send data from my device to my app i am getting in log when I do qDebug() << dataByte:

"\x0B"
"\x0B"

Now I want to display this in a QTextEdit as "0B" string. How do I go about doing that? I read about QTextCodec but that is to convert 0B into a character which is not what I want.

Pls show me some guide thank you.

EDIT: I also tried

QString DataAsString = dataByte.toStdString();

But error comes up.


Solution

  • Ok nvm I found the answer

    QString DataAsString = data.toHex();