[Qt-interest] QKeyEvent::ascii() alternative in Qt4

Malyushytsky, Alex alex at wai.com
Wed Dec 3 23:28:47 CET 2008


You are trying to convert string (QByteArray) to number (->toInt() )
'a'  is not a number, so you get 0

May be you want  KeyEvent::text()->toAscii()->at(0) ?

Regards,
  Alex

-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Prasanta Sadhukhan
Sent: Wednesday, December 03, 2008 1:17 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] QKeyEvent::ascii() alternative in Qt4

Hi,

In Qt3, we were using QKeyEvent::ascii() to get the ascii character of
the key pressed, so when we press "a", we get 0x61 and when we press
"A", we get 0x41
IIn Qt4,  tried using QKeyEvent::text()->toAscii()->toInt() but all I am
getting is 0
Can anyone point me as to what I should be using to get the ascii value
of the key pressed?

Regards
Prasanta

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest


---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."

"Please consider our environment before printing this email."




More information about the Qt-interest-old mailing list