Qt实现的简单登录界面,可以连接MySQL数据库
...
setWindowTitle(tr("登录界面"));
userNameLabel = new QLabel(tr("用户名:"));
passWordLabel = new QLabel(tr("密码:"));
userNameLineEdit = new QLineEdit;
passWordLineEdit = new QLineEdit;
passWordLineEdit->setEchoMode(QLineEdit::Password);
login = new QPushButton(tr("登录"));
QGridLayout *mainLayout = new QGridLayout(this);
mainLayout->addWidget(userNameLabel,0,0);
mainLayout->addWidget(passWordLabel,1,0);
mainLayout->addWidget(userNameLineEdit,0,1);
mainLayout->addWidget(passWordLineEdit,1,1);
QHBoxLayout *hBoxLayout = new QHBoxLayout;
mainLayout->addLayout(hBoxLayout,2,0,1,2);
hBoxLayout->addStretch();
hBoxLayout->addWidget(login);
...
1