我尝试使用TextField Styled,但对占位符文本没有影响,如何更改placeholderText的颜色
答案 0 :(得分:3)
TextField
具有专用于颜色的属性placeholderTextColor
:
使用Qt Quick Controls 2(至少需要Qt 5.12):
import QtQuick.Controls 2.5
TextField {
anchors.fill: parent
placeholderText: "Here is a place holder"
placeholderTextColor: "red"
}
使用Qt快速控件1:
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
TextField {
anchors.fill: parent
style: TextFieldStyle {
placeholderTextColor: "red"
}
placeholderText: "Here is a place holder"
}