【发布时间】:2014-08-22 06:36:51
【问题描述】:
我正在构建自己的 QML 对话框。因此我想做一个页眉、内容和页脚项目。对话框应该有圆角(Rectangle.radius),但页眉/页脚应该是一个普通的矩形。
这是我的代码:
Rectangle {
width: 360
height: 360
Rectangle {
id: dialog
anchors.centerIn: parent
width: 200
height: 300
radius: 20
border.color: "gainsboro"
Rectangle {
id: header
width: dialog.width
height: 50
border.color: "red"
Text {
anchors.centerIn: parent
text: "HEADER"
}
}
Rectangle {
id: footer
anchors.bottom: dialog.bottom
width: dialog.width
height: 50
border.color: "green"
Text {
anchors.centerIn: parent
text: "FOOTER"
}
}
}
}
问题是,对话框没有圆角,因为页眉和页脚与对话框矩形重叠。我想知道如何避免这种情况。
提前致谢!
【问题讨论】:
-
您是否考虑保留一些顶部和底部边距?
-
我已经尝试了边距,但是矩形的重叠或间隙区域总是存在问题。
标签: dialog qml rounded-corners