Skip to content

Commit

Permalink
Fix TextField for use with virtual keyboard
Browse files Browse the repository at this point in the history
Allow to force focus it on click and make inputMethodHints property
accescible via alias property.

Change-Id: I1cbf6f2a2bf387d5ed2265528a6668ec40948fe4
Reviewed-by: Nedim Hadzic <[email protected]>
  • Loading branch information
jpetersen committed Apr 20, 2016
1 parent 4b8fafd commit 9e8661d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion modules/controls/TextField.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ UIElement {
property alias text: textInput.text
property alias hintText: hintLabel.text
property alias length: textInput.length
property alias inputMethodHints: textInput.inputMethodHints
property bool forceFocusOnClick: false

signal accepted

Expand Down Expand Up @@ -69,8 +71,17 @@ UIElement {

anchors.fill: textInput
font.italic: true
opacity: !textInput.focus && textInput.length === 0
opacity: !textInput.activeFocus && textInput.length === 0

Behavior on opacity { NumberAnimation {} }
}

MouseArea {
id: focusMouseArea

enabled: root.forceFocusOnClick && !textInput.activeFocus
anchors.fill: textInput

onClicked: textInput.forceActiveFocus()
}
}

0 comments on commit 9e8661d

Please sign in to comment.