作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
任何人都可以帮助我如何只圆角矩形的一个角,如附图所示,其中红色矩形是我的子矩形。
实际上,我有一个矩形,其中所有四个角都是圆角(半径 10)。现在,我想在其中绘制一个新的矩形,并期望只有接触父圆角的那个特定角应该是圆角的。
Rectangle
{
id: parent
radius: 10
width: 168
height: 168
visible: true
color: "black"
Rectangle
{
id: child
width: 100
height: 40
color: "red"
}
}
最佳答案
这是一个简单的例子。
它在左上角是圆形的,但很容易调整到任何其他角。此解决方案仅支持一个角,但对您来说可能就足够了吗?
更多的角落稍微复杂一点,所以再次询问您是否也需要这些。
Rectangle {
anchors.centerIn: parent
id: root
radius: 20
width: 300
height: 300
Rectangle {
id: clipper
width: 100
height: 100
color: 'transparent'
clip: true
Rectangle {
id: clipped
width: parent.width + radius
height: parent.height + radius
radius: root.radius
color: 'red'
}
}
}
关于qt - 有没有办法为不同的角指定不同的半径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39958076/
我是一名优秀的程序员,十分优秀!