Skip to content
  • 0 Votes
    2 Posts
    904 Views
    jsulmJ
    Sorry, but I cannot understand what you mean. Can you explain?
  • 0 Votes
    2 Posts
    1k Views
    Cold_DistanceC
    Well I discovered it myself. import QtQuick 2.3 Item{ id: root Rectangle { id:cuadrado width: 150 height: 150 color: "#53a135" border.color: "#61e361" } // A partir de aquí podemos empezar a manipular el 'cuadrado' desde el teclado focus: true //Keys.onLeftPressed: cuadrado.x -= 8 //Keys.onRightPressed: cuadrado.x += 8 //Keys.onUpPressed: cuadrado.y -= 8 //Keys.onDownPressed: cuadrado.y += 8 Keys.onPressed: { switch(event.key) { case Qt.Key_Plus: cuadrado.scale += 0.2 break; case Qt.Key_Minus: cuadrado.scale -= 0.2 break; case Qt.Key_A: cuadrado.x -= 8 break; case Qt.Key_D: cuadrado.x += 8 break; case Qt.Key_W: cuadrado.y -= 8 break; case Qt.Key_S: cuadrado.y += 8 break; } } } Sorry.