TextField: add keyboard navigation support

REVIEW: 104722
This commit is contained in:
Aurélien Gâteau 2012-04-25 12:03:03 +02:00
parent 263a184049
commit 9b04155a92

View File

@ -158,7 +158,7 @@ import QtQuick 1.1
import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.plasma.core 0.1 as PlasmaCore
import "private" as Private import "private" as Private
Item { FocusScope {
id: textField id: textField
// Common API // Common API
@ -252,6 +252,12 @@ Item {
id: mouseWatcher id: mouseWatcher
anchors.fill: hover anchors.fill: hover
hoverEnabled: true hoverEnabled: true
onClicked: {
// If we don't set focus on click here then clicking between the
// line of text and the bottom or top of the widget will not focus
// it.
textInput.forceActiveFocus();
}
} }
Text { Text {
@ -295,6 +301,7 @@ Item {
color: theme.textColor color: theme.textColor
enabled: textField.enabled enabled: textField.enabled
clip: true clip: true
focus: true
onActiveFocusChanged: { onActiveFocusChanged: {
if (!textField.activeFocus) { if (!textField.activeFocus) {
textInput.closeSoftwareInputPanel() textInput.closeSoftwareInputPanel()