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