qtday2

#include "widget.h"
#include "ui_widget.h"
using namespace std;
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    //qt4版本
    connect(ui->out,SIGNAL(clicked()),this,SLOT(close()));

    connect(ui->land,&QPushButton::clicked,this,&Widget::land_slot);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::land_slot()
{
    if(ui->account->text() == "admin" && ui->passwad->text() == "123456")
    {
      qDebug("%s","登陆成功");
      this->close();
    }
    else
    {
        ui->account->setText("");
        ui->passwad->setText("");
        qDebug("%s","登陆失败");


    }
}

你可能感兴趣的:(命令模式)