diff options
author | Sami Merila <sami.merila@nokia.com> | 2010-08-27 11:09:40 (GMT) |
---|---|---|
committer | Sami Merila <sami.merila@nokia.com> | 2010-08-27 11:09:40 (GMT) |
commit | 9ef61d3d1e53d32dc2568cbfb9f8ff5b19cb4ffc (patch) | |
tree | 49bfa2a546ba22c118fb1073db4c524e218db853 /src/gui | |
parent | 4c9212cdf38b35e89311416436f1e60b818b69c3 (diff) | |
download | Qt-9ef61d3d1e53d32dc2568cbfb9f8ff5b19cb4ffc.zip Qt-9ef61d3d1e53d32dc2568cbfb9f8ff5b19cb4ffc.tar.gz Qt-9ef61d3d1e53d32dc2568cbfb9f8ff5b19cb4ffc.tar.bz2 |
QLineEdit cursor is shown when asked to be non-visible
If QLineEdit is sent a QInputMethodEvent::Cursor event with value zero,
widget still shows blinking cursor. This is due to that QLineControl
ignores its internal state variable m_hideCursor value.
As a fix, m_hideCursor is now considered when drawing the cursor.
Additionally, the cursor blinking timer is stopped when cursor is
hidden.
Task-number: QT-3670
Reviewed-by: axis
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/qlinecontrol.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index d027b91..7f0c6c8 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -464,6 +464,8 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) if (a.type == QInputMethodEvent::Cursor) { m_preeditCursor = a.start; m_hideCursor = !a.length; + if (m_hideCursor) + setCursorBlinkPeriod(0); } else if (a.type == QInputMethodEvent::TextFormat) { QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat(); if (f.isValid()) { @@ -527,7 +529,7 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl int cursor = m_cursor; if (m_preeditCursor != -1) cursor += m_preeditCursor; - if(!m_blinkPeriod || m_blinkStatus) + if (!m_hideCursor && (!m_blinkPeriod || m_blinkStatus)) m_textLayout.drawCursor(painter, offset, cursor, m_cursorWidth); } } |