diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-02-16 03:33:52 (GMT) |
---|---|---|
committer | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-02-21 04:34:41 (GMT) |
commit | fd198736e1da02f535bc81d9934cb4e8412a87bc (patch) | |
tree | c256a874dd17f94ab8d354ffe6dfd47055b6e1e4 /src/declarative | |
parent | 521a9bba59fe198ec7b1afe9bb25a9d3334675cf (diff) | |
download | Qt-fd198736e1da02f535bc81d9934cb4e8412a87bc.zip Qt-fd198736e1da02f535bc81d9934cb4e8412a87bc.tar.gz Qt-fd198736e1da02f535bc81d9934cb4e8412a87bc.tar.bz2 |
Hide the TextInput/Edit cursor when the view doesn't have focus.
Only display a cursor if both the item and its scene have focus.
Change-Id: I0c91ab4d533cd7d773ffc2489633e12c0d399ad9
Task-number: QTBUG-17365
Reviewed-by: Martin Jones
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextedit.cpp | 2 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextinput.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 2946f6e..83c7420 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -1126,7 +1126,7 @@ void QDeclarativeTextEdit::keyReleaseEvent(QKeyEvent *event) void QDeclarativeTextEditPrivate::focusChanged(bool hasFocus) { Q_Q(QDeclarativeTextEdit); - q->setCursorVisible(hasFocus); + q->setCursorVisible(hasFocus && scene && scene->hasFocus()); QDeclarativeItemPrivate::focusChanged(hasFocus); } diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index bfcd715..ba1ae63 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -948,7 +948,7 @@ void QDeclarativeTextInputPrivate::focusChanged(bool hasFocus) { Q_Q(QDeclarativeTextInput); focused = hasFocus; - q->setCursorVisible(hasFocus); + q->setCursorVisible(hasFocus && scene && scene->hasFocus()); if(q->echoMode() == QDeclarativeTextInput::PasswordEchoOnEdit && !hasFocus) control->updatePasswordEchoEditing(false);//QLineControl sets it on key events, but doesn't deal with focus events if (!hasFocus) |