size QML Value Type

幅と高さの属性を持つ値。詳細...

詳細な説明

size 型は、widthheight 属性を持つ値を指します。

size 型のプロパティは、デフォルト値としてQt.size(-1, -1) を持ちます。

例えば、Image::sourceSize size-typeプロパティのwidthheight の値を読み取る場合:

Column {
    Image { id: image; source: "logo.png" }
    Text { text: image.sourceSize.width + "," + image.sourceSize.height }
}

size 値を作成するには、"width x height" 文字列として指定します:

Image { sourceSize: "150x50" }

または、Qt.size ()関数を使用します:

Image { sourceSize: Qt.size(150, 50) }

C++と統合する場合、C++からQMLに渡された QSizeQSizeF の値は自動的にsize の値に変換されることに注意してください。C++にsize の値を渡すと、自動的にQSizeF の値に変換されます。

関連項目: QMLの値の型

© 2025 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.