diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-11 16:18:54 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-11 16:24:52 (GMT) |
commit | c15c9cd2356eaeba33a5f8e62a90b0aeb45284e1 (patch) | |
tree | 6ebd8d8e7f2aaa8c477858a746e425d3aaf7c659 /src/gui/widgets/qlineedit.cpp | |
parent | f555e06c3e8eee7cc67218331562c11ad77ec9c4 (diff) | |
download | Qt-c15c9cd2356eaeba33a5f8e62a90b0aeb45284e1.zip Qt-c15c9cd2356eaeba33a5f8e62a90b0aeb45284e1.tar.gz Qt-c15c9cd2356eaeba33a5f8e62a90b0aeb45284e1.tar.bz2 |
Fixes cursor blinking in the QComboBox when it becomes editable while having the focus.
The lineedit has the focus because it becomes focusproxy of the QComboBox.
But the focusInEvent is not called because the combobox has already
the focus when setFocusProxy is called.
Workaround that in the show event.
Task-number: QTBUG-1949
Reviewed-by: Thierry
Diffstat (limited to 'src/gui/widgets/qlineedit.cpp')
-rw-r--r-- | src/gui/widgets/qlineedit.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 2c1acdb..15dcda2 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1445,6 +1445,16 @@ bool QLineEdit::event(QEvent * e) d->control->processEvent(e); } else if (e->type() == QEvent::KeyRelease) { d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()); + } else if (e->type() == QEvent::Show) { + //In order to get the cursor blinking if QComboBox::setEditable is called when the combobox has focus + if (hasFocus()) { + d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()); + QStyleOptionFrameV2 opt; + initStyleOption(&opt); + if ((!hasSelectedText() && d->control->preeditAreaText().isEmpty()) + || style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, this)) + d->setCursorVisible(true); + } } #ifdef QT_KEYPAD_NAVIGATION |