[mythtv] How to send a key event from MythLineEdit?

zoiks2004-ivtv at yahoo.com zoiks2004-ivtv at yahoo.com
Sun Jun 19 19:06:12 UTC 2005


Thanks, Korey

OK, I tried making the replacement 0->65 for both
methods, but it still doesn't work.  It still acts as
if the key event is never even sent - it's just
ignored altogether.

There is also a customEvent method in MythMainWindow
that is capable of generating key events, but I can't
seem to access it from MythLineEdit because the method
is protected.  (I used somethingn like
gContext->GetMainWindow()->customEvent(key)).

You'll have to forgive me for the stupid questions;
I'm not much of a programmer/hacker.


--- Korey Fort <k.m.fort at gmail.com> wrote:

> I'm not 100% positive this but is it that you should
> have the ASCII value of
> a in 
> QKeyEvent where you have a 0(zero)? 
> 
> QKeyEvent key (QEvent::KeyPress, Qt::Key_A, 0,
> Qt::NoButton);
> QKeyEvent key (QEvent::KeyPress, Qt::Key_A, 65,
> Qt::NoButton);
> 
> I found that on
> http://doc.trolltech.com/3.3/qkeyevent.html. 
> "ASCII is the ASCII code of the key that was pressed
> or released."
> 
> -----Original Message-----
> From: mythtv-dev-bounces at mythtv.org
> [mailto:mythtv-dev-bounces at mythtv.org]
> On Behalf Of zoiks2004-ivtv at yahoo.com
> Sent: Sunday, June 19, 2005 12:47 AM
> To: mythtv-dev at mythtv.org
> Subject: [mythtv] How to send a key event from
> MythLineEdit?
> 
> I'm trying to make a different key get processed
> within the keyPressEvent() method of MythLineEdit.  
> 
> For example, say I wanted to replace a received
> pressed key event with a QKeyEvent for pressing the
> "a" key.  I try this snippet:
> 
>     [...]
>     QKeyEvent key(QEvent::KeyPress, Qt::Key_A, 0,
> Qt::NoButton);
>     QLineEdit::keyPressEvent(&key);
>     e->accept();  //e is the orig. key event,
> ignored
>     handled = true;
>     [...skips rest of keyPressEvent...]
> 
> or this one
> 
>     [...]
>     QKeyEvent key(QEvent::KeyPress, Qt::Key_A, 0,
> Qt::NoButton);
>     QObject *key_target = gContext->GetMainWindow();
>     QApplication::sendEvent(key_target, &key);
>     e->accept();
>     handled = true;
>     [...skips rest of keyPressEvent...]
> 
> but neither works.  QLineEdit (MythLineEdit) never
> sees the "a" keypress.  (Or the original keypress
> event, I might add.)
> 
> What am I doing wrong?  It compiles, but the "a" key
> event is never received.  Thanks.
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
>
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
> 
> 



More information about the mythtv-dev mailing list