#include "mainwindow.h"
#include "ui_mainwindow.h"
//手工添加以下引用
#include <QSqlQueryModel>
#include <QSqlQuery>
#include "tms.h"
#include "salary.h"
#include "change.h"
#include "addapparatus.h"
#include "addpotion.h"
#include "addsalary.h"
#include "addchuang.h"
#include "addpersonnel.h"
#include "addpatient.h"
#include "personnelcha.h"
#include "personneldel.h"
#include "personnelupdata.h"
#include "addjob.h"
#include "adddept.h"
#include "logindlg.h"
#include "QDebug"
#include "QSqlError"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);//setupUi(this)是由.ui文件生成的类的构造函数
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
QSqlQueryModel *model = new QSqlQueryModel;
model->setQuery("select * from patient");//这里直接设置SQL语句,忽略最后一个参数
ui->tableView->setModel(model);
//以下是视觉方面的效果,不加也没影响
//隔行变色
ui->tableView->setAlternatingRowColors(true);
//设置行高
int row_count = model->rowCount();
for(int i =0; i < row_count; i++)
{
ui->tableView->setRowHeight(i, 20);
}
}
Dialog::Dialog(QDialog *parent)
:QDialog(parent)
{
wa=new QDialog();
wa->setWindowTitle(tr("Manuel2"));
dialog=new QDialog();
dialog->setWindowTitle(tr("Manuel1"));
}
void Dialog::dialogUse()
{
dialog->show();
}
void Dialog::waUse()
{
wa->show();
}
void Dialog::findClick()
{
}
void Dialog::enableFindButton()
{
}
Dialog::~Dialog() //Dialog类的析构函数里面不知道写什么,就没写,哈哈......
{
}
void MainWindow::on_pushButton_2_clicked()
{
Dialog *dialogLogin=new Dialog;
dialogLogin->dialogUse();
}
void MainWindow::on_pushButton_3_clicked()
{
Dialog *dialogLogin1=new Dialog;
dialogLogin1->waUse();
}
void MainWindow::on_action_triggered()
{
AddPersonnel personnel;
personnel.exec();
}
void MainWindow::on_pushButton_5_clicked()
{
QSqlQueryModel *model = new QSqlQueryModel;
model->setQuery("select * from personnel");//这里直接设置SQL语句,忽略最后一个参数
ui->tableView_2->setModel(model);
//以下是视觉方面的效果,不加也没影响
//隔行变色
ui->tableView_2->setAlternatingRowColors(true);
//设置行高
int row_count = model->rowCount();
for(int i =0; i < row_count; i++)
{
ui->tableView_2->setRowHeight(i, 20);
}
}
void MainWindow::on_pushButton_12_clicked()
{
QSqlQueryModel *model = new QSqlQueryModel;
model->setQuery("select * from chuang");//这里直接设置SQL语句,忽略最后一个参数
ui->tableView_3->setModel(model);
//以下是视觉方面的效果,不加也没影响
//隔行变色
ui->tableView_3->setAlternatingRowColors(true);
//设置行高
int row_count = model->rowCount();
for(int i =0; i < row_count; i++)
{
ui->tableView_3->setRowHeight(i, 20);
}
}
void MainWindow::on_pushButton_14_clicked()
{
QSqlQueryModel *model = new QSqlQueryModel;
model->setQuery("select * from apparatus");//这里直接设置SQL语句,忽略最后一个参数
ui->tableView_4->setModel(model);
//以下是视觉方面的效果,不加也没影响
//隔行变色
ui->tableView_4->setAlternatingRowColors(true);
//设置行高
int row_count = model->rowCount();
for(int i =0; i < row_count; i++)
{
ui->tableView_4->setRowHeight(i, 20);
}
}
void MainWindow::on_pushButton_18_clicked()
{
QSqlQueryModel *model = new QSqlQueryModel;
model->setQuery("select * from potion");//这里直接设置SQL语句,忽略最后一个参数
ui->tableView_5->setModel(model);
//以下是视觉方面的效果,不加也没影响
//隔行变色
ui->tableView_5->setAlternatingRowColors(true);
//设置行高
int row_count = model->rowCount();
for(int i =0; i < row_count; i++)
{
ui->tableView_5->setRowHeight(i, 20);
}
}
void MainWindow::on_pushButton_19_clicked()
{
QSqlQueryModel *model = new QSqlQueryModel;
QString temStr,strSQL="SELECT * FROM potion where ";
temStr=this->ui->comboBox_6->currentText();
strSQL+=temStr+"=";
strSQL+="'"+this->ui->potion_cha->text()+"'";
model->setQuery(strSQL);//这里直接设置SQL语句,忽略最后一个参数
ui->tableView_5->setModel(model);
//以下是视觉方面的效果,不加也没影响
//隔行变色
ui->tableView_5->setAlternatingRowColors(true);
//设置行高
int row_count = model->rowCount();
for(int i =0; i < row_count; i++)
{
ui->tableView_5->setRowHeight(i, 20);
}
}
void MainWindow::on_pushButton_21_clicked()
{
QSqlQueryModel *model = new QSqlQueryModel;
QString temStr,strSQL="delete FROM potion where ";
temStr=this->ui->comboBox_7->currentText();
strSQL+=temStr+"=";
strSQL+="'"+this->ui->potion_del->text()+"'";
model->setQuery(strSQL);//这里直接设置SQL语句,忽略最后一个参数
model->setQuery("select * from potion");//这里直接设置SQL语句,忽略最后一个参数
ui->tableView_5->setModel(model);
//以下是视觉方面的效果,不加也没影响
//隔行变色
ui->tableView_5->setAlternatingRowColors(true);
//设置行高
int row_count = model->rowCount();
for(int i =0; i < row_count; i++)
{
ui->tableView_5->setRowHeight(i, 20);
}
}
void MainWindow::on_pushButton_20_clicked()
{
// QSqlQuery query;
QSqlQueryModel *model = new QSqlQueryModel;
QString temStr,strSQL="update potion set ";
temStr=this->ui->comboBox_8->currentText();
strSQL+=temStr+"=";
strSQL+="'"+this->ui->potion_updata->text().trimmed()+"'";
strSQL+=" where 药剂代号=";
strSQL+=""+this->ui->potion_id->text().trimmed()+"";
// query.exec(QObject::tr("update potion set id=333 where id=5"));
model->setQuery(strSQL);//这里直接设置SQL语句,忽略最后一个参数
model->setQuery("select * from potion");//这里直接设置SQL语句,忽略最后一个参数
ui->tableView_5->setModel(model);
//以下是视觉方面的效果,不加也没影响
//隔行变色
ui->tableView_5->setAlternatingRowColors(true);
//设置行高
int row_count = model->rowCount();
for(int i =0; i < row_count; i++)
{
ui->tableView_5->setRowHeight(i, 20);
}
}
void MainWindow::on_pushButton_15_clicked()
{
QSqlQueryModel *model = new QSqlQueryModel;
QString temStr,strSQL="SELECT * FROM apparatus where ";
temStr=this->ui->comboBox_4->currentText();
strSQL+=temStr+"=";
strSQL+="'"+this->ui->apparatus_cha->text()+"'";
model->setQuery(strSQL);//这里直接设置SQL语句,忽略最后一个参数
ui->tableView_4->setModel(model);
//以下是视觉方面的效果,不加也没影响
//隔行变色
ui->tableView_4->setAlternatingRowColors(true);
//设置行高
int row_count = model->rowCount();
for(int i =0; i < row_count; i++)
{
ui->tableView_4->setRowHeight(i, 20);
}
}
void MainWindow::on_pushButton_17_clicked()
{
// QSqlQuery query;
QSqlQueryModel *model = new QSqlQueryModel;
QString temStr,strSQL="update apparatus set ";
temStr=this->ui->comboBox_9->currentText();
strSQL+=temStr+"=";
strSQL+="'"+this->ui->apparatus_updata->text().trimmed()+"'";
strSQL+=" where 仪器代号=";
strSQL+=""+this->ui->apparatus_id->text().trimmed()+"";
// query.exec(QObject::tr("update potion set id=333 where id=5"));
model->setQuery(strSQL);//这里直接设置SQL语句,忽略最后一个参数
model->setQuery("select * from apparatus");//这里直接设置SQL语句,忽略最后一个参数
ui->tableView_4->setModel(model);


辣椒种子
- 粉丝: 4387
- 资源: 5859
最新资源
- (源码)基于ESP8266的2Smart Sonoff S20设备固件.zip
- (源码)基于C++的SeetaFace2人脸识别引擎.zip
- (源码)基于JavaScript和WildDog框架的游戏排行榜系统.zip
- (源码)基于Arduino框架的自动车灯系统.zip
- (源码)基于C++的C++ Primer Plus第六版学习项目.zip
- (源码)基于ESP32和MicroROS的电机控制系统.zip
- (源码)基于C++的知识点梳理项目.zip
- (源码)基于 Arduino 的雏鸡养殖场自动化套件系统.zip
- 系统集成项目管理工程师-软考资源
- itriton-uniapp-uniapp资源
- (源码)基于GPS和Arduino的七段显示时钟.zip
- (源码)基于STM32F4和FreeRTOS的USB设备开发模板.zip
- (源码)基于Go语言和React框架的游戏信息搜索系统.zip
- Paddle-Lite-深度学习资源
- Pytorch-pytorch资源
- malagu-typescript资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


