[Qt-interest] convert QSlidBox value int char
Keshava Krishna
keshavkrishna88 at gmail.com
Mon May 11 13:00:03 CEST 2009
You can use QString::at(int);
after you get QString test, give test.at(0); that'll give you the character
at 0 position...
On Mon, May 11, 2009 at 4:27 PM, Stefanos Antaris <santaris at csd.auth.gr>wrote:
> Ok that works but i want to cast it into char.Not QString;quint doesn't
> support QString;
>
>
> Keshava Krishna wrote:
>
> I don't know about tcpSocket etc,
> But you can use number function of QString to convert an integer to string
>
> QString test = QString::number ( valueTest);
>
>
> hope i helped you to solve your problem
>
> On Mon, May 11, 2009 at 3:49 PM, 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]
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>
>
>
> --
> Regards,
> Keshava.
>
>
>
--
Regards,
Keshava.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090511/dcab959e/attachment.html
More information about the Qt-interest-old
mailing list