src/gui/widgets/qlineedit_p.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
equal deleted inserted replaced
18:2f34d5167611 19:fcece45ef507
   127 #endif
   127 #endif
   128 
   128 
   129 void QLineEditPrivate::_q_selectionChanged()
   129 void QLineEditPrivate::_q_selectionChanged()
   130 {
   130 {
   131     Q_Q(QLineEdit);
   131     Q_Q(QLineEdit);
   132     if (control->preeditAreaText().isEmpty()) {
   132     if (!control->text().isEmpty() && control->preeditAreaText().isEmpty()) {
   133         QStyleOptionFrameV2 opt;
   133         QStyleOptionFrameV2 opt;
   134         q->initStyleOption(&opt);
   134         q->initStyleOption(&opt);
   135         bool showCursor = control->hasSelectedText() ?
   135         bool showCursor = control->hasSelectedText() ?
   136                           q->style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, q):
   136                           q->style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, q):
   137                           true;
   137                           q->hasFocus();
   138         setCursorVisible(showCursor);
   138         setCursorVisible(showCursor);
   139     }
   139     }
   140 
   140 
   141     emit q->selectionChanged();
   141     emit q->selectionChanged();
   142 }
   142 }