一、 qt qml 无边框能显示默认文字的 文本
用TextField 或者TextArea都可,里面背景嵌套一个矩形,让矩形的颜色和周围的颜色一样,就不会显示下划线了。
TextField {
id: text_nameid
wrapMode: Text.WrapAnywhere //在一行上的任何点进行换行,即使它发生在单词的中间
leftPadding: 8
Layout.leftMargin: 0
Layout.fillWidth: true
font.pointSize: 13
readOnly: true //只读属性,不能编辑
horizontalAlignment: Text.AlignHCenter
placeholderText: qsTr("请选择名字") //默认显示的文字
bottomPadding: 8
Layout.columnSpan: 2
//selectByMouse: true //设置鼠标可选择功能
background: Rectangle {
color: "#fafafa" //颜色
// border.color: "#00bcd4"
// border.width: 2
radius: 8 //矩形的圆角设置
}
}