Fix padding to the left and right of text in a textField

A TextField already had (implicit) padding to the top and bottom of the text to the frame
this was added to the left and right side as matching margins look cleaner

REVIEW: 106797
This commit is contained in:
David Edmundson 2012-10-11 15:57:54 +01:00
parent 87c778e8dc
commit 4644711a33

View File

@ -228,8 +228,8 @@ FocusScope {
property alias activeFocus: textInput.activeFocus
// TODO: fix default size
implicitWidth: theme.defaultFont.mSize.width*12
implicitHeight: theme.defaultFont.mSize.height*1.6
implicitWidth: theme.defaultFont.mSize.width*12 + base.internalPadding*2
implicitHeight: theme.defaultFont.mSize.height + base.internalPadding*2
// TODO: needs to define if there will be specific graphics for
// disabled text fields
opacity: enabled ? 1.0 : 0.5
@ -247,6 +247,7 @@ FocusScope {
anchors.fill: parent
imagePath: "widgets/lineedit"
prefix: "base"
property real internalPadding: theme.defaultFont.mSize.height*0.3
}
MouseArea {
@ -266,8 +267,8 @@ FocusScope {
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
leftMargin: 2 * base.margins.left
rightMargin: 2 * base.margins.right
leftMargin: base.margins.left + base.internalPadding
rightMargin: base.margins.right + base.internalPadding
}
text: placeholderText
visible: textInput.text == "" && !textField.activeFocus
@ -295,8 +296,8 @@ FocusScope {
right: parent.right
verticalCenter: parent.verticalCenter
// TODO: see what is the correct policy for margins
leftMargin: 2 * base.margins.left
rightMargin: 2 * base.margins.right + (clearButton.opacity > 0 ? clearButton.width : 0)
leftMargin: base.margins.left + base.internalPadding
rightMargin: base.margins.right + (clearButton.opacity > 0 ? clearButton.width : 0) + base.internalPadding
}
passwordCharacter: "•"
selectByMouse: true