このページでは

Translate QML Type

項目の x または y プロパティを変更せずに移動する方法を提供します。詳細...

Import Statement: import QtQuick

プロパティ

  • x : real
  • y : real

詳細説明

「Translate」タイプでは、アイテムの x および y プロパティに加えて、位置を個別に制御することができます。

次の例では、Rectangle アイテムのY軸を移動させつつ、Row が、あたかも変形されていないかのようにアイテムを配置できるようにしています:

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

青と赤の長方形。赤の方を20ピクセル上方にずらしたものです。

プロパティのドキュメント

x : real

X軸に沿った平行移動。

デフォルト値は 0.0 です。

y : real

Y軸方向の平行移動。

デフォルト値は 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.