Skip to content

Commit

Permalink
Tweaked TextField padding, allowing to set left/right padding
Browse files Browse the repository at this point in the history
separately.
  • Loading branch information
Venemo committed Jan 2, 2013
1 parent 740cd31 commit 67185c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions qml/desktop/components/TextField.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Rectangle {
property bool isTextValid: text.length > 0
property bool enableTextValidation: false
property real padding: 10
property real rightPadding: padding
property real leftPadding: padding
property alias text: textInput.text
property alias tooltipText: toolTipTextItem.text

Expand Down Expand Up @@ -57,8 +59,13 @@ Rectangle {
clip: true
id: textInput
height: font.pixelSize * 1.5
anchors.centerIn: parent
width: parent.width - textField.padding * 2
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
right: parent.right
leftMargin: leftPadding
rightMargin: rightPadding
}
verticalAlignment: TextInput.AlignVCenter
selectByMouse: true
}
Expand Down
2 changes: 2 additions & 0 deletions qml/desktop/pages/ChatPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ Page {
TextField {
id: chatField
padding: 15
rightPadding: padding + sendButton.width + sendButton.anchors.rightMargin + sendButton.anchors.leftMargin
text: "Good morning captain!"
anchors {
bottom: parent.bottom
Expand All @@ -172,6 +173,7 @@ Page {
}

Button {
id: sendButton
text: "Send!"
width: implicitWidth * 1.7
color: "#666"
Expand Down

0 comments on commit 67185c5

Please sign in to comment.