# HG changeset patch # User Hasan Yavuz Ă–ZDERYA # Date 2015-06-17 17:24:35 # Node ID 8a94e68f9083f333a3cee53b5bb0b8942fc39cca # Parent 1363e0619b1e5f7346f4437bbef1b6e6e16040b5 text view working for binary data formats diff --git a/mainwindow.cpp b/mainwindow.cpp --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -533,6 +534,15 @@ template double MainWindow:: T data; this->serialPort.read((char*) &data, sizeof(data)); + // print data in hex format + if (ui->cbEnableTextView->isChecked()) + { + QTextCursor cursor(ui->ptTextView->document()); + cursor.movePosition(QTextCursor::End); + QByteArray ba((char*) &data, sizeof(data)); + cursor.insertText(ba.toHex() + " "); + } + if (ui->rbLittleE->isChecked()) { data = qFromLittleEndian(data);