aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPekka Vuorela <pekka.ta.vuorela@nokia.com>2012-01-04 14:46:09 +0200
committerQt by Nokia <qt-info@nokia.com>2012-01-05 16:31:56 +0100
commit4e9efd590df116bad85632d32ac4fed0a1c29065 (patch)
treefd069050940c090ee4f3e1cd1e21d0e2ab967a9c /src
parentcd1342197e3132a901ab71af6e2d0891a91ad534 (diff)
QQuickTextInput to better call QInputPanel::update()
Some updates were previously omitted, e.g. if text content changed but cursor position remained the same, or if input method changed the selection. Change-Id: I11abd105632d73f8ebb23d0e8c308c53c236cc15 Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquicktextinput.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 8b44052126..bb15acb29b 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -305,6 +305,7 @@ void QQuickTextInput::setFont(const QFont &font)
if (oldFont != d->font) {
d->updateLayout();
updateCursorRectangle();
+ qApp->inputPanel()->update(Qt::ImCursorRectangle | Qt::ImFont);
}
emit fontChanged(d->sourceFont);
}
@@ -2312,7 +2313,6 @@ void QQuickTextInput::updateCursorRectangle()
d->updateHorizontalScroll();
d->updateVerticalScroll();
update();
- updateMicroFocus();
emit cursorRectangleChanged();
if (d->cursorItem) {
QRectF r = cursorRectangle();
@@ -2673,6 +2673,8 @@ void QQuickTextInputPrivate::setSelection(int start, int length)
}
emit q->selectionChanged();
emitCursorPositionChanged();
+ qApp->inputPanel()->update(Qt::ImCursorRectangle | Qt::ImAnchorPosition
+ | Qt::ImCursorPosition | Qt::ImCurrentSelection);
}
/*!
@@ -2762,6 +2764,7 @@ void QQuickTextInputPrivate::moveCursor(int pos, bool mark)
emit q->selectionChanged();
}
emitCursorPositionChanged();
+ q->updateMicroFocus();
}
/*!
@@ -2858,10 +2861,12 @@ void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event)
m_textLayout.setAdditionalFormats(formats);
updateDisplayText(/*force*/ true);
- if (cursorPositionChanged)
+ if (cursorPositionChanged) {
emitCursorPositionChanged();
- else if (m_preeditCursor != oldPreeditCursor)
+ } else if (m_preeditCursor != oldPreeditCursor) {
q->updateCursorRectangle();
+ qApp->inputPanel()->update(Qt::ImCursorRectangle);
+ }
bool tentativeCommitChanged = m_tentativeCommit != event->tentativeCommitString();
@@ -2873,8 +2878,11 @@ void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event)
if (isGettingInput || tentativeCommitChanged)
finishChange(priorState);
- if (selectionChange)
+ if (selectionChange) {
emit q->selectionChanged();
+ qApp->inputPanel()->update(Qt::ImCursorRectangle | Qt::ImAnchorPosition
+ | Qt::ImCursorPosition | Qt::ImCurrentSelection);
+ }
}
/*!
@@ -2915,6 +2923,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo
Q_Q(QQuickTextInput);
Q_UNUSED(update)
+ bool notifyInputPanel = m_textDirty || m_selDirty;
if (m_textDirty) {
// do validation
@@ -2974,6 +2983,10 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo
m_selDirty = false;
emit q->selectionChanged();
}
+
+ notifyInputPanel |= (m_cursor == m_lastCursorPos);
+ if (notifyInputPanel)
+ q->updateMicroFocus();
emitCursorPositionChanged();
return true;