[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Mapping keyPressEvent() to text
From: Craig Howard <kde () choward ! ca>
Date: 2005-09-06 19:17:37
Message-ID: 200509061517.37835.kde () choward ! ca
[Download RAW message or body]
On Monday 05 September 2005 13:19, Craig Howard wrote:
> I'm writing a GUI for a library and I need to translate key combinations
> like CTRL+Y from the QKeyEvent into the string "<CTRL>y"
>
> What I'm doing right now is testing the event->keyboardModifier() and
> adding that to the string, then adding event->text(). However, when a key
> like CTRL is down, event->text() for the above CTRL+Y gives me the string
> "\031", even though event->key() == Qt::Key_Y.
>
> How can I make event->key() and event->text() return the same thing in this
> case? Thanks.
For the record, I got an answer to this question on one of the Qt newsgroups.
I did
QString keySeq( QKeySequence( event->key() + event->modifier() ) );
and then performed operations on the returned string to get it into the format
I wanted.
--
Craig Howard
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic