[Qt-interest] convert QSlidBox value int char

Constantin Makshin dinosaur-rus at users.sourceforge.net
Mon May 11 20:17:44 CEST 2009


If you want to get the text representation of a single-digit number,  
simply add '0' to its value.

On Mon, 11 May 2009 14:19:25 +0400, Stefanos Antaris  
<santaris at csd.auth.gr> wrote:
> Hello.Can anyone help me on how to convert the QSlidBoxValue into char?I
> want to send this using  a tcpSocket into another application.Here is my
> code.The other application receive vmf instead of vmf5 as i expect.The
> value 5 is the default of the SpinBox;
>
> [code]
> QString test;
> int valueTest=ui->velocitySpinBox->value();
> test=(char)valueTest;
> ui->statusLabel->setText(test);
> forwardOut<<quint8('v')<<quint8('m')<<quint8('f')<<quint16(test);
> forwardOut.device()->seek(0);
> actionTcpSocket->write(forwardBlock);
> [\code]

-- 
Constantin "Dinosaur" Makshin



More information about the Qt-interest-old mailing list