src/gui/widgets/qlinecontrol_p.h
changeset 30 5dc02b23752f
parent 19 fcece45ef507
child 33 3e2da88830cd
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
    92     ~QLineControl()
    92     ~QLineControl()
    93     {
    93     {
    94         delete [] m_maskData;
    94         delete [] m_maskData;
    95     }
    95     }
    96 
    96 
    97     int nextMaskBlank(int pos);
    97     int nextMaskBlank(int pos)
    98     int prevMaskBlank(int pos);
    98     {
    99 
    99         int c = findInMask(pos, true, false);
   100     bool isUndoAvailable() const;
   100         m_separator |= (c != pos);
   101     bool isRedoAvailable() const;
   101         return (c != -1 ?  c : m_maxLength);
   102     void clearUndo();
   102     }
   103     bool isModified() const;
   103 
   104     void setModified(bool modified);
   104     int prevMaskBlank(int pos)
   105 
   105     {
   106     bool allSelected() const;
   106         int c = findInMask(pos, false, false);
   107     bool hasSelectedText() const;
   107         m_separator |= (c != pos);
   108 
   108         return (c != -1 ? c : 0);
   109     int width() const;
   109     }
   110     int height() const;
   110 
   111     int ascent() const;
   111     bool isUndoAvailable() const { return !m_readOnly && m_undoState; }
   112     qreal naturalTextWidth() const;
   112     bool isRedoAvailable() const { return !m_readOnly && m_undoState < (int)m_history.size(); }
       
   113     void clearUndo() { m_history.clear(); m_modifiedState = m_undoState = 0; }
       
   114 
       
   115     bool isModified() const { return m_modifiedState != m_undoState; }
       
   116     void setModified(bool modified) { m_modifiedState = modified ? -1 : m_undoState; }
       
   117 
       
   118     bool allSelected() const { return !m_text.isEmpty() && m_selstart == 0 && m_selend == (int)m_text.length(); }
       
   119     bool hasSelectedText() const { return !m_text.isEmpty() && m_selend > m_selstart; }
       
   120 
       
   121     int width() const { return qRound(m_textLayout.lineAt(0).width()) + 1; }
       
   122     int height() const { return qRound(m_textLayout.lineAt(0).height()) + 1; }
       
   123     int ascent() const { return m_ascent; }
       
   124     qreal naturalTextWidth() const { return m_textLayout.lineAt(0).naturalTextWidth(); }
   113 
   125 
   114     void setSelection(int start, int length);
   126     void setSelection(int start, int length);
   115 
   127 
   116     QString selectedText() const;
   128     inline QString selectedText() const { return hasSelectedText() ? m_text.mid(m_selstart, m_selend - m_selstart) : QString(); }
   117     QString textBeforeSelection() const;
   129     QString textBeforeSelection() const { return hasSelectedText() ? m_text.left(m_selstart) : QString(); }
   118     QString textAfterSelection() const;
   130     QString textAfterSelection() const { return hasSelectedText() ? m_text.mid(m_selend) : QString(); }
   119 
   131 
   120     int selectionStart() const;
   132     int selectionStart() const { return hasSelectedText() ? m_selstart : -1; }
   121     int selectionEnd() const;
   133     int selectionEnd() const { return hasSelectedText() ? m_selend : -1; }
   122     bool inSelection(int x) const;
   134     bool inSelection(int x) const
   123 
   135     {
   124     void removeSelection();
   136         if (m_selstart >= m_selend)
   125 
   137             return false;
   126     int start() const;
   138         int pos = xToPos(x, QTextLine::CursorOnCharacter);
   127     int end() const;
   139         return pos >= m_selstart && pos < m_selend;
       
   140     }
       
   141 
       
   142     void removeSelection()
       
   143     {
       
   144         int priorState = m_undoState;
       
   145         removeSelectedText();
       
   146         finishChange(priorState);
       
   147     }
       
   148 
       
   149     int start() const { return 0; }
       
   150     int end() const { return m_text.length(); }
   128 
   151 
   129 #ifndef QT_NO_CLIPBOARD
   152 #ifndef QT_NO_CLIPBOARD
   130     void copy(QClipboard::Mode mode = QClipboard::Clipboard) const;
   153     void copy(QClipboard::Mode mode = QClipboard::Clipboard) const;
   131     void paste();
   154     void paste(QClipboard::Mode mode = QClipboard::Clipboard);
   132 #endif
   155 #endif
   133 
   156 
   134     int cursor() const;
   157     int cursor() const{ return m_cursor; }
   135     int preeditCursor() const;
   158     int preeditCursor() const { return m_preeditCursor; }
   136 
   159 
   137     int cursorWidth() const;
   160     int cursorWidth() const { return m_cursorWidth; }
   138     void setCursorWidth(int value);
   161     void setCursorWidth(int value) { m_cursorWidth = value; }
       
   162 
   139 
   163 
   140     void moveCursor(int pos, bool mark = false);
   164     void moveCursor(int pos, bool mark = false);
   141     void cursorForward(bool mark, int steps);
   165     void cursorForward(bool mark, int steps)
   142     void cursorWordForward(bool mark);
   166     {
   143     void cursorWordBackward(bool mark);
   167         int c = m_cursor;
   144     void home(bool mark);
   168         if (steps > 0) {
   145     void end(bool mark);
   169             while (steps--)
       
   170                 c = m_textLayout.nextCursorPosition(c);
       
   171         } else if (steps < 0) {
       
   172             while (steps++)
       
   173                 c = m_textLayout.previousCursorPosition(c);
       
   174         }
       
   175         moveCursor(c, mark);
       
   176     }
       
   177 
       
   178     void cursorWordForward(bool mark) { moveCursor(m_textLayout.nextCursorPosition(m_cursor, QTextLayout::SkipWords), mark); }
       
   179     void cursorWordBackward(bool mark) { moveCursor(m_textLayout.previousCursorPosition(m_cursor, QTextLayout::SkipWords), mark); }
       
   180 
       
   181     void home(bool mark) { moveCursor(0, mark); }
       
   182     void end(bool mark) { moveCursor(text().length(), mark); }
   146 
   183 
   147     int xToPos(int x, QTextLine::CursorPosition = QTextLine::CursorBetweenCharacters) const;
   184     int xToPos(int x, QTextLine::CursorPosition = QTextLine::CursorBetweenCharacters) const;
   148     QRect cursorRect() const;
   185     QRect cursorRect() const;
   149 
   186 
   150     qreal cursorToX(int cursor) const;
   187     qreal cursorToX(int cursor) const { return m_textLayout.lineAt(0).cursorToX(cursor); }
   151     qreal cursorToX() const;
   188     qreal cursorToX() const
   152 
   189     {
   153     bool isReadOnly() const;
   190         int cursor = m_cursor;
   154     void setReadOnly(bool enable);
   191         if (m_preeditCursor != -1)
   155 
   192             cursor += m_preeditCursor;
   156     QString text() const;
   193         return cursorToX(cursor);
   157     void setText(const QString &txt);
   194     }
   158 
   195 
   159     QString displayText() const;
   196     bool isReadOnly() const { return m_readOnly; }
       
   197     void setReadOnly(bool enable) { m_readOnly = enable; }
       
   198 
       
   199     QString text() const
       
   200     {
       
   201         QString res = m_maskData ? stripString(m_text) : m_text;
       
   202         return (res.isNull() ? QString::fromLatin1("") : res);
       
   203     }
       
   204     void setText(const QString &txt) { internalSetText(txt, -1, false); }
       
   205     QString displayText() const { return m_textLayout.text(); }
   160 
   206 
   161     void backspace();
   207     void backspace();
   162     void del();
   208     void del();
   163     void deselect();
   209     void deselect() { internalDeselect(); finishChange(); }
   164     void selectAll();
   210     void selectAll() { m_selstart = m_selend = m_cursor = 0; moveCursor(m_text.length(), true); }
       
   211 
   165     void insert(const QString &);
   212     void insert(const QString &);
   166     void clear();
   213     void clear();
   167     void undo();
   214     void undo() { internalUndo(); finishChange(-1, true); }
   168     void redo();
   215     void redo() { internalRedo(); finishChange(); }
   169     void selectWordAtPos(int);
   216     void selectWordAtPos(int);
   170 
   217 
   171     uint echoMode() const;
   218     uint echoMode() const { return m_echoMode; }
   172     void setEchoMode(uint mode);
   219     void setEchoMode(uint mode)
   173 
   220     {
   174     void setMaxLength(int maxLength);
   221         m_echoMode = mode;
   175     int maxLength() const;
   222         m_passwordEchoEditing = false;
       
   223         updateDisplayText();
       
   224     }
       
   225 
       
   226     int maxLength() const { return m_maxLength; }
       
   227     void setMaxLength(int maxLength)
       
   228     {
       
   229         if (m_maskData)
       
   230             return;
       
   231         m_maxLength = maxLength;
       
   232         setText(m_text);
       
   233     }
   176 
   234 
   177 #ifndef QT_NO_VALIDATOR
   235 #ifndef QT_NO_VALIDATOR
   178     const QValidator *validator() const;
   236     const QValidator *validator() const { return m_validator; }
   179     void setValidator(const QValidator *);
   237     void setValidator(const QValidator *v) { m_validator = const_cast<QValidator*>(v); }
   180 #endif
   238 #endif
   181 
   239 
   182 #ifndef QT_NO_COMPLETER
   240 #ifndef QT_NO_COMPLETER
   183     QCompleter *completer() const;
   241     QCompleter *completer() const { return m_completer; }
   184     void setCompleter(const QCompleter*);
   242     /* Note that you must set the widget for the completer seperately */
       
   243     void setCompleter(const QCompleter *c) { m_completer = const_cast<QCompleter*>(c); }
   185     void complete(int key);
   244     void complete(int key);
   186 #endif
   245 #endif
   187 
   246 
   188     void setCursorPosition(int pos);
   247     int cursorPosition() const { return m_cursor; }
   189     int cursorPosition() const;
   248     void setCursorPosition(int pos) { if (pos <= m_text.length()) moveCursor(qMax(0, pos)); }
   190 
   249 
   191     bool hasAcceptableInput() const;
   250     bool hasAcceptableInput() const { return hasAcceptableInput(m_text); }
   192     bool fixup();
   251     bool fixup();
   193 
   252 
   194     QString inputMask() const;
   253     QString inputMask() const { return m_maskData ? m_inputMask + QLatin1Char(';') + m_blank : QString(); }
   195     void setInputMask(const QString &mask);
   254     void setInputMask(const QString &mask)
       
   255     {
       
   256         parseInputMask(mask);
       
   257         if (m_maskData)
       
   258             moveCursor(nextMaskBlank(0));
       
   259     }
   196 
   260 
   197     // input methods
   261     // input methods
   198 #ifndef QT_NO_IM
   262 #ifndef QT_NO_IM
   199     bool composeMode() const;
   263     bool composeMode() const { return !m_textLayout.preeditAreaText().isEmpty(); }
   200     void setPreeditArea(int cursor, const QString &text);
   264     void setPreeditArea(int cursor, const QString &text) { m_textLayout.setPreeditArea(cursor, text); }
   201 #endif
   265 #endif
   202 
   266 
   203     QString preeditAreaText() const;
   267     QString preeditAreaText() const { return m_textLayout.preeditAreaText(); }
   204 
   268 
   205     void updatePasswordEchoEditing(bool editing);
   269     void updatePasswordEchoEditing(bool editing);
   206     bool passwordEchoEditing() const;
   270     bool passwordEchoEditing() const { return m_passwordEchoEditing; }
   207 
   271 
   208     QChar passwordCharacter() const;
   272     QChar passwordCharacter() const { return m_passwordCharacter; }
   209     void setPasswordCharacter(const QChar &character);
   273     void setPasswordCharacter(const QChar &character) { m_passwordCharacter = character; updateDisplayText(); }
   210 
   274 
   211     Qt::LayoutDirection layoutDirection() const;
   275     Qt::LayoutDirection layoutDirection() const { return m_layoutDirection; }
   212     void setLayoutDirection(Qt::LayoutDirection direction);
   276     void setLayoutDirection(Qt::LayoutDirection direction)
   213     void setFont(const QFont &font);
   277     {
       
   278         if (direction != m_layoutDirection) {
       
   279             m_layoutDirection = direction;
       
   280             updateDisplayText();
       
   281         }
       
   282     }
       
   283 
       
   284     void setFont(const QFont &font) { m_textLayout.setFont(font); updateDisplayText(); }
   214 
   285 
   215     void processInputMethodEvent(QInputMethodEvent *event);
   286     void processInputMethodEvent(QInputMethodEvent *event);
   216     void processMouseEvent(QMouseEvent* ev);
   287     void processMouseEvent(QMouseEvent* ev);
   217     void processKeyEvent(QKeyEvent* ev);
   288     void processKeyEvent(QKeyEvent* ev);
   218 
   289 
   219     int cursorBlinkPeriod() const;
   290     int cursorBlinkPeriod() const { return m_blinkPeriod; }
   220     void setCursorBlinkPeriod(int msec);
   291     void setCursorBlinkPeriod(int msec);
   221 
   292 
   222     QString cancelText() const;
   293     QString cancelText() const { return m_cancelText; }
   223     void setCancelText(const QString &text);
   294     void setCancelText(const QString &text) { m_cancelText = text; }
   224 
   295 
   225     const QPalette &palette() const;
   296     const QPalette &palette() const { return m_palette; }
   226     void setPalette(const QPalette &);
   297     void setPalette(const QPalette &p) { m_palette = p; }
   227 
   298 
   228     enum DrawFlags {
   299     enum DrawFlags {
   229         DrawText = 0x01,
   300         DrawText = 0x01,
   230         DrawSelections = 0x02,
   301         DrawSelections = 0x02,
   231         DrawCursor = 0x04,
   302         DrawCursor = 0x04,
   361     void _q_clipboardChanged();
   432     void _q_clipboardChanged();
   362     void _q_deleteSelected();
   433     void _q_deleteSelected();
   363 
   434 
   364 };
   435 };
   365 
   436 
   366 inline int QLineControl::nextMaskBlank(int pos)
       
   367 {
       
   368     int c = findInMask(pos, true, false);
       
   369     m_separator |= (c != pos);
       
   370     return (c != -1 ?  c : m_maxLength);
       
   371 }
       
   372 
       
   373 inline int QLineControl::prevMaskBlank(int pos)
       
   374 {
       
   375     int c = findInMask(pos, false, false);
       
   376     m_separator |= (c != pos);
       
   377     return (c != -1 ? c : 0);
       
   378 }
       
   379 
       
   380 inline bool QLineControl::isUndoAvailable() const
       
   381 { 
       
   382     return !m_readOnly && m_undoState;
       
   383 }
       
   384 
       
   385 inline bool QLineControl::isRedoAvailable() const
       
   386 {
       
   387     return !m_readOnly && m_undoState < (int)m_history.size();
       
   388 }
       
   389 
       
   390 inline void QLineControl::clearUndo()
       
   391 {
       
   392     m_history.clear();
       
   393     m_modifiedState = m_undoState = 0;
       
   394 }
       
   395 
       
   396 inline bool QLineControl::isModified() const
       
   397 {
       
   398     return m_modifiedState != m_undoState;
       
   399 }
       
   400 
       
   401 inline void QLineControl::setModified(bool modified)
       
   402 {
       
   403     m_modifiedState = modified ? -1 : m_undoState;
       
   404 }
       
   405 
       
   406 inline bool QLineControl::allSelected() const
       
   407 {
       
   408     return !m_text.isEmpty() && m_selstart == 0 && m_selend == (int)m_text.length();
       
   409 }
       
   410 
       
   411 inline bool QLineControl::hasSelectedText() const
       
   412 {
       
   413     return !m_text.isEmpty() && m_selend > m_selstart;
       
   414 }
       
   415 
       
   416 inline int QLineControl::width() const
       
   417 {
       
   418     return qRound(m_textLayout.lineAt(0).width()) + 1;
       
   419 }
       
   420 
       
   421 inline qreal QLineControl::naturalTextWidth() const
       
   422 {
       
   423     return m_textLayout.lineAt(0).naturalTextWidth();
       
   424 }
       
   425 
       
   426 inline int QLineControl::height() const
       
   427 {
       
   428     return qRound(m_textLayout.lineAt(0).height()) + 1;
       
   429 }
       
   430 
       
   431 inline int QLineControl::ascent() const
       
   432 {
       
   433     return m_ascent;
       
   434 }
       
   435 
       
   436 inline QString QLineControl::selectedText() const
       
   437 {
       
   438     if (hasSelectedText())
       
   439         return m_text.mid(m_selstart, m_selend - m_selstart);
       
   440     return QString();
       
   441 }
       
   442 
       
   443 inline QString QLineControl::textBeforeSelection() const
       
   444 {
       
   445     if (hasSelectedText())
       
   446         return m_text.left(m_selstart);
       
   447     return QString();
       
   448 }
       
   449 
       
   450 inline QString QLineControl::textAfterSelection() const
       
   451 {
       
   452     if (hasSelectedText())
       
   453         return m_text.mid(m_selend);
       
   454     return QString();
       
   455 }
       
   456 
       
   457 inline int QLineControl::selectionStart() const
       
   458 {
       
   459     return hasSelectedText() ? m_selstart : -1;
       
   460 }
       
   461 
       
   462 inline int QLineControl::selectionEnd() const
       
   463 {
       
   464     return hasSelectedText() ? m_selend : -1;
       
   465 }
       
   466 
       
   467 inline int QLineControl::start() const
       
   468 {
       
   469     return 0;
       
   470 }
       
   471 
       
   472 inline int QLineControl::end() const
       
   473 {
       
   474     return m_text.length();
       
   475 }
       
   476 
       
   477 inline void QLineControl::removeSelection()
       
   478 {
       
   479     int priorState = m_undoState;
       
   480     removeSelectedText();
       
   481     finishChange(priorState);
       
   482 }
       
   483 
       
   484 inline bool QLineControl::inSelection(int x) const
       
   485 {
       
   486     if (m_selstart >= m_selend)
       
   487         return false;
       
   488     int pos = xToPos(x, QTextLine::CursorOnCharacter);
       
   489     return pos >= m_selstart && pos < m_selend;
       
   490 }
       
   491 
       
   492 inline int QLineControl::cursor() const
       
   493 {
       
   494     return m_cursor;
       
   495 }
       
   496 
       
   497 inline int QLineControl::preeditCursor() const
       
   498 {
       
   499     return m_preeditCursor;
       
   500 }
       
   501 
       
   502 inline int QLineControl::cursorWidth() const
       
   503 {
       
   504     return m_cursorWidth;
       
   505 }
       
   506 
       
   507 inline void QLineControl::setCursorWidth(int value)
       
   508 {
       
   509     m_cursorWidth = value;
       
   510 }
       
   511 
       
   512 inline void QLineControl::cursorForward(bool mark, int steps)
       
   513 {
       
   514     int c = m_cursor;
       
   515     if (steps > 0) {
       
   516         while (steps--)
       
   517             c = m_textLayout.nextCursorPosition(c);
       
   518     } else if (steps < 0) {
       
   519         while (steps++)
       
   520             c = m_textLayout.previousCursorPosition(c);
       
   521     }
       
   522     moveCursor(c, mark);
       
   523 }
       
   524 
       
   525 inline void QLineControl::cursorWordForward(bool mark)
       
   526 {
       
   527     moveCursor(m_textLayout.nextCursorPosition(m_cursor, QTextLayout::SkipWords), mark);
       
   528 }
       
   529 
       
   530 inline void QLineControl::home(bool mark)
       
   531 {
       
   532     moveCursor(0, mark);
       
   533 }
       
   534 
       
   535 inline void QLineControl::end(bool mark)
       
   536 {
       
   537     moveCursor(text().length(), mark);
       
   538 }
       
   539 
       
   540 inline void QLineControl::cursorWordBackward(bool mark)
       
   541 {
       
   542     moveCursor(m_textLayout.previousCursorPosition(m_cursor, QTextLayout::SkipWords), mark);
       
   543 }
       
   544 
       
   545 inline qreal QLineControl::cursorToX(int cursor) const
       
   546 {
       
   547     return m_textLayout.lineAt(0).cursorToX(cursor);
       
   548 }
       
   549 
       
   550 inline qreal QLineControl::cursorToX() const
       
   551 {
       
   552     int cursor = m_cursor;
       
   553     if (m_preeditCursor != -1)
       
   554         cursor += m_preeditCursor;
       
   555     return cursorToX(cursor);
       
   556 }
       
   557 
       
   558 inline bool QLineControl::isReadOnly() const
       
   559 {
       
   560     return m_readOnly;
       
   561 }
       
   562 
       
   563 inline void QLineControl::setReadOnly(bool enable)
       
   564 { 
       
   565     m_readOnly = enable;
       
   566 }
       
   567 
       
   568 inline QString QLineControl::text() const
       
   569 {
       
   570     QString res = m_maskData ? stripString(m_text) : m_text;
       
   571     return (res.isNull() ? QString::fromLatin1("") : res);
       
   572 }
       
   573 
       
   574 inline void QLineControl::setText(const QString &txt)
       
   575 {
       
   576     internalSetText(txt, -1, false);
       
   577 }
       
   578 
       
   579 inline QString QLineControl::displayText() const
       
   580 {
       
   581     return m_textLayout.text();
       
   582 }
       
   583 
       
   584 inline void QLineControl::deselect()
       
   585 {
       
   586     internalDeselect();
       
   587     finishChange();
       
   588 }
       
   589 
       
   590 inline void QLineControl::selectAll()
       
   591 {
       
   592     m_selstart = m_selend = m_cursor = 0;
       
   593     moveCursor(m_text.length(), true);
       
   594 }
       
   595 
       
   596 inline void QLineControl::undo()
       
   597 {
       
   598     internalUndo();
       
   599     finishChange(-1, true);
       
   600 }
       
   601 
       
   602 inline void QLineControl::redo()
       
   603 {
       
   604     internalRedo();
       
   605     finishChange();
       
   606 }
       
   607 
       
   608 inline uint QLineControl::echoMode() const
       
   609 {
       
   610     return m_echoMode;
       
   611 }
       
   612 
       
   613 inline void QLineControl::setEchoMode(uint mode)
       
   614 {
       
   615     m_echoMode = mode;
       
   616     m_passwordEchoEditing = false;
       
   617     updateDisplayText();
       
   618 }
       
   619 
       
   620 inline void QLineControl::setMaxLength(int maxLength)
       
   621 {
       
   622     if (m_maskData)
       
   623         return;
       
   624     m_maxLength = maxLength;
       
   625     setText(m_text);
       
   626 }
       
   627 
       
   628 inline int QLineControl::maxLength() const
       
   629 {
       
   630     return m_maxLength;
       
   631 }
       
   632 
       
   633 #ifndef QT_NO_VALIDATOR
       
   634 inline const QValidator *QLineControl::validator() const
       
   635 {
       
   636     return m_validator;
       
   637 }
       
   638 
       
   639 inline void QLineControl::setValidator(const QValidator *v)
       
   640 {
       
   641     m_validator = const_cast<QValidator*>(v);
       
   642 }
       
   643 #endif
       
   644 
       
   645 #ifndef QT_NO_COMPLETER
       
   646 inline QCompleter *QLineControl::completer() const
       
   647 {
       
   648     return m_completer;
       
   649 }
       
   650 
       
   651 /* Note that you must set the widget for the completer seperately */
       
   652 inline void QLineControl::setCompleter(const QCompleter* c)
       
   653 {
       
   654     m_completer = const_cast<QCompleter*>(c);
       
   655 }
       
   656 #endif
       
   657 
       
   658 inline void QLineControl::setCursorPosition(int pos)
       
   659 {
       
   660     if (pos < 0)
       
   661         pos = 0;
       
   662     if (pos <= m_text.length())
       
   663         moveCursor(pos);
       
   664 }
       
   665 
       
   666 inline int QLineControl::cursorPosition() const
       
   667 {
       
   668     return m_cursor;
       
   669 }
       
   670 
       
   671 inline bool QLineControl::hasAcceptableInput() const
       
   672 {
       
   673     return hasAcceptableInput(m_text);
       
   674 }
       
   675 
       
   676 inline QString QLineControl::inputMask() const
       
   677 {
       
   678     return m_maskData ? m_inputMask + QLatin1Char(';') + m_blank : QString();
       
   679 }
       
   680 
       
   681 inline void QLineControl::setInputMask(const QString &mask)
       
   682 {
       
   683     parseInputMask(mask);
       
   684     if (m_maskData)
       
   685         moveCursor(nextMaskBlank(0));
       
   686 }
       
   687 
       
   688 // input methods
       
   689 #ifndef QT_NO_IM
       
   690 inline bool QLineControl::composeMode() const
       
   691 {
       
   692     return !m_textLayout.preeditAreaText().isEmpty();
       
   693 }
       
   694 
       
   695 inline void QLineControl::setPreeditArea(int cursor, const QString &text)
       
   696 {
       
   697     m_textLayout.setPreeditArea(cursor, text);
       
   698 }
       
   699 #endif
       
   700 
       
   701 inline QString QLineControl::preeditAreaText() const
       
   702 {
       
   703     return m_textLayout.preeditAreaText();
       
   704 }
       
   705 
       
   706 inline bool QLineControl::passwordEchoEditing() const
       
   707 {
       
   708     return m_passwordEchoEditing;
       
   709 }
       
   710 
       
   711 inline QChar QLineControl::passwordCharacter() const
       
   712 {
       
   713     return m_passwordCharacter;
       
   714 }
       
   715 
       
   716 inline void QLineControl::setPasswordCharacter(const QChar &character)
       
   717 {
       
   718     m_passwordCharacter = character;
       
   719     updateDisplayText();
       
   720 }
       
   721 
       
   722 inline Qt::LayoutDirection QLineControl::layoutDirection() const
       
   723 {
       
   724     return m_layoutDirection;
       
   725 }
       
   726 
       
   727 inline void QLineControl::setLayoutDirection(Qt::LayoutDirection direction)
       
   728 {
       
   729     if (direction != m_layoutDirection) {
       
   730         m_layoutDirection = direction;
       
   731         updateDisplayText();
       
   732     }
       
   733 }
       
   734 
       
   735 inline void QLineControl::setFont(const QFont &font)
       
   736 {
       
   737     m_textLayout.setFont(font);
       
   738     updateDisplayText();
       
   739 }
       
   740 
       
   741 inline int QLineControl::cursorBlinkPeriod() const
       
   742 {
       
   743     return m_blinkPeriod;
       
   744 }
       
   745 
       
   746 inline QString QLineControl::cancelText() const
       
   747 {
       
   748     return m_cancelText;
       
   749 }
       
   750 
       
   751 inline void QLineControl::setCancelText(const QString &text)
       
   752 {
       
   753     m_cancelText = text;
       
   754 }
       
   755 
       
   756 inline const QPalette & QLineControl::palette() const
       
   757 {
       
   758     return m_palette;
       
   759 }
       
   760 
       
   761 inline void QLineControl::setPalette(const QPalette &p)
       
   762 {
       
   763     m_palette = p;
       
   764 }
       
   765 
       
   766 QT_END_NAMESPACE
   437 QT_END_NAMESPACE
   767 
   438 
   768 QT_END_HEADER
   439 QT_END_HEADER
   769 
   440 
   770 #endif // QT_NO_LINEEDIT
   441 #endif // QT_NO_LINEEDIT