diff options
author | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2010-01-21 14:54:18 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2010-01-27 10:52:19 (GMT) |
commit | ad3b8f803830ff71d259eaf6b13d4d5d50093ceb (patch) | |
tree | 134aab610988416343de2d4693ca7932e0c416ca | |
parent | 57090af35f65d82fc6fd3db44c11a86895dc3305 (diff) | |
download | Qt-ad3b8f803830ff71d259eaf6b13d4d5d50093ceb.zip Qt-ad3b8f803830ff71d259eaf6b13d4d5d50093ceb.tar.gz Qt-ad3b8f803830ff71d259eaf6b13d4d5d50093ceb.tar.bz2 |
Make sure cursor is painted at the correct position when we are using IM.
When the line edit was refactored into a line control this regression
was introduced. This regression was introduced by change
fb7d86cf23227302d48db279ec589221d11a1f6a.
Task-number: QTBUG-4789
Reviewed-by: Alan Alpert
(cherry picked from commit 06ee48f7ad7f5ab8bdbaed765d301fa2c0b417fb)
-rw-r--r-- | src/gui/widgets/qlinecontrol.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/qlinecontrol_p.h | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 414c2ed..b0a64ea 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -524,8 +524,11 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl m_textLayout.draw(painter, offset, selections, clip); if (flags & DrawCursor){ + int cursor = m_cursor; + if (m_preeditCursor != -1) + cursor += m_preeditCursor; if(!m_blinkPeriod || m_blinkStatus) - m_textLayout.drawCursor(painter, offset, m_cursor, m_cursorWidth); + m_textLayout.drawCursor(painter, offset, cursor, m_cursorWidth); } } diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index 301ff72..d6f2705 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -549,7 +549,10 @@ inline qreal QLineControl::cursorToX(int cursor) const inline qreal QLineControl::cursorToX() const { - return cursorToX(m_cursor); + int cursor = m_cursor; + if (m_preeditCursor != -1) + cursor += m_preeditCursor; + return cursorToX(cursor); } inline bool QLineControl::isReadOnly() const |