center the text

This commit is contained in:
Marco Martin 2011-11-09 22:06:25 +01:00
parent b9f9153c4a
commit c2e980fa11

View File

@ -112,7 +112,13 @@ Item {
} }
Text { Text {
anchors.fill: textInput anchors {
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
leftMargin: 2 * base.margins.left
rightMargin: 2 * base.margins.right
}
text: placeholderText text: placeholderText
visible: textInput.text == "" && !textField.activeFocus visible: textInput.text == "" && !textField.activeFocus
// XXX: using textColor and low opacity for theming placeholderText // XXX: using textColor and low opacity for theming placeholderText
@ -143,8 +149,6 @@ Item {
rightMargin: 2 * base.margins.right rightMargin: 2 * base.margins.right
} }
selectByMouse: true selectByMouse: true
y: (height - font.pixelSize) * 0.4 // XXX: verticalCenter anchor is not centering the text
height: Math.min(2 * font.pixelSize, parent.height)
color: theme.textColor color: theme.textColor
enabled: textField.enabled enabled: textField.enabled
clip: true clip: true