1)Qt Quick centerIn和fill 的用法:
import QtQuick 2.5
Rectangle {
width:300;
height:200;
Rectangle {
color: "blue";
anchors.fill: parent;
border.width: 6;
border.color: "#888888";
Rectangle {
anchors.centerIn: parent;
width: 120;
height:120;
radius:8;
border.width: 2;
border.color: "black";
antialiasing: true;
color: "red";
}
}
}

博客展示了Qt Quick中centerIn和fill的用法,通过代码示例呈现。代码里定义了不同的矩形,使用anchors.fill让子矩形填充父矩形,用anchors.centerIn使子矩形居中显示,还设置了矩形的颜色、边框等属性。
733

被折叠的 条评论
为什么被折叠?



