代码拉取完成,页面将自动刷新
#include "userform.h"
#include "ui_userform.h"
UserForm::UserForm(datebase *db,int ID,QWidget *parent) :
QDialog(parent),
ui(new Ui::UserForm)
{
ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint);
User_db=db;
User_ID=ID;
ui->lineEdit_PerM_Pass->setEchoMode(QLineEdit::Password);
ui->lineEdit_PerM_Pass_Second->setEchoMode(QLineEdit::Password);
GetUserInfo();
}
UserForm::~UserForm()
{
delete ui;
}
void UserForm::paintEvent(QPaintEvent *)//背景
{
QPixmap pix(":/images/Sback.jpg");
QPainter painter(this);
int w = width();
int h = height();
painter.drawPixmap(0,0,w,h,pix);
}
void UserForm::GetUserInfo()
{
bool res;
QString str,user;
str=QString("select User from UserSys where Id = '%1'").arg(User_ID);
QSqlQuery query(*this->User_db->sqlite_db);
query.clear();
query.exec(str);
res=query.next();
if(res)
{
user=query.value(0).toString();
ui->lineEdit_PerM_User->setText(user);
}
}
void UserForm::on_pushButton_Quit_clicked()
{
this->close();
}
void UserForm::on_pushButton_OK_clicked()
{
QString pass,passSecond,user;
pass=ui->lineEdit_PerM_Pass->text().trimmed();
passSecond=ui->lineEdit_PerM_Pass_Second->text().trimmed();
if(pass.isEmpty() || passSecond.isEmpty())
{
QMessageBox::information(this,tr("提示"),tr("密码为空"));
return;
}
if(pass != passSecond)
{
QMessageBox::information(this,tr("提示"),tr("密码不一致"));
return ;
}
user=ui->lineEdit_PerM_User->text().trimmed();
User_db->updateUserInfo(User_db->sqlite_db,User_ID,user,pass);
this->close();
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。