-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bcbdd5b
Showing
30 changed files
with
5,797 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#------------------------------------------------- | ||
# | ||
# Project created by QtCreator 2023-02-06T22:12:32 | ||
# | ||
#------------------------------------------------- | ||
|
||
QT += core gui sql | ||
|
||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets | ||
|
||
TARGET = Perject16 | ||
TEMPLATE = app | ||
|
||
# The following define makes your compiler emit warnings if you use | ||
# any feature of Qt which has been marked as deprecated (the exact warnings | ||
# depend on your compiler). Please consult the documentation of the | ||
# deprecated API in order to know how to port your code away from it. | ||
DEFINES += QT_DEPRECATED_WARNINGS | ||
|
||
# You can also make your code fail to compile if you use deprecated APIs. | ||
# In order to do so, uncomment the following line. | ||
# You can also select to disable deprecated APIs only up to a certain version of Qt. | ||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 | ||
|
||
|
||
SOURCES += \ | ||
main.cpp \ | ||
widget.cpp \ | ||
daoda.cpp \ | ||
kaiguan.cpp \ | ||
chufa.cpp \ | ||
chupiao.cpp \ | ||
chepiaoxinxi.cpp \ | ||
chepiaoxinxijihe.cpp \ | ||
showtic.cpp \ | ||
xuanze.cpp \ | ||
massage.cpp \ | ||
formrengong.cpp \ | ||
num_tic.cpp | ||
|
||
HEADERS += \ | ||
widget.h \ | ||
daoda.h \ | ||
kaiguan.h \ | ||
chufa.h \ | ||
chupiao.h \ | ||
chepiaoxinxi.h \ | ||
chepiaoxinxijihe.h \ | ||
showtic.h \ | ||
xuanze.h \ | ||
massage.h \ | ||
formrengong.h \ | ||
num_tic.h | ||
|
||
FORMS += \ | ||
widget.ui \ | ||
formrengong.ui |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "chepiaoxinxi.h" | ||
|
||
ChePiaoXinXi::ChePiaoXinXi() | ||
{ | ||
|
||
} | ||
ChePiaoXinXi::ChePiaoXinXi(int id1,QString start_name1,QString end_name1,int money1,int chepiaozhuangtai1){ | ||
id=id1; | ||
start_name=start_name1; | ||
end_name=end_name1; | ||
money=money1; | ||
chepiaozhuangtai=chepiaozhuangtai1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef CHEPIAOXINXI_H | ||
#define CHEPIAOXINXI_H | ||
#include <QString> | ||
|
||
class ChePiaoXinXi | ||
{ | ||
public: | ||
int id;//车票id | ||
QString start_name;//车票出发站名称 | ||
QString end_name;//车票到达站名称 | ||
int money;//车票价格 | ||
int chepiaozhuangtai;//车票状态,0表示新购的车票,1表示已经进站,2表示已经出站 | ||
ChePiaoXinXi(); | ||
ChePiaoXinXi(int id1,QString start_name1,QString end_name1,int money1,int chepiaozhuangtai1); | ||
}; | ||
|
||
#endif // CHEPIAOXINXI_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "chepiaoxinxijihe.h" | ||
|
||
ChePiaoXinXiJiHe::ChePiaoXinXiJiHe() | ||
{ | ||
|
||
} | ||
QList<ChePiaoXinXi> ChePiaoXinXiJiHe::list_set={}; | ||
int ChePiaoXinXiJiHe::add_list(int id1,QString start_name1,QString end_name1,int money1,int chepiaozhuangtai1){ | ||
if(list_set.count()==0){//当前集合中所有元素的个数 | ||
id1 = 0; | ||
ChePiaoXinXi cp(id1,start_name1,end_name1,money1,chepiaozhuangtai1); | ||
|
||
list_set.append(cp);//向数组中添加新的元素 | ||
return cp.id; | ||
} | ||
else{ | ||
ChePiaoXinXi cp = list_set.last(); | ||
id1 = cp.id+1; | ||
ChePiaoXinXi cp1(id1,start_name1,end_name1,money1,chepiaozhuangtai1); | ||
|
||
list_set.append(cp1);//向数组中添加新的元素 | ||
return cp1.id; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef CHEPIAOXINXIJIHE_H | ||
#define CHEPIAOXINXIJIHE_H | ||
#include <QList> | ||
#include <QString> | ||
#include "chepiaoxinxi.h" | ||
|
||
class ChePiaoXinXiJiHe | ||
{ | ||
public: | ||
static QList<ChePiaoXinXi> list_set; | ||
ChePiaoXinXiJiHe(); | ||
|
||
static int add_list(int id1,QString start_name1,QString end_name1,int money1,int chepiaozhuangtai1); | ||
}; | ||
|
||
#endif // CHEPIAOXINXIJIHE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "chufa.h" | ||
#include <QFont> | ||
ChuFa::ChuFa(QWidget *parent) : QWidget(parent) | ||
{ | ||
label.setParent(this);//设置标签的父窗口 | ||
label.setText("您确定从此站出发?");//设置标签的文本 | ||
QFont ft;//定义字体对象 | ||
ft.setPointSize(20);//设置字体大小为20号 | ||
label.setFont(ft);//设置标签的字体为ft | ||
label.move(80,80);//设置标签的位置 | ||
label.resize(380,60); | ||
|
||
button_ok.setParent(this);//设置确定按钮父窗口 | ||
button_ok.setText("确定");//设置确定按钮文本 | ||
button_ok.move(80,200);//设置确定按钮位置 | ||
button_can.setParent(this); | ||
button_can.setText("取消"); | ||
button_can.move(280,200); | ||
connect(&button_can,&QPushButton::clicked,this,&ChuFa::button_can_clicked); | ||
connect(&button_ok,&QPushButton::clicked,this,&ChuFa::button_ok_clicked); | ||
|
||
} | ||
void ChuFa::button_can_clicked(){ | ||
KaiGuan::cf=0; | ||
KaiGuan::dd=0; | ||
this->close(); | ||
|
||
} | ||
void ChuFa::button_ok_clicked(){ | ||
KaiGuan::cf=1; | ||
KaiGuan::dd=0; | ||
this->close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef CHUFA_H | ||
#define CHUFA_H | ||
|
||
#include <QWidget> | ||
#include <QLabel> | ||
#include <QPushButton> | ||
#include "kaiguan.h" | ||
class ChuFa : public QWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit ChuFa(QWidget *parent = nullptr); | ||
QLabel label; | ||
QPushButton button_ok; | ||
QPushButton button_can; | ||
void button_can_clicked();//button_can按钮的槽函数 | ||
void button_ok_clicked();//button_ok按钮的槽函数 | ||
|
||
signals: | ||
|
||
public slots: | ||
}; | ||
|
||
#endif // CHUFA_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#include "chupiao.h" | ||
|
||
ChuPiao::ChuPiao(QWidget *parent) : QWidget(parent) | ||
{ | ||
// label.setParent(this);//设置标签的父窗口 | ||
// QFont ft;//定义字体对象 | ||
// ft.setPointSize(16);//设置字体大小为20号 | ||
// label.setFont(ft);//设置标签的字体为ft | ||
// label.move(60,80);//设置标签的位置 | ||
// label.resize(500,60); | ||
|
||
label.setParent(this);//设置标签的父窗口 | ||
label.setText("您确定从此站出发?");//设置标签的文本 | ||
QFont ft;//定义字体对象 | ||
ft.setPointSize(16);//设置字体大小为20号 | ||
label.setFont(ft);//设置标签的字体为ft | ||
label.move(80,80);//设置标签的位置 | ||
label.resize(760,60); | ||
|
||
button_ok.setParent(this);//设置确定按钮父窗口 | ||
button_ok.setText("确定");//设置确定按钮文本 | ||
button_ok.move(200,200);//设置确定按钮位置 | ||
button_can.setParent(this); | ||
button_can.setText("取消"); | ||
button_can.move(580,200); | ||
connect(&button_ok,&QPushButton::clicked,this,&ChuPiao::button_ok_clicked); | ||
connect(&button_can,&QPushButton::clicked,this,&ChuPiao::button_can_clicked); | ||
} | ||
void ChuPiao::button_ok_clicked(){ | ||
number.setFixedSize(480,300); | ||
number.show(); | ||
this->close(); | ||
// int id1=0; | ||
// QString start_name1=KaiGuan::name[KaiGuan::start]; | ||
// QString end_name1=KaiGuan::name[KaiGuan::end]; | ||
// int moeny1 = 2; | ||
// int chepiaozhuangtai1 = 0; | ||
// KaiGuan::new_id= ChePiaoXinXiJiHe::add_list(id1,start_name1,end_name1,moeny1,chepiaozhuangtai1); | ||
// ChePiaoXinXi cp = ChePiaoXinXiJiHe::list_set.last(); | ||
// QString str = QString("车票id:%1 出发站:%2 -> 到达站:%3").arg(cp.id).arg(cp.start_name).arg(cp.end_name); | ||
// tic_info.imformation.setText(str); | ||
// tic_info.setFixedSize(700,200); | ||
// tic_info.show(); | ||
|
||
|
||
// QDate date=QDate::currentDate(); | ||
// QString str2=date.toString("yyyy-MM-dd"); | ||
// QTime time=QTime::currentTime(); | ||
// QString str1=time.toString("hh:mm:ss"); | ||
// qDebug()<<QSqlDatabase::drivers(); | ||
// QSqlDatabase db=QSqlDatabase::addDatabase("QMYSQL"); | ||
// db.setHostName("127.0.0.1");//数据库主机ip | ||
// db.setUserName("root");//数据库用户名 | ||
// db.setPassword("duanyuhang518.");//数据库密码 | ||
// db.setDatabaseName("ditie");//数据库名字 | ||
// if(db.open()==false){ | ||
// QMessageBox::warning(this,"waring",db.lastError().text()); | ||
// } | ||
// QSqlQuery query; | ||
// query.prepare("insert into chepiao (id,date,time,start_name,end_name,money,zhuangtai) values (:id,:date,:time,:start_name,:end_name,:money,:zhuangtai)"); | ||
// QVariantList idList; | ||
// idList << ChePiaoXinXiJiHe::list_set.last().id; | ||
// query.bindValue(":id",idList); | ||
// //日期 | ||
// QVariantList dateList; | ||
// dateList << str2; | ||
// query.bindValue(":date",dateList); | ||
// //时间 | ||
// QVariantList timeList; | ||
// timeList << str1; | ||
// query.bindValue(":time",timeList); | ||
// //出发地 | ||
// QVariantList start_name; | ||
// start_name << ChePiaoXinXiJiHe::list_set.last().start_name; | ||
// query.bindValue(":start_name",start_name); | ||
// //到达地 | ||
// QVariantList end_name; | ||
// end_name << ChePiaoXinXiJiHe::list_set.last().end_name; | ||
// query.bindValue(":end_name",end_name); | ||
// //票价 | ||
// QVariantList money; | ||
// money << ChePiaoXinXiJiHe::list_set.last().money; | ||
// query.bindValue(":money",money); | ||
// //状态 | ||
// QVariantList zhuangtai; | ||
// zhuangtai << ChePiaoXinXiJiHe::list_set.last().chepiaozhuangtai; | ||
// query.bindValue(":zhuangtai",zhuangtai); | ||
// query.execBatch(); | ||
|
||
} | ||
void ChuPiao::button_can_clicked(){ | ||
KaiGuan::cf=0; | ||
KaiGuan::dd=0; | ||
this->close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef CHUPIAO_H | ||
#define CHUPIAO_H | ||
#include <QList> | ||
//数组 字节数组头文件 | ||
#include <QByteArray> | ||
#include <QString> | ||
#include <QDebug> | ||
//时间头文件 小时 分 秒 | ||
#include <QTime> | ||
//日期头文件 年 月 日 | ||
#include <QDate> | ||
//数据库头文件 | ||
#include <QSqlDatabase> | ||
//弹出消息框头文件 | ||
#include <QMessageBox> | ||
//数据库错误处理头文件 | ||
#include <QSqlError> | ||
//数据库查询头文件 | ||
#include <QSqlQuery> | ||
//数据的参数绑定头文件 | ||
#include <QVariantList> | ||
#include <QWidget> | ||
#include <QLabel> | ||
#include <QPushButton> | ||
#include "kaiguan.h" | ||
#include "chepiaoxinxi.h" | ||
#include "chepiaoxinxijihe.h" | ||
#include <QString> | ||
#include "num_tic.h" | ||
class ChuPiao : public QWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit ChuPiao(QWidget *parent = nullptr); | ||
QLabel label; | ||
QPushButton button_ok; | ||
QPushButton button_can; | ||
void button_can_clicked();//button_can按钮的槽函数 | ||
void button_ok_clicked();//button_ok按钮的槽函数 | ||
|
||
Num_Tic number; | ||
signals: | ||
|
||
public slots: | ||
}; | ||
|
||
#endif // CHUPIAO_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include "daoda.h" | ||
#include <QString> | ||
DaoDa::DaoDa(QWidget *parent) : QWidget(parent) | ||
{ | ||
label.setParent(this);//设置标签的父窗口 | ||
label.setText("您确定到达此站吗?");//设置标签的文本 | ||
QFont ft;//定义字体对象 | ||
ft.setPointSize(20);//设置字体大小为20号 | ||
label.setFont(ft);//设置标签的字体为ft | ||
label.move(80,80);//设置标签的位置 | ||
label.resize(760,60); | ||
button_ok.setParent(this);//设置确定按钮父窗口 | ||
button_ok.setText("确定");//设置确定按钮文本 | ||
button_ok.move(80,200);//设置确定按钮位置 | ||
button_can.setParent(this); | ||
button_can.setText("取消"); | ||
button_can.move(280,200); | ||
connect(&button_can,&QPushButton::clicked,this,&DaoDa::button_can_clicked); | ||
connect(&button_ok,&QPushButton::clicked,this,&DaoDa::button_ok_clicked); | ||
} | ||
void DaoDa::button_can_clicked(){ | ||
KaiGuan::cf=0; | ||
KaiGuan::dd=0; | ||
KaiGuan::chioce = 0; | ||
|
||
this->close(); | ||
} | ||
void DaoDa::button_ok_clicked(){ | ||
KaiGuan::cf=0; | ||
KaiGuan::dd=1; | ||
KaiGuan::chioce = 0; | ||
|
||
QString str = "确认,出发站:" + KaiGuan::name[KaiGuan::start]+"->到达站:" + KaiGuan::name[KaiGuan::end]; | ||
chupiao.label.setText(str); | ||
chupiao.setFixedSize(960,300); | ||
chupiao.show(); | ||
this->close(); | ||
} |
Oops, something went wrong.