# HG changeset patch # User Hasan Yavuz Ă–ZDERYA # Date 2015-10-10 13:21:53 # Node ID 40c94e30a04292445e9078e39cf84056230ab946 # Parent 2d43eb4fe15cfa8504283a79a3ea39368ac66a42 seperately buffer the ASCII and HEX command texts diff --git a/commandwidget.cpp b/commandwidget.cpp --- a/commandwidget.cpp +++ b/commandwidget.cpp @@ -77,6 +77,16 @@ void CommandWidget::onSendClicked() void CommandWidget::onASCIIToggled(bool checked) { ui->leCommand->setMode(checked); + if (checked) + { + storedHexText = ui->leCommand->text(); + ui->leCommand->setText(storedAsciiText); + } + else + { + storedAsciiText = ui->leCommand->text(); + ui->leCommand->setText(storedHexText); + } } bool CommandWidget::isASCIIMode() diff --git a/commandwidget.h b/commandwidget.h --- a/commandwidget.h +++ b/commandwidget.h @@ -46,6 +46,9 @@ signals: private: Ui::CommandWidget *ui; + QString storedAsciiText; + QString storedHexText; + bool isASCIIMode(); // true: ascii mode, false hex mode private slots: