Make sure you forward the Keys to the elements that can handle them: Keys.forwardTo: []
You can take a look at http://doc.qt.io/qt-5/qml-qtquick-keys.html#key-handling-priorities you probably have something else that is grabbing the key event. Try to forward from your root Item to the your element if it work and start displaying the trace, it mean the Key event is not reaching the Item (non Item element? bad parenting? something else is consuming the key event?) I don't have run the example but that would be my guess. [image: bodycad] <https://www.bodycad.com/> Jerome Godbout Software Developer 2035 rue du Haut-Bord, Québec, QC, Canada. G1N 4R7 T: +1 418 527-1388 E: jer...@bodycad.com www.bodycad.com The contents of this email message and any attachments are intended solely for the addressee(s) and may contain confidential and/or privileged information and may be legally protected from disclosure. If you are not the intended recipient of this message or their agent, or if this message has been addressed to you in error, please immediately alert the sender by reply email and then delete this message and any attachments. If you are not the intended recipient, you are hereby notified that any use, dissemination, copying, or storage of this message or its attachments is strictly prohibited. Le contenu de ce message et les pièces jointes sont destinés uniquement pour le(s) destinataire(s) et peuvent contenir des informations confidentielles et / ou privilégiées qui peuvent être protégées légalement contre toute divulgation. Si vous n'êtes pas le destinataire de ce message ou son agent, ou si ce message vous a été adressé par erreur, s’il vous plaît avertir immédiatement l'expéditeur par courriel de réponse, puis supprimer ce message et les pièces jointes. Si vous n'êtes pas le destinataire prévu, vous êtes par la présente informé que toute utilisation, diffusion, copie, ou stockage de ce message ou de ses pièces jointes est strictement interdit. On Tue, Oct 17, 2017 at 4:45 PM, Kevron Rees <tripzero....@gmail.com> wrote: > I'm trying to get keyboard events to my qml item that is being displayed > as a texture using Scene2D. I have simply added Keys.onPressed and > MouseArea to LogoControls[2] in the Scene2D example[1]. If I uncomment > MouseArea, I can see the mouse click console.log message. But I never see > "key pressed". Is there an extra step necessary to get Keyboard events to > this item? > > [1] https://doc.qt.io/qt-5/qt3d-scene2d-example.html > > [2] > > LogoControls { > > id: logoControls > > width: offscreenTexture.width > > height: offscreenTexture.height > > focus: true > > > Keys.onPressed: { > > console.log("key pressed") > > } > > > /*MouseArea { > > anchors.fill: parent > > onClicked: { > > console.log("clicked...") > > } > > }*/ > > } > > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest