马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
默认的登入用户名为:jhz, 密码:admin#mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QMessageBox>
#include <QLineEdit>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void on_loginButton_clicked();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
#mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->passwordlineEdit->setEchoMode(QLineEdit::Password);
QObject::connect(ui->passwordlineEdit,SIGNAL(returnPressed()),this,SLOT(on_loginButton_clicked()));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_loginButton_clicked()
{
if(ui->userlineEdit->text()=="jhz"&&ui->passwordlineEdit->text()=="admin")
{
QMessageBox::information(this,"Login","Login Successd");
}
else
{
QMessageBox::information(this,"Passwd Error","Please Input currected user or passwd");
return;
}
}
|