En esta página

Translate QML Type

Ofrece una forma de mover un elemento sin modificar sus propiedades x o y. Más...

Import Statement: import QtQuick

Propiedades

  • x : real
  • y : real

Descripción detallada

El tipo «Translate» permite controlar de forma independiente la posición, además de las propiedades x e y del elemento.

El siguiente ejemplo desplaza el eje Y de los elementos « Rectangle », al tiempo que permite que la propiedad « Row » distribuya los elementos como si no se hubieran transformado:

import QtQuick 2.0

Row {
    Rectangle {
        width: 100; height: 100
        color: "blue"
        transform: Translate { y: 20 }
    }
    Rectangle {
        width: 100; height: 100
        color: "red"
        transform: Translate { y: -20 }
    }
}

Rectángulos azules y rojos, con el rojo desplazado 20 píxeles hacia arriba

Documentación de propiedades

x : real

La traslación a lo largo del eje X.

El valor por defecto es 0,0.

y : real

La traslación a lo largo del eje Y.

El valor por defecto es 0,0.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.