In questa pagina

Translate QML Type

Consente di spostare un elemento senza modificarne le proprietà x o y. Altro...

Import Statement: import QtQuick

Proprietà

  • x : real
  • y : real

Descrizione dettagliata

Il tipo Translate offre un controllo indipendente sulla posizione, oltre alle proprietà x e y dell'elemento.

L'esempio seguente sposta l'asse Y degli elementi " Rectangle ", consentendo comunque all'elemento " Row " di disporre gli elementi come se non fossero stati trasformati:

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

Rettangoli blu e rossi, con quello rosso spostato di 20 pixel verso l'alto

Documentazione delle proprietà

x : real

La traslazione lungo l'asse X.

Il valore predefinito è 0,0.

y : real

La traslazione lungo l'asse Y.

Il valore predefinito è 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.