jianbin.chang常健彬 ce734d1af1 厂家提供原始代码
2025-07-17 08:39:15 +08:00

83 lines
1.8 KiB
C++
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "addshu.h"
#include "ui_addshu.h"
QString id3;
addshu::addshu(QWidget *parent) :
QWidget(parent),
ui(new Ui::addshu)
{
ui->setupUi(this);
setWindowTitle("æ°å¢žè<EFBFBD>Œå±ž");
this->setFixedSize(423,244);
ui->widget->setFixedHeight(55);
ui->lineEdit->setFixedSize(301,32);
ui->lineEdit_2->setFixedSize(301,32);
ui->pushButton->setFixedSize(76,37);
ui->pushButton_2->setFixedSize(76,37);
this->setWindowFlags(Qt::FramelessWindowHint); // éš<C3A9>è—<C3A8>标题æ ?
this->setFixedSize(437,244);
this->setWindowFlags(Qt::FramelessWindowHint);//È¥³ý´°¿Ú±ß¿ò
setAttribute(Qt::WA_TranslucentBackground);
}
addshu::~addshu()
{
delete ui;
}
void addshu::on_pushButton_clicked()
{
if(!ui->lineEdit->text().isEmpty()&&!ui->lineEdit_2->text().isEmpty()){QString sql=QString("INSERT INTO junshu (id,name,time,ren) VALUES ('%1','%2','%3','%4')")
.arg(ui->lineEdit->text()).arg(ui->lineEdit_2->text()).arg(gettime()).arg(id3);
qDebug()<<sql;
QSqlQuery query;
if(query.exec(sql))
{
qDebug()<<"æ<EFBFBD>å…¥æˆ<EFBFBD>功";
}
}
else{
}
emit xinzeng();
this->close();
}
QString addshu::getname()
{
QString sql=QString("select usersname from users where id='%1'").arg(id3);
qDebug()<<sql;
QSqlQuery query;
if(query.exec(sql))
{
if(query.first()){
QString str1=query.value(0).toString();
qDebug()<<str1;
return str1;
}
}
else
{
qDebug()<<"没查到å<EFBFBD><EFBFBD>å­?";
}
}
QString addshu::gettime()
{
QDateTime dateTime= QDateTime::currentDateTime();//获å<C2B7>系统当å‰<C3A5>的时é—?
QString str = dateTime .toString("yyyy-MM-dd hh:mm:ss");//æ ¼å¼<C3A5>åŒæ—¶é—?
return str;
}
void addshu::on_pushButton_2_clicked()
{
this->close();
emit xinzeng();
}