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

Korey Fort k.m.fort at gmail.com
Sun Jun 19 14:55:44 UTC 2005


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