-
Notifications
You must be signed in to change notification settings - Fork 2
/
modifydeptmsgwidget.cpp
44 lines (38 loc) · 1.14 KB
/
modifydeptmsgwidget.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "modifydeptmsgwidget.h"
#include "ui_modifydeptmsgwidget.h"
ModifyDeptMsgWidget::ModifyDeptMsgWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::ModifyDeptMsgWidget)
{
ui->setupUi(this);
connect(this,SIGNAL(updateSignals()),this,SLOT(updateMsg()));
}
ModifyDeptMsgWidget::~ModifyDeptMsgWidget()
{
delete ui;
}
void ModifyDeptMsgWidget::getCurrentDept(QString name_,QString info_){
this->name=name_;
this->info=info_;
emit updateSignals();
}
void ModifyDeptMsgWidget::updateMsg(){
this->setWindowTitle("修改院系“"+name+"”的信息");
ui->textEdit->setText(info);
}
void ModifyDeptMsgWidget::on_ConfirmButton_clicked()
{
QString newInfo=ui->textEdit->toPlainText();
QSqlQuery query;
query.exec("update Dept set Dintro='"+newInfo+"' where Dname='"+name+"'");
if(query.lastError().type()==QSqlError::NoError){
QMessageBox::information(this,"更新院系信息","院系信息更新成功!");
this->close();
}else{
QMessageBox::warning(this,"错误",query.lastError().text());
}
}
void ModifyDeptMsgWidget::on_QuitButton_clicked()
{
this->close();
}