summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorMathias Malmqvist <mathias.malmqvist@nokia.com>2010-12-17 15:38:23 +0100
committerJens Bache-Wiig <jens.bache-wiig@nokia.com>2010-12-17 15:38:23 +0100
commit8555a4b05431c541c9a9ff3717399b762bd10b77 (patch)
tree56b570c3c0f3a971ffd4bcf1105d67756955d8f9 /components
parent391a1c61338c0662439d7dc201bd3013ea8ecdef (diff)
downloadqtquickcontrols-8555a4b05431c541c9a9ff3717399b762bd10b77.tar.gz
Fixes to the LineEdit and MultiLineEdit focus handling
Merge-request: 63 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@nokia.com>
Diffstat (limited to 'components')
-rw-r--r--components/LineEdit.qml11
-rw-r--r--components/MultiLineEdit.qml9
2 files changed, 14 insertions, 6 deletions
diff --git a/components/LineEdit.qml b/components/LineEdit.qml
index 10067338..215fbb6d 100644
--- a/components/LineEdit.qml
+++ b/components/LineEdit.qml
@@ -1,7 +1,10 @@
import QtQuick 1.0
import "./styles/default" as DefaultStyles
-Item {
+// KNOWN ISSUES
+// 1) LineEdit does not loose focus when !enabled if it is a FocusScope (see QTBUG-16161)
+
+Item { //mm Does this need to be a FocusScope or not? //needs to be a FocusScope as long as TextInput is not in e.g. a Flickable's scope
id: lineEdit
property alias text: textInput.text
@@ -70,8 +73,9 @@ Item {
echoMode: passwordMode ? _hints.passwordEchoMode : TextInput.Normal
selectByMouse: false // textSelection is handled explicitly by mouseArea below
+ focus: true // needed when focus is set on the LineEdit instance "from the outside"
activeFocusOnPress: false // explicitly handled my mouseArea below
- onActiveFocusChanged: if(!desktopBehavior) state = focus ? "focused" : ""
+ onActiveFocusChanged: if(!desktopBehavior) state = (activeFocus ? "focused" : "")
states: [
State {
@@ -116,6 +120,7 @@ Item {
text: textInput.text
}
+
MouseArea {
id: mouseArea
anchors.fill: parent
@@ -126,7 +131,7 @@ Item {
//mm see QTBUG-15814
onPressed: {
- textInput.focus = true;
+ textInput.forceActiveFocus(); //mm see QTBUG-16157
textInput.cursorPosition = textInput.positionAt(mouse.x-textInput.x);
if(desktopBehavior) {
pressedPos = textInput.cursorPosition;
diff --git a/components/MultiLineEdit.qml b/components/MultiLineEdit.qml
index 9ddcd684..face33e5 100644
--- a/components/MultiLineEdit.qml
+++ b/components/MultiLineEdit.qml
@@ -48,7 +48,7 @@ Item {
Loader { id: hintsLoader; sourceComponent: hints }
Loader { sourceComponent: background; anchors.fill: parent }
- Flickable {
+ Flickable { //mm is FocusScope, so MultiLineEdit's root doesn't need to be, no?
id: flickable
clip: true
@@ -78,9 +78,12 @@ Item {
anchors.left: parent.left
anchors.right: parent.right
+ focus: true
+ activeFocusOnPress: false
+ selectByMouse: false // handled explicitly by mouseArea below
+
color: enabled ? textColor: Qt.tint(textColor, "#80ffffff")
wrapMode: desktopBehavior ? TextEdit.NoWrap : TextEdit.WordWrap
- selectByMouse: false // handled explicitly by mouseArea below
onCursorRectangleChanged: flickable.ensureVisible(cursorRectangle)
}
}
@@ -106,7 +109,7 @@ Item {
//mm see QTBUG-15814
onPressed: {
- textEdit.focus = true;
+ textEdit.forceActiveFocus(); // see QTBUG-16157
var mappedMouse = mapToItem(textEdit, mouse.x, mouse.y);
textEdit.cursorPosition = textEdit.positionAt(mappedMouse.x, mappedMouse.y);
if(desktopBehavior) {