QLineEdit Is a single line text box .

    QTextEdit Is a multiline text box .

 

 

(1) Single line text box QLineEdit

Common methods and attributes :

  (a) Gets and sets text alignment
Qt::Alignment alignment () const void setAlignment ( Qt::Alignment flag )
  (b) Gets and sets the contents of the file box
QString text () const void setText ( const QString & )
  (c) Gets and sets the selected text
QString selectedText () const void QLineEdit::setSelection ( int start, int
length )
  (d) Get and set echoMode pattern
EchoMode echoMode () const void setEchoMode ( EchoMode )
echoMode The value of the pattern can be :
QLineEdit::Normal 0 Display characters as they are entered. This is the
default. QLineEdit::NoEcho 1 Do not display anything. This may be appropriate
for passwords where even the length of the password should be kept secret.
QLineEdit::Password 2 Display asterisks instead of the characters actually
entered. QLineEdit::PasswordEchoOnEdit 3 Display characters as they are entered
while editing otherwise display asterisks.

(2) Multiline text box QTextEdit
   QTextEdit Show multiline text content , When the text content is beyond the display range of the control , Horizontal and vertical scrollbars can be displayed .

  By setting acceptRichText attribute ,QTextEdit Not only can text be displayed , You can also display HTML file , image , Table and other elements .

 

Examples :

(1) Sets the contents of a multiline text box :
textEdt->setPlainText("12345\nabcdef");

(2) Gets the contents of a multiline text box :
QString str; str = textEdt->toPlainText();

 

Technology
©2019-2020 Toolsou All rights reserved,
Send love - A little romance for programmers VHDL—— Design of frequency divider Python Implementation of Hanoi Tower code It's over , Starting salary 30khtml+css+js Make a simple website home page QQ Login interface implementation Hill sorting of sorting algorithm ——c++ realization 【 Wechat applet learning 】 Netease music cloud code page implementation details Resume the 13th session python Blue Bridge Cup 2022 Solution to the 13th Blue Bridge Cup ( whole )