PathRectangle QML Type
Define um retângulo com cantos arredondados, se desejado. Mais...
| Import Statement: | import QtQuick |
| Since: | QtQuick 6.8 |
Propriedades
- bevel : bool
(since 6.10) - bottomLeftBevel : bool
- bottomLeftRadius : real
- bottomRightBevel : bool
- bottomRightRadius : real
- height : real
- radius : real
- relativeX : real
- relativeY : real
- strokeAdjustment : real
- topLeftBevel : bool
- topLeftRadius : real
- topRightBevel : bool
- topRightRadius : real
- width : real
- x : real
- y : real
Descrição detalhada
PathRectangle oferece uma maneira fácil de especificar um retângulo, opcionalmente com cantos arredondados ou chanfrados. A API corresponde à do item Rectangle.

Shape {
id: rectangleShape
width: 200
height: 150
anchors.centerIn: parent
preferredRendererType: Shape.CurveRenderer
ShapePath {
fillColor: "#3ad23c"
PathRectangle {
width: rectangleShape.width
height: rectangleShape.height
topLeftRadius: 30
bottomRightRadius: 30
bevel: true
}
}
}Veja também Path, PathLine, PathQuad, PathCubic, PathArc, PathAngleArc, PathCurve e PathSvg.
Documentação de propriedades
bevel : bool [since 6.10]
Essa propriedade define se os cantos do retângulo são chanfrados.
Ao defini-la como “ false ”, os cantos ficam pontiagudos ou arredondados, dependendo dos valores das propriedades individuais “ radius ”.
Essa propriedade pode ser substituída pelas propriedades de chanfro individuais.
Shape {
id: rectangleShape
width: 200
height: 150
anchors.centerIn: parent
preferredRendererType: Shape.CurveRenderer
ShapePath {
fillColor: "#3ad23c"
PathRectangle {
width: rectangleShape.width
height: rectangleShape.height
topLeftRadius: 30
bottomRightRadius: 30
bevel: true
}
}
}
Essa propriedade foi introduzida no Qt 6.10.
Veja também topLeftBevel, topRightBevel, bottomLeftBevel e bottomRightBevel.
Se definidas, essas propriedades definem os chanfros individuais dos cantos. Definir essas propriedades como “ false ” resulta em cantos retos ou arredondados, dependendo dos valores das propriedades individuais “ radius ”. Definir essas propriedades como “ true ” resulta em cantos chanfrados. Quando não definidas, o valor de “ bevel ” é usado em seu lugar.
Essas propriedades estão desativadas por padrão. Atribua a propriedade ` undefined ` a elas para restaurá-las ao estado desativado.
No exemplo a seguir, bottomRightBevel está definido como true:
Shape {
id: rectangleShape
width: 200
height: 150
anchors.centerIn: parent
preferredRendererType: Shape.CurveRenderer
ShapePath {
strokeColor: "black"
strokeWidth: 4
joinStyle: ShapePath.MiterJoin
PathRectangle {
width: rectangleShape.width
height: rectangleShape.height
radius: 10
topLeftRadius: 0
bottomRightBevel: true
}
}
}
Veja também ` bevel`.
Se definidas, essas propriedades definem os raios de cada canto. Um valor zero indica que o canto é agudo, enquanto um valor positivo indica que ele é arredondado. Quando não definidas, o valor de ` radius ` é usado em seu lugar.
Essas propriedades estão desativadas por padrão. Atribua ` undefined ` a elas para restaurá-las ao estado desativado.
No exemplo a seguir, ` radius ` está definido como ` 10`, e ` topLeftRadius ` como ` 0`:
Shape {
id: rectangleShape
width: 200
height: 150
anchors.centerIn: parent
preferredRendererType: Shape.CurveRenderer
ShapePath {
strokeColor: "black"
strokeWidth: 4
joinStyle: ShapePath.MiterJoin
PathRectangle {
width: rectangleShape.width
height: rectangleShape.height
radius: 10
topLeftRadius: 0
bottomRightBevel: true
}
}
}
Veja também radius.
Define a largura e a altura do retângulo.
radius : real
Essa propriedade define o raio dos cantos utilizado para definir um retângulo arredondado.
Se o raio for um valor positivo, o contorno do retângulo será definido como um retângulo arredondado; caso contrário, será definido como um retângulo normal.
Essa propriedade pode ser substituída pelas propriedades individuais de raio dos cantos.
O valor padrão é 0.
Veja também topLeftRadius, topRightRadius, bottomLeftRadius e bottomRightRadius.
Define o canto superior esquerdo do retângulo em relação ao ponto inicial do caminho.
Se forem especificadas tanto uma posição final relativa quanto uma absoluta para um único eixo, será utilizada a posição relativa.
É possível misturar posições relativas e absolutas; por exemplo, é válido definir um valor x relativo e um valor y absoluto.
strokeAdjustment : real
Essa propriedade define o ajuste da largura do traço em relação às coordenadas do retângulo.
Quando usada em um elemento ` ShapePath ` com traçado ativado, o retângulo traçado efetivo se estenderá, por padrão, além do retângulo definido em metade da largura do traço em todos os lados. Esse é o comportamento esperado, uma vez que o caminho define a linha do ponto médio do traçado e corresponde à renderização d QPainter e SVG.
Se, em vez disso, você quiser que o retângulo definido seja a borda externa do retângulo contornado — como um item de “ Rectangle ” com borda —, é possível definir `strokeAdjustment` como a largura do traço. Isso deslocará efetivamente todas as bordas para dentro na metade da largura do traço. Como no exemplo a seguir:
ShapePath {
id: myRec
fillColor: "white"
strokeColor: "black"
strokeWidth: 16
joinStyle: ShapePath.MiterJoin
PathRectangle { x: 10; y: 10; width: 200; height: 100; strokeAdjustment: myRec.strokeWidth }
}Define o canto superior esquerdo do retângulo.
A menos que esse canto seja arredondado, esse também será o ponto inicial e final do caminho.
© 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.