changepassword.cpp 1.14 KB
#include "changepassword.h"
#include "ui_changepassword.h"

changePassword::changePassword(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::changePassword)
{
    ui->setupUi(this);
}

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

bool changePassword::eventFilter(QObject *watched, QEvent *event)
{
    if (watched==ui->input_passwd)         //首先判断控件(这里指 lineEdit1)
    {
        if (event->type()==Qt::ClickFocus)     //然后再判断控件的具体事件 (这里指获得焦点事件)
        {
            globaldata = "";
            ui->input_passwd->setText("");
        }
    }

    if (watched==ui->affirm_passwd)         //首先判断控件(这里指 lineEdit1)
    {
        if (event->type()==Qt::ClickFocus)     //然后再判断控件的具体事件 (这里指获得焦点事件)
        {
            globaldata = "";
            ui->affirm_passwd->setText("");
        }
    }
}



void changePassword::on_input_passwd_textChanged(const QString &arg1)
{
    globaldata = ui->input_passwd->text();
}

void changePassword::on_affirm_passwd_textChanged(const QString &arg1)
{
    globaldata = ui->affirm_passwd->text();
}