Nesta página

Translate QML Type

Oferece uma maneira de mover um Item sem alterar suas propriedades x ou y. Mais...

Import Statement: import QtQuick

Propriedades

  • x : real
  • y : real

Descrição detalhada

O tipo Translate oferece controle independente sobre a posição, além das propriedades x e y do Item.

O exemplo a seguir move o eixo Y dos itens “ Rectangle ”, ao mesmo tempo em que permite que o “ Row ” organize os itens como se eles não tivessem sido transformados:

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 }
    }
}

Retângulos azuis e vermelhos, com o vermelho deslocado 20 pixels para cima

Documentação das propriedades

x : real

A translação ao longo do eixo X.

O valor padrão é 0,0.

y : real

A translação ao longo do eixo Y.

O valor padrão é 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.