单行文本框+按钮实现用户登录
1. 观察可以设置的属性
2. 阅读文档,掌握常用的函数接口
3. 阅读文档,掌握常用的信号
相关信号
voidcursorPositionChanged ( int old, int new )
voideditingFinished () // 当失去焦点
voidreturnPressed () // 当回车键被按下
voidselectionChanged ()
voidtextChanged ( const QString & text )
// 当文本有变化
voidtextEdited ( const QString & text )
常用的函数接口:
Qstring text(),返回文本框的内容(字符串类型)
ui设计
maxlength:字符串长度
echoMode:回显模式,比如密码要用"password"模式
placeholdertext:在上图中显示的“请输入用户名”
mywin.h文件中
在mywin.cpp中
效果
注意:提示框这么用
#include"QMessageBox"
QMessageBox::information( this , "OK" ,"success");