src/gui/widgets/qlinecontrol.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
child 30 5dc02b23752f
equal deleted inserted replaced
18:2f34d5167611 19:fcece45ef507
    63     \internal
    63     \internal
    64 
    64 
    65     Updates the display text based of the current edit text
    65     Updates the display text based of the current edit text
    66     If the text has changed will emit displayTextChanged()
    66     If the text has changed will emit displayTextChanged()
    67 */
    67 */
    68 void QLineControl::updateDisplayText()
    68 void QLineControl::updateDisplayText(bool forceUpdate)
    69 {
    69 {
    70     QString orig = m_textLayout.text();
    70     QString orig = m_textLayout.text();
    71     QString str;
    71     QString str;
    72     if (m_echoMode == QLineEdit::NoEcho)
    72     if (m_echoMode == QLineEdit::NoEcho)
    73         str = QString::fromLatin1("");
    73         str = QString::fromLatin1("");
   100     m_textLayout.beginLayout();
   100     m_textLayout.beginLayout();
   101     QTextLine l = m_textLayout.createLine();
   101     QTextLine l = m_textLayout.createLine();
   102     m_textLayout.endLayout();
   102     m_textLayout.endLayout();
   103     m_ascent = qRound(l.ascent());
   103     m_ascent = qRound(l.ascent());
   104 
   104 
   105     if (str != orig)
   105     if (str != orig || forceUpdate)
   106         emit displayTextChanged(str);
   106         emit displayTextChanged(str);
   107 }
   107 }
   108 
   108 
   109 #ifndef QT_NO_CLIPBOARD
   109 #ifndef QT_NO_CLIPBOARD
   110 /*!
   110 /*!
   474                 formats.append(o);
   474                 formats.append(o);
   475             }
   475             }
   476         }
   476         }
   477     }
   477     }
   478     m_textLayout.setAdditionalFormats(formats);
   478     m_textLayout.setAdditionalFormats(formats);
   479     updateDisplayText();
   479     updateDisplayText(/*force*/ true);
   480     if (cursorPositionChanged)
   480     if (cursorPositionChanged)
   481         emitCursorPositionChanged();
   481         emitCursorPositionChanged();
   482     if (isGettingInput)
   482     if (isGettingInput)
   483         finishChange(priorState);
   483         finishChange(priorState);
   484 }
   484 }