Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt:key enum problem
Forum Updated to NodeBB v4.3 + New Features

Qt:key enum problem

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 4.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    muchasuerte
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thisisbhaskar
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved