Qt 登陆界面实现

简单的QT用户登录界面

一、项目描述

在登录界面输入用户名和密码正确之后才进入欢迎界面。
用户名:xiaoxian
密码:1240

二、效果图

Qt 登陆界面实现_第1张图片
Qt 登陆界面实现_第2张图片

三、源代码

loginform.h

#ifndef LOGINFORM_H
#define LOGINFORM_H
 
#include 
#include 
#include 
#include 
 
 
class LoginForm : public QDialog
{
   
    Q_OBJECT //使用信号与槽需要的宏
public:
    explicit LoginForm(QDialog *parent = 0);  //explicit 防止歧义
 
signals:
 
public slots:
    void login();//点击登录按钮是执行的槽函数
private:
    QLabel *userNameLbl;         //"用户名"标签
    QLabel *pwdLbl;              //"密码"标签
    QLineEdit *userNameLEd;      //用户名编辑行
    QLineEdit *pwdLEd;           //密码编辑行
    QPushButton *loginBtn;       //登录按钮
    QPushButton *exitBtn;        

你可能感兴趣的:(Qt,Linux,qt,c++,linux,windows)