diff options
author | Pekka Vuorela <pekka.ta.vuorela@nokia.com> | 2011-10-12 11:08:00 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-05 23:47:02 +0100 |
commit | 8bd40fef0733a4796a308b3bc137a05296e142c4 (patch) | |
tree | 10ff24637ab73cd1516bda8c39bd121aac412e97 /src/widgets/widgets/qwidgetlinecontrol_p.h | |
parent | 4b3d88a9c67402b6a234d597bab25846f039bbdb (diff) |
Support tentative commit string with input method.
Tentative commit string allows input method to notify editor
what is expected to be committed in the place of preedit.
This commit adds such support in QLineEdit.
Change-Id: If855619bc6843652db0d6254f7e7063bb8ad0936
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/widgets/widgets/qwidgetlinecontrol_p.h')
-rw-r--r-- | src/widgets/widgets/qwidgetlinecontrol_p.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h index 4ffa9e4b31..3bcdffbf08 100644 --- a/src/widgets/widgets/qwidgetlinecontrol_p.h +++ b/src/widgets/widgets/qwidgetlinecontrol_p.h @@ -215,10 +215,26 @@ public: QString text() const { + QString content = m_text; + if (!m_tentativeCommit.isEmpty()) + content.insert(m_cursor, m_tentativeCommit); + QString res = m_maskData ? stripString(content) : content; + return (res.isNull() ? QString::fromLatin1("") : res); + } + // like text() but doesn't include preedit + QString realText() const + { QString res = m_maskData ? stripString(m_text) : m_text; return (res.isNull() ? QString::fromLatin1("") : res); } - void setText(const QString &txt) { internalSetText(txt, -1, false); } + void setText(const QString &txt) + { + if (composeMode()) + qApp->inputPanel()->reset(); + m_tentativeCommit.clear(); + internalSetText(txt, -1, false); + } + QString displayText() const { return m_textLayout.text(); } void backspace(); @@ -379,6 +395,7 @@ private: int m_cursor; int m_preeditCursor; int m_cursorWidth; + QString m_tentativeCommit; Qt::LayoutDirection m_layoutDirection; uint m_hideCursor : 1; // used to hide the m_cursor inside preedit areas uint m_separator : 1; |