diff --git a/customer.cpp b/customer.cpp index 5acfb50..7e42d54 100644 --- a/customer.cpp +++ b/customer.cpp @@ -1,8 +1,5 @@ #include "customer.h" -#include "login.h" -#include "registers.h" #include "ui_customer.h" - /* * ID从数据库的提取 */ @@ -29,13 +26,12 @@ void customer::paintEvent(QPaintEvent*) void customer::init()//初始化 { - customer_id = "123"; + id = "123"; + //id = login->ui->lineEdit_account->text();崩溃 ui->setupUi(this); this->setFixedSize(1920,1080); this->setWindowTitle("用户界面"); this->setWindowIcon(QIcon(":image/icon/logo"));//创造本界面 - lg = new login(this); - lg->hide(); rm = new ResetMessage(this); rm->hide();//创造副界面 labelone = new QLabel(this); @@ -46,9 +42,14 @@ void customer::init()//初始化 findall(); flush_data(userinfo);//初始显示全部 setmousehand();//装饰鼠标 + ui->tableWidget->horizontalHeader()->setStyleSheet("QHeaderView::section{background-color: rgb(0, 0, 0,30);}");//表头透明度 + ui->tableWidget->verticalHeader()->setStyleSheet("QHeaderView::section{background-color: rgb(0, 0, 0,30);}");//行头透明度 + - ui->Reservation1->setEnabled(false); - ui->checking_out1->setEnabled(false);//初始退订按钮 + ui->tableWidget->setColumnHidden(5, true);//隐藏列 + ui->tableWidget->setColumnHidden(6, true); + ui->Reservation1->setEnabled(false);//初始退订按钮 + ui->checking_out1->setEnabled(false); ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);//表格不可编辑 } @@ -65,7 +66,7 @@ void customer::setmousehand()//鼠标小手 完成 void customer::on_checking_out1_clicked()//退房 完成 { int c = row;//总之是获取选中的行 - if( ui->tableWidget->model()->index(c,6).data().toString() == "123" ){ + if( ui->tableWidget->model()->index(c,6).data().toString() == id ){ QString QS = "空闲"; QSqlQuery query((db)); @@ -101,7 +102,7 @@ void customer::on_checking_out1_clicked()//退房 完成 } -void customer::on_Reservation1_clicked()//订房 id是什么 +void customer::on_Reservation1_clicked()//订房 完成 { int c = row;//总之是获取选中的行 QString QS = "使用"; @@ -121,7 +122,7 @@ void customer::on_Reservation1_clicked()//订房 id是什么 query.bindValue(":num",num); query.exec(); query.prepare("UPDATE room set customer_id=:id where room_num = :num"); - query.bindValue(":id",123); + query.bindValue(":id",id); query.bindValue(":num",num); query.exec(); @@ -160,14 +161,6 @@ void customer::on_checkBox_2_clicked(bool checked)//装饰品 else ui->tableWidget->verticalHeader()->hide(); } -void customer::on_checkBox_3_clicked(bool checked)//装饰品 -{ - if(checked){ - ui->tableWidget->setAlternatingRowColors(true); - } - else ui->tableWidget->setAlternatingRowColors(false); -} - void customer::findall()//显示全部 完成 { userinfo.clear();//清楚存储向量rec的向量的数据 @@ -193,7 +186,7 @@ void customer::flush_data(QVector>&userinfo)//插入数据 完 ui->tableWidget->clear(); if(!userinfo.size())return; ui->tableWidget->setRowCount(userinfo.size());//行 - ui->tableWidget->setColumnCount(5);//列 + ui->tableWidget->setColumnCount(7);//列 for(int i=0;i>&userinfo)//插入数据 完 QW->setTextAlignment(Qt::AlignCenter);//设置中心对齐 } } - ui->tableWidget->setHorizontalHeaderLabels({"房间号","房间类型","是否带窗","负责人","状态"});//设置表头 + //ui->tableWidget->setHorizontalHeaderLabels({"房间号","房间类型","是否带窗","负责人","状态"});//设置表头 } void customer::on_tableWidget_itemClicked(QTableWidgetItem *item)//点击表格格子 获取行数 完成 @@ -245,9 +238,9 @@ bool customer::find_byname(QString n)//搜索? int number = n.toInt(); userinfo.clear(); QSqlQuery query(db); - query.prepare("select * from room where room_num like :number;");//以开头搜索 不行 - query.bindValue(":number",number); - if(query.exec()) + query.prepare("select * from room where room_num like :number;");//以开头搜索 不行 + query.bindValue(":number",number); + if(query.exec()) { while (query.next()) { QVectorrec; diff --git a/customer.h b/customer.h index 82f9d80..5a0f9b7 100644 --- a/customer.h +++ b/customer.h @@ -10,6 +10,7 @@ #include #include #include +#include namespace Ui { class customer; @@ -27,7 +28,7 @@ public: void flush_data(QVector>&userinfo); bool find_byname(QString name); void setmousehand(); - QString customer_id; + void init(); private slots: @@ -41,10 +42,6 @@ private slots: void on_checkBox_2_clicked(bool checked); - void on_checkBox_3_clicked(bool checked); - - - void on_tableWidget_itemClicked(QTableWidgetItem *item); void on_search_clicked(); @@ -55,11 +52,11 @@ protected: private: Ui::customer *ui; QLabel *labelone; - login *lg; ResetMessage *rm; QSqlDatabase db; QVector>userinfo; int row; + login *login; QString id; }; diff --git a/customer.ui b/customer.ui index 836f534..747b144 100644 --- a/customer.ui +++ b/customer.ui @@ -114,6 +114,9 @@ 25 + + color:rgb(255, 255, 255) + 房间检索-> @@ -124,12 +127,51 @@ - 150 - 300 - 1471 - 671 + 120 + 290 + 1531 + 731 + + + 12 + + + + background-color: rgb(0, 0, 0,50); + +color: rgb(255, 255, 255); + + + + + + + + 房间号 + + + + + 房间类型 + + + + + 是否带窗 + + + + + 负责人 + + + + + 状态 + + @@ -145,6 +187,10 @@ 22 + + background-color: rgb(108, 162, 162); +color: rgb(255, 255, 255); + 搜索 @@ -165,13 +211,14 @@ image:url(:/image/icon/resetcode.png); -backgroundcolor:rgb(255, 255, 255) +background-color: rgb(108, 162, 162); + - + 1760 diff --git a/res.qrc b/res.qrc index 23bb692..7d90621 100644 --- a/res.qrc +++ b/res.qrc @@ -2,6 +2,8 @@ login.png customerbackground.webp + sea.jpg + stone.jpg info.png diff --git a/resetmessage.cpp b/resetmessage.cpp index a11b4b3..e2d365d 100644 --- a/resetmessage.cpp +++ b/resetmessage.cpp @@ -12,10 +12,16 @@ ResetMessage::ResetMessage(QWidget *parent) : this->setWindowIcon(logo); setWindowTitle("宜客酒店"); this->setFixedSize(800,600); + /* bg = new QLabel(this); bg->setScaledContents(true); - bg->setPixmap(QPixmap(":/image/bg/customerbackground.webp"));//未完 + bg->setPixmap(QPixmap(":/image/bg/sea.jpg"));//未完 bg->lower(); + */ + QPalette q;//调色板 + q.setBrush(QPalette::Window,QBrush(QPixmap("/image/bg/sea,jpg"))); + this->setPalette(q); + ui->code->setEchoMode(QLineEdit::Password); ui->confirm_code->setEchoMode(QLineEdit::Password); ui->radioButton_man->setChecked(1); @@ -40,7 +46,7 @@ ResetMessage::~ResetMessage() void ResetMessage::paintEvent(QPaintEvent*) { - // bg->resize(ui->ResetMessage->size()); + //bg->resize(ui->ResetMessage->size()); } bool ResetMessage::verify(int x){ diff --git a/resetmessage.ui b/resetmessage.ui index 58ea887..b741bd6 100644 --- a/resetmessage.ui +++ b/resetmessage.ui @@ -6,13 +6,16 @@ 0 0 - 812 - 653 + 800 + 600 Dialog + + + @@ -27,6 +30,9 @@ 12 + + color: rgb(255, 255, 127); + 密码 @@ -48,6 +54,9 @@ 12 + + color: rgb(255, 255, 127); + 确认密码 @@ -69,6 +78,9 @@ 12 + + color: rgb(255, 255, 127); + 姓名 @@ -87,6 +99,9 @@ 12 + + color: rgb(255, 255, 127); + 身份证 @@ -145,6 +160,9 @@ 12 + + color: rgb(255, 255, 127); + 性别 @@ -161,8 +179,12 @@ 12 + false + + color: rgb(255, 255, 127); + @@ -181,6 +203,9 @@ 12 + + color: rgb(255, 255, 127); + @@ -199,10 +224,42 @@ 15 + + + 更新 + + false + + + + + + 0 + 0 + 800 + 600 + + + + <html><head/><body><p><img src=":/image/bg/sea.jpg"/></p></body></html> + + label + label_code + label_confirm + label_name + label_id + ID_card + code + confirm_code + name + label_gender + radioButton_man + radioButton_woman + pushButton diff --git a/sea.jpg b/sea.jpg new file mode 100644 index 0000000..9298185 Binary files /dev/null and b/sea.jpg differ diff --git a/stone.jpg b/stone.jpg new file mode 100644 index 0000000..fa1f6de Binary files /dev/null and b/stone.jpg differ