aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextinput.cpp
diff options
context:
space:
mode:
authorPekka Vuorela <pekka.ta.vuorela@nokia.com>2012-02-29 18:43:50 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-26 10:36:31 +0200
commitf32ae39ac4b634bd82adc7e5a756f801e70e879a (patch)
treec333558e2f6f80df44c3515a6dfac99e1e16e81c /src/quick/items/qquicktextinput.cpp
parent2532c475d16b7b2252f44ab1fe858d17262d7fc1 (diff)
Remove tentative commit from editors
Feature to be reimplemented simplified. Now using new FocusAboutToChange event for using input method to commit stuff when window is losing focus. Change-Id: I81c96c36d9f0a1b38adb4324f3b892c33547cb50 Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Diffstat (limited to 'src/quick/items/qquicktextinput.cpp')
-rw-r--r--src/quick/items/qquicktextinput.cpp33
1 files changed, 4 insertions, 29 deletions
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 94856b63ab..f2da67bae7 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -119,8 +119,6 @@ QString QQuickTextInput::text() const
Q_D(const QQuickTextInput);
QString content = d->m_text;
- if (!d->m_tentativeCommit.isEmpty())
- content.insert(d->m_cursor, d->m_tentativeCommit);
QString res = d->m_maskData ? d->stripString(content) : content;
return (res.isNull() ? QString::fromLatin1("") : res);
}
@@ -132,7 +130,6 @@ void QQuickTextInput::setText(const QString &s)
return;
if (d->composeMode())
qApp->inputMethod()->reset();
- d->m_tentativeCommit.clear();
d->internalSetText(s, -1, false);
}
@@ -2496,7 +2493,6 @@ void QQuickTextInput::itemChange(ItemChange change, const ItemChangeData &value)
}
if (!hasFocus) {
- d->commitPreedit();
if (!d->persistentSelection)
d->deselect();
disconnect(qApp->inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),
@@ -2831,21 +2827,16 @@ void QQuickTextInputPrivate::paste(QClipboard::Mode clipboardMode)
/*!
\internal
-
- Exits preedit mode and commits parts marked as tentative commit
*/
void QQuickTextInputPrivate::commitPreedit()
{
if (!composeMode())
return;
- qApp->inputMethod()->reset();
+ qApp->inputMethod()->commit();
- if (!m_tentativeCommit.isEmpty()) {
- internalInsert(m_tentativeCommit);
- m_tentativeCommit.clear();
- finishChange(-1, true/*not used, not documented*/, false);
- }
+ if (!composeMode())
+ return;
m_preeditCursor = 0;
m_textLayout.setPreeditArea(-1, QString());
@@ -3160,14 +3151,7 @@ void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event)
q->updateCursorRectangle();
}
- bool tentativeCommitChanged = m_tentativeCommit != event->tentativeCommitString();
-
- if (tentativeCommitChanged) {
- m_textDirty = true;
- m_tentativeCommit = event->tentativeCommitString();
- }
-
- if (isGettingInput || tentativeCommitChanged)
+ if (isGettingInput)
finishChange(priorState);
if (selectionChange) {
@@ -3237,15 +3221,6 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo
return true;
}
m_cursor = cursorCopy;
-
- if (!m_tentativeCommit.isEmpty()) {
- textCopy.insert(m_cursor, m_tentativeCommit);
- bool validInput = m_validator->validate(textCopy, cursorCopy) != QValidator::Invalid;
- if (!validInput)
- m_tentativeCommit.clear();
- }
- } else {
- m_tentativeCommit.clear();
}
}
#endif