1 Star 0 Fork 2

夕阳/EmployeeManagement-for-Qt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
frmupdate.cpp 1.43 KB
一键复制 编辑 原始数据 按行查看 历史
Sugarscat 提交于 2022-07-18 16:18 . main
#include "frmupdate.h"
#include "ui_frmupdate.h"
FrmUpdate::FrmUpdate(int place, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::FrmUpdate)
{
ui->setupUi(this);
Employee *emp = EmployeeContainer::employeelist->at(place);
ui->letId->setText(QString::number(emp->id));
ui->letName->setText(QString::fromStdString(emp->name));
ui->letPhone->setText(QString::fromStdString(emp->phone));
ui->letDepart->setText(QString::fromStdString(emp->depart));
uplace = place;
}
FrmUpdate::~FrmUpdate()
{
delete ui;
}
bool FrmUpdate::judge(int id, string name, string phone, string depart){
if(id <=0 || name == "" || phone == "" || depart == ""){
QMessageBox::critical(this, "错误", "添加失败!可能原因:\n编号小于1\n姓名、电话或部门为空!");
return false;
}
return true;
}
void FrmUpdate::on_btnChange_clicked()
{
int id = ui->letId->text().toInt();
string name = ui->letName->text().toStdString();
string phone = ui->letPhone->text().toStdString();
string depart = ui->letDepart->text().toStdString();
//修改员工
if(judge(id, name, phone, depart)){
EmployeeContainer::employeelist->at(uplace)->id = id;
EmployeeContainer::employeelist->at(uplace)->name = name;
EmployeeContainer::employeelist->at(uplace)->phone = phone;
EmployeeContainer::employeelist->at(uplace)->depart = depart;
this->close();
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xiyang5415/EmployeeManagement-for-Qt.git
[email protected]:xiyang5415/EmployeeManagement-for-Qt.git
xiyang5415
EmployeeManagement-for-Qt
EmployeeManagement-for-Qt
main

搜索帮助