[Qt-qml] Trigger Keys.onPressed to a QML Item (e.g. TextInput)

Tobias Renz Tobias.Renz at jdsu.com
Tue Mar 1 11:43:40 CET 2011


Hi,

In my mobile application I want to use a TextInput that won't have the focus.
That is because I use an OnScreenKeyboard which has the focus. And I navigate on it by some keys.

Now I'm searching for a method by which I can emulate key presses to a TextInput.
Any Ideas, guys??

I thought of something like this which doesn't work because I can't emit Pressed from outside Keys

   TextInput {
        id: input
        anchors.left: parent.left
        anchors.right: parent.right
        //activeFocusOnPress: false
        anchors.top: parent.top
        text: "2.10"
        horizontalAlignment: Text.AlignHCenter
        font.pointSize: 20

        function triggerKey() {
            emit Keys.Pressed(Qt.Key_Back)
        }
    }
=> triggerKey() would have a paramter that passes the key to the Pressed method obviously

Best Regards,
Tobias

Tobias Renz                       Phone: +49 7121 86 1121
R&D Software Engineer             Fax: +49 7121 86 2525
Mühleweg 5                        E-mail: tobias.renz at jdsu.com<mailto:tobias.renz at jdsu.com>
72800 Eningen u.A. / Germany      World Wide Web: http://www.jdsu.com<http://www.jdsu.com/>
                                  Intranet: http://www.eni.eu.acterna.net/~ren47001
[cid:253243710 at 01032011-35BC]
JDSU Deutschland GmbH Sitz: 72800 Eningen u.A.
Registergericht Stuttgart, HRB 353758
WEEE-Reg.-Nr.: DE 53620669
Geschäftsführung: Rolf Trieflinger

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110301/60c0a8a9/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 4516 bytes
Desc: image002.jpg
Url : http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110301/60c0a8a9/attachment-0001.jpg 


More information about the Qt-qml mailing list