[Qt-qml] Request For Information

Jim Vance james.vance at panasonic.aero
Fri Dec 2 22:53:30 CET 2011


I would like to know why this request has been rejected with "NO reason 
given" and who rejected it - simple request!

------------------------------------------------

-------- Original Message --------
Subject: 	Request to mailing list Qt-qml rejected
Date: 	Fri, 2 Dec 2011 10:00:33 +0100
From: 	<qt-qml-bounces at qt.nokia.com>
To: 	<james.vance at panasonic.aero>


Your request to the Qt-qml mailing list

     Posting of your message titled "Qt Plugin for QML - I can't get
sendEvent() to work, what's my error in understanding?"

has been rejected by the list moderator.  The moderator gave the
following reason for rejecting your request:

"No reason given"

Any questions or comments should be directed to the list administrator
at:

     qt-qml-owner at qt.nokia.com


*----------------ORIGINAL REQUEST FOR POST--------------------*

I'm writing a Qt Plugin for QML that gets handset device key data and 
presents it to any QML component via a QInputMethodEvent.

I can't get the QML event portion to work. More specifically, I am 
unable to get sendEvent() to work from my class HandsetInputContext 
which inherits QInputContext.

I originally expected to be able to package up a QInputMethodEvent with 
a key character like 'a' or 'b' or even 'Return-Key' integer and have 
any component expecting input to be able to handle the event providing 
that the component had focus. If that didn't work, I thought I would try 
to send a regular event like QKeyEvent.

Here's a 'honed-down' example of what I've tried:

I first tried this code from within my inherited QInputContext class:

/QInputMethodEvent ime;
ime.setCommitString("SOME_STRING");
sendEvent(ime);/

but it didn't work, so then I tried this code: ("m_target" is a QML 
QObject*, in this particular case it's a TextInput component)

/QString s = QString::number(coreKeyCode);
QKeyEvent keyPress(QEvent::KeyPress, coreKeyCode, Qt::NoModifier, s);
qApp->sendEvent(m_target, &keyPress);   // this returned boolean fail/

this also didn't work, so I tried this code as a sanity-check. It worked 
but it's just being sent to a local QLineEdit

/QString s = QString::number(coreKeyCode);
QLineEdit lineEdit;
qApp->sendEvent(&lineEdit, &keyPress);/  // this worked, returned 
boolean true

-------------------------------------------------------------------------------------------------------------------------------------

My QML code looks like this. "m_target" is a QObject* gets set from the 
HandsetInputContext's "target:"

import QtQuick 1.0
import MyPlugin 1.0

Rectangle {

     width: 400
     height: 100

     TextInput {
         id: mytext
         text: "Console Catching Keys!"
         anchors.centerIn: parent
     }

     HandsetInputContext {
         id:receiver
         target: mytext
     }
}




Disclaimer: The information contained in this transmission, including any 
attachments, may contain confidential information of Panasonic Avionics
Corporation.  This transmission is intended only for the use of the 
addressee(s) listed above.  Unauthorized review, dissemination or other use 
of the information contained in this transmission is strictly prohibited. 
If you have received this transmission in error or have reason to believe 
you are not authorized to receive it, please notify the sender by return 
email and promptly delete the transmission.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20111202/05d8bf2c/attachment-0001.html 


More information about the Qt-qml mailing list