Qt:key enum problem



  • I wrote a small test to verify how work key mapping on QML.

    but I can't match one correct mapping from my keycode to Qt:key enum
    (only number keys are matched)

    @import QtQuick 1.0

    Rectangle {
    id: screen
    width: 360
    height: 360
    Text {
    text: "Hello World"
    anchors.centerIn: parent
    }
    MouseArea {
    anchors.fill: parent
    onClicked: {
    Qt.quit();
    }
    }

    focus: true
    Keys.onBackPressed: { console.log("move left"); }
    Keys.onPressed: {
        console.log("onPressed " + event.key )
        console.log("Qt.Key_Back: " + Qt.Key_Back )
        console.log("Qt.Key_Cancel: " + Qt.Key_Cancel );
    }
    

    }@

    the console out after I press 'canc' key is :
    onPressed 16777223
    Qt.Key_Back: 16777313
    Qt.Key_Cancel: 16908289
    onPressed 16777219
    Qt.Key_Back: 16777313
    Qt.Key_Cancel: 16908289

    there is a bug on qml or in my code?
    I use Qt Creator 2.2.1 on ubuntu 10.10



  • This seems to be perfectly fine..

    @Qt::Key_Back 0x01000061@

    this is how it is mapped.

    and "canc" is nothing but
    @Qt::Key_Delete 0x01000007 // 16777223@

    See Qt Namespace documentation for more details
    http://doc.qt.nokia.com/latest/qt.html


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.