尝试向圆形按钮添加文本。提供错误“不能赋值给不存在的属性:文本”。
RoundButton {
id: circ1
text: qsTr("RoundButton")
anchors.right: parent.right
anchors.rightMargin: 1.0 * ScreenTools.defaultFontPixelWidth
anchors.topMargin: 1.0 * ScreenTools.defaultFontPixelHeight
anchors.top: parent.top
Layout.alignment: Qt.AlignHCenter
//radius: 120
width: 60
height: 60
contentItem: Text {
text: "Plan"
}
//font.pointSize: ScreenTools.smallFontPointSize * ScreenTools.smallFontPointRatio
}如果没有text属性,代码将按预期工作。它也适用于带有text属性的常规按钮。我的印象是圆形按钮应该和普通按钮一样工作。知道我哪里出问题了吗?
发布于 2022-11-30 06:55:34
我没能重现你的问题。几件事:
https://stackoverflow.com/questions/74598177
复制相似问题