iasdev
1st February 2016, 16:10
Hello newbie here.
I am having trouble converting a simple text within the UI to Char. My goal is to submit text in the UI which will be sent to a usb to rs 485.
I have no trouble sending text directly from within the code, but I would like to send my component different commands from within the UI on the fly.
Here is the snippet of code giving me problems.
QString Motor_Command_;
Motor_Command_ = ui->MotorCommandText->toPlainText().toLocal8Bit().constData();
char TxBuffer[] = {Motor_Command_};
The error I get:
error: cannot convert 'QString' to 'char' in initialization
char TxBuffer[] = {Motor_Command_};
^
I am having trouble converting a simple text within the UI to Char. My goal is to submit text in the UI which will be sent to a usb to rs 485.
I have no trouble sending text directly from within the code, but I would like to send my component different commands from within the UI on the fly.
Here is the snippet of code giving me problems.
QString Motor_Command_;
Motor_Command_ = ui->MotorCommandText->toPlainText().toLocal8Bit().constData();
char TxBuffer[] = {Motor_Command_};
The error I get:
error: cannot convert 'QString' to 'char' in initialization
char TxBuffer[] = {Motor_Command_};
^