src/gui/widgets/qlineedit_p.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     8 **
     8 **
   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 }