rect QML Value Type
un valor con atributos x, y, anchura y altura. Más...
Descripción detallada
El tipo rect se refiere a un valor con atributos x, y, width y height.
Las propiedades de tipo rect son Qt.rect(0, 0, 0, 0) por defecto. Se trata de un rectángulo vacío en el origen de coordenadas.
Por ejemplo, para leer los valores width y height de la propiedad de tipo rect Item childrenRect :
Rectangle { width: childrenRect.width height: childrenRect.height Rectangle { width: 100; height: 100 } }
Para crear un valor rect, especifíquelo como una cadena "x, y, anchura x altura":
CustomObject { myRectProperty: "50,50,100x100" }
O utilice la función Qt.rect():
CustomObject { myRectProperty: Qt.rect(50, 50, 100, 100) }
El tipo rect también expone atributos de sólo lectura left, right, top y bottom. Estos atributos son los mismos que los de C++ counterparts.
Cuando se integre con C++, tenga en cuenta que cualquier valor QRect o QRectF que se pase a QML desde C++ se convierte automáticamente en un valor rect, y viceversa. Cuando se pasa un valor rect a C++, se convierte automáticamente en un valor QRectF.
Véase también Tipos de valor QML.
© 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.