1 Star 0 Fork 4

boarmy/CaseBoxServer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
netperson.cpp 2.54 KB
一键复制 编辑 原始数据 按行查看 历史
#include "netperson.h"
#include "ui_netperson.h"
NetPerson::NetPerson(datebase *db,int ID,QWidget *parent) :
QDialog(parent),
ui(new Ui::NetPerson)
{
ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint);
netPer_db=db;
NetPer_ID=ID;
ui->lineEdit_NetPerM_Pass->setEchoMode(QLineEdit::Password);
ui->lineEdit_NetPerM_Pass_Second->setEchoMode(QLineEdit::Password);
GetNet();
GetNetPersonInfo();
}
NetPerson::~NetPerson()
{
delete ui;
}
void NetPerson::paintEvent(QPaintEvent *)//背景
{
QPixmap pix(":/images/Sback.jpg");
QPainter painter(this);
int w = width();
int h = height();
painter.drawPixmap(0,0,w,h,pix);
}
void NetPerson::on_pushButton_Quit_clicked()
{
this->close();
}
void NetPerson::on_pushButton_OK_clicked()
{
QString address,pass,passSecond,user,flag;
pass=ui->lineEdit_NetPerM_Pass->text().trimmed();
passSecond=ui->lineEdit_NetPerM_Pass_Second->text().trimmed();
if(pass.isEmpty() || passSecond.isEmpty())
{
QMessageBox::information(this,tr("提示"),tr("密码为空"));
return;
}
if(pass != passSecond)
{
QMessageBox::information(this,tr("提示"),tr("密码不一致"));
return ;
}
address=ui->comboBox_NetPerM->currentText().trimmed();
user=ui->lineEdit_NetPerM_User->text().trimmed();
flag=ui->comboBox_NetPerM_Flag->currentText().trimmed();
netPer_db->updateNetPersonInfo(netPer_db->sqlite_db,NetPer_ID,address,user,pass,flag);
this->close();
}
void NetPerson::GetNet()
{
QSqlQuery query(*this->netPer_db->sqlite_db);
QString name;
QStringList strList;
ui->comboBox_NetPerM->clear();
query.exec(tr("select NetName from NetInfo order by Id asc"));
for(int i=0;query.next();i++){
name=query.value(0).toString();
strList<<name;
}
ui->comboBox_NetPerM->addItems(strList);
}
void NetPerson::GetNetPersonInfo()
{
bool res;
QString str,user,address,flag;
str=QString("select Net_Address,User,Flag from NetPerson where Id = '%1'").arg(NetPer_ID);
QSqlQuery query(*this->netPer_db->sqlite_db);
query.clear();
query.exec(str);
res=query.next();
if(res)
{
address=query.value(0).toString();
user=query.value(1).toString();
flag=query.value(2).toString();
int m=ui->comboBox_NetPerM->findText(address);
int n=ui->comboBox_NetPerM_Flag->findText(flag);
ui->comboBox_NetPerM->setCurrentIndex(m);
ui->lineEdit_NetPerM_User->setText(user);
ui->comboBox_NetPerM_Flag->setCurrentIndex(n);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/boarmy/CaseBoxServer.git
git@gitee.com:boarmy/CaseBoxServer.git
boarmy
CaseBoxServer
CaseBoxServer
master

搜索帮助