Qt之QLineEdit学习

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

#include 
#include 
#include 
#include 
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QWidget w;

    QLineEdit edit;
    edit.show();
    edit.setParent(&w);

//   edit.setEchoMode(QLineEdit::Password);  //输入密码
//   edit.setEchoMode(QLineEdit::Normal);   //正常显示
//   edit.setEchoMode(QLineEdit::NoEcho);
//   edit.setEchoMode(QLineEdit::PasswordEchoOnEdit);
//    edit.text();
//    edit.setPlaceholderText("Please input text: ");
    
    QCompleter completer(QStringList() << "aab" << "123" << "998");
    completer.setFilterMode(Qt::MatchContains);  //设置补全模式:默认MatchStartsWith
    edit.setCompleter(&completer);   //自动补全功能

    w.show();
    w.setWindowTitle("Hello world");
    w.show();
    return app.exec();
}

Qt之QLineEdit学习_第1张图片

转载于:https://my.oschina.net/u/3919756/blog/1944086

你可能感兴趣的:(Qt之QLineEdit学习)