feat:新增应用场景分类注册页,管理员登陆,页面切换逻辑,消息提示,账号密码正则化限制,注册功能

user_login
wanghaoyu 2 weeks ago
parent 56ce2fe598
commit d45c44a9e7

@ -313,7 +313,7 @@ void GDDCdlg::mouseMoveEvent(QMouseEvent *event) {
qDebug() << "x:" << diff.x() <<"y:" <<diff.y(); qDebug() << "x:" << diff.x() <<"y:" <<diff.y();
m_GDDCCmdDlg->setMoveParm(diff); m_GDDCCmdDlg->setMoveParm(diff);
if(diff.x() > 5 || diff.y() >5)//像素点超过5ptx才算移动否则为跟踪 if(qAbs(diff.x()) > 5 || qAbs(diff.y()) > 5)//像素点超过5ptx才算移动否则为跟踪
{ {
_moveFlag = true; _moveFlag = true;
firstLocation->move((_dragStartPositon - QPoint(firstLocation->width()/2, firstLocation->height()/2)).toPoint()); firstLocation->move((_dragStartPositon - QPoint(firstLocation->width()/2, firstLocation->height()/2)).toPoint());

@ -25,17 +25,18 @@ MyDatabase::MyDatabase()
} }
QList<userData> list; QList<userData> list;
userData u1 = {"wanghaoyu1","123456","yingji"}; userData u1 = {"wanghaoyu1","123456","emergency"};
userData u2 = {"wanghaoyu2","123456","ceshi"}; userData u2 = {"wanghaoyu2","123456","seaRescue"};
userData u3 = {"wanghaoyu3","123456","haha"}; userData u3 = {"wanghaoyu3","1234567","emergency"};
list += {u1,u2,u3}; list += {u1,u2,u3};
multipleInsertData(list); multipleInsertData(list);
userData u4 = {"wanghaoyu4","123456","yingji1"}; userData u4 = {"wanghaoyu4","123456","admin"};
singleInsertData(u4); singleInsertData(u4);
// deleteData("wanghaoyu4"); // deleteData("wanghaoyu4");
// queryDataByUsername("wanghaoyu3"); // queryDataByUsername("wanghaoyu3");
// updateDataByUsername("wanghaoyu3","234567","ceshi"); // userData u5 = {"wanghaoyu8","123456","yingji1"};
// updateDataByUsername(u5,1);
} }
bool MyDatabase::openDb() bool MyDatabase::openDb()
@ -176,18 +177,19 @@ bool MyDatabase::deleteData(const QString &username)
} }
} }
bool MyDatabase::updateDataByUsername(const QString &username, const QString &password, const QString &scene) bool MyDatabase::updateDataByUsername(const userData &data, const int &is_del)
{ {
if(!queryDataByUsername(username))//根据用户名没有查询到数据-不进行更新操作 if(!queryConuntByUsername(data.username))//根据用户名没有查询到数据-不进行更新操作 查询已有数据
{ {
return false; return false;
} }
database.transaction(); database.transaction();
QSqlQuery sqlQuery; QSqlQuery sqlQuery;
sqlQuery.prepare("UPDATE user SET password=? ,scene=?,updated_at=(DATETIME('now', 'localtime')) WHERE username=?"); sqlQuery.prepare("UPDATE user SET password=? ,scene=?, is_del=?, updated_at=(DATETIME('now', 'localtime')) WHERE username=? AND scene != 'admin'");
sqlQuery.addBindValue(password); sqlQuery.addBindValue(data.password);
sqlQuery.addBindValue(scene); sqlQuery.addBindValue(data.scene);
sqlQuery.addBindValue(username); sqlQuery.addBindValue(is_del);
sqlQuery.addBindValue(data.username);
if(!sqlQuery.exec()) if(!sqlQuery.exec())
{ {
qDebug() << "Error: Fail to update data. "<< sqlQuery.lastError(); qDebug() << "Error: Fail to update data. "<< sqlQuery.lastError();
@ -202,10 +204,11 @@ bool MyDatabase::updateDataByUsername(const QString &username, const QString &pa
} }
} }
bool MyDatabase::queryDataByUsername(const QString &username) bool MyDatabase::queryDataByUsername(const QString &username, const int &isDel)
{ {
QSqlQuery sqlQuery; QSqlQuery sqlQuery;
sqlQuery.prepare("SELECT * FROM user WHERE is_del = 0 AND username=?"); sqlQuery.prepare("SELECT * FROM user WHERE is_del = ? AND username=?");
sqlQuery.addBindValue(isDel);
sqlQuery.addBindValue(username); sqlQuery.addBindValue(username);
if(!sqlQuery.exec()) if(!sqlQuery.exec())
{ {
@ -221,10 +224,9 @@ bool MyDatabase::queryDataByUsername(const QString &username)
return false; return false;
} }
sqlQuery.previous(); // sqlQuery.previous();
while(sqlQuery.next()) do{
{
int id = sqlQuery.value("id").toInt(); int id = sqlQuery.value("id").toInt();
_queryUserData.username = sqlQuery.value("username").toString(); _queryUserData.username = sqlQuery.value("username").toString();
_queryUserData.password = sqlQuery.value("password").toString(); _queryUserData.password = sqlQuery.value("password").toString();
@ -232,11 +234,40 @@ bool MyDatabase::queryDataByUsername(const QString &username)
qDebug()<<QString("id:%1 username:%2 password:%3 scene:%4") qDebug()<<QString("id:%1 username:%2 password:%3 scene:%4")
.arg(id).arg(_queryUserData.username).arg(_queryUserData.password).arg(_queryUserData.scene); .arg(id).arg(_queryUserData.username).arg(_queryUserData.password).arg(_queryUserData.scene);
} }while(sqlQuery.next());
return true; return true;
} }
} }
bool MyDatabase::queryConuntByUsername(const QString &username)
{
QSqlQuery checkQuery;
checkQuery.prepare("SELECT COUNT(*) FROM user WHERE username=?");
checkQuery.addBindValue(username);
if (!checkQuery.exec()) {
qDebug() << "Error: Failed to execute count_query." << checkQuery.lastError();
return false;
}
//直接调用 next(),然后取值
if (checkQuery.next()) {
int count = checkQuery.value(0).toInt();
qDebug() << "User count:" << count;
if (count == 0) {
qDebug() << "Error: count = 0 Username does not exist.";
return false;
}
} else {
qDebug() << "Error: Query returned no results.";
return false;
}
return true;
}
userData MyDatabase::getQueryUserData() userData MyDatabase::getQueryUserData()
{ {
return _queryUserData; return _queryUserData;

@ -36,10 +36,13 @@ public:
bool deleteData(const QString &username); bool deleteData(const QString &username);
//修改数据-密码 场景 //修改数据-密码 场景
bool updateDataByUsername(const QString &username, const QString &password, const QString &scene); bool updateDataByUsername(const userData &data, const int &is_del);
//查询数据 //查询数据-isDel用于判断查询的数据是否是已经删除的数据
bool queryDataByUsername(const QString &username); bool queryDataByUsername(const QString &username, const int &isDel);
//查询用户名数据的数量
bool queryConuntByUsername(const QString &username);
//获取查询到的数据 //获取查询到的数据
userData getQueryUserData(); userData getQueryUserData();

@ -3,6 +3,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QRegularExpressionValidator> #include <QRegularExpressionValidator>
#include <QLabel> #include <QLabel>
#include "global.h"
UserLogin::UserLogin(QWidget *parent) UserLogin::UserLogin(QWidget *parent)
: QWidget(parent) : QWidget(parent)
@ -43,32 +44,24 @@ void UserLogin::initControls()
ui->widget_3->setObjectName("widget_3"); // 给 widget_3 设置对象名称 ui->widget_3->setObjectName("widget_3"); // 给 widget_3 设置对象名称
ui->widget_3->setStyleSheet("QWidget#widget_3 {" ui->widget_3->setStyleSheet("QWidget#widget_3 {"
"background-color: #363636;"
// "border-bottom-left-radius: 20px; "
// "border-bottom-right-radius: 20px;"
"}");
ui->stackedWidget_2->setObjectName("stackedWidget_2");
ui->stackedWidget_2->setStyleSheet("QWidget {"
"background-color: #363636;" "background-color: #363636;"
"border-bottom-left-radius: 20px; " "border-bottom-left-radius: 20px; "
"border-bottom-right-radius: 20px;" "border-bottom-right-radius: 20px;"
"margin-left: 0px;"
"margin-right: 0px;"
"}"); "}");
ui->userlineEdit->setStyleSheet("border-radius: 5px;"); ui->userlineEdit->setStyleSheet("border-radius: 5px;");
ui->passwordlineEdit->setStyleSheet("border-radius: 5px;"); ui->passwordlineEdit->setStyleSheet("border-radius: 5px;");
ui->loginButton->setStyleSheet("QPushButton{" ui->loginButton->setStyleSheet(g_okButtonStyle);
"font-family: STHupo;"
"border-radius: 15px;"
"color: white;"
"font-weight: bold;"
"border: none;"
"background-color: #5289C1;"
"font-size: 20px;"
"}"
// 设置按钮悬停时的样式
"QPushButton:hover {"
"background-color: #4078A9;" // 悬停时的背景颜色
"}"
// 设置按钮按下或选中时的渐变背景
"QPushButton::pressed, QPushButton::checked {"
"color: #FFFFFF;" // 字体颜色为白色
"background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, "
"stop:0 #273c75, stop:1 #487eb0);" // 渐变背景
"}");
ui->exitButton->setStyleSheet("QPushButton{" ui->exitButton->setStyleSheet("QPushButton{"
"font-family: STHupo;" "font-family: STHupo;"
@ -112,29 +105,21 @@ void UserLogin::initControls()
"}"); "}");
ui->label->setAlignment(Qt::AlignCenter); ui->label->setAlignment(Qt::AlignCenter);
ui->pushButton->setStyleSheet("QPushButton {" ui->pushButton->setStyleSheet(g_loginButtonStyle);
"border: none;" // 没有边框 ui->pushButton_login->setStyleSheet(g_loginButtonStyle);
"color: white;" // 默认字体颜色为白色 ui->pushButton_register->setStyleSheet(g_loginButtonStyle);
"font-size: 18px;" // 字体大小为 20 ui->label_2->setStyleSheet("font-size: 18px;"
"font-weight: bold;" "color: #CFCFCF;");
"background-color: transparent;" // 背景透明
"font-family: 'STHeiti';"
"}"
// 设置按钮悬停时的样式 //注册页面
"QPushButton:hover {" ui->registerButton->setStyleSheet(g_okButtonStyle);
"color: #5289C1;" // 悬停时字体颜色变为橙色 ui->senceComboBox->addItem("应急场景", QVariant("emergency"));
"}" ui->senceComboBox->addItem("海上救捞", QVariant("seaRescue"));
ui->senceComboBox->setStyleSheet("QComboBox {"
"border-radius: 5px;"/*圆角*/
"}");
// 设置按钮按下时的字体颜色
"QPushButton:pressed {"
"color: #4A7DB0;" // 按下时字体颜色变为绿色
"}"
// 设置按钮选中时的样式
"QPushButton:checked {"
"color: #5289C1;" // 选中时字体颜色变为绿色
"}");
connect(_passwordCheckBox,&QCheckBox::checkStateChanged,this,[this](int state){ connect(_passwordCheckBox,&QCheckBox::checkStateChanged,this,[this](int state){
if(state == Qt::Checked) if(state == Qt::Checked)
@ -153,7 +138,7 @@ bool UserLogin::checkEditFormat(const QString &edit, const QString &origins)
{ {
if(edit.isEmpty()) if(edit.isEmpty())
{ {
QMessageBox::information(NULL, "提示", "输入"+origins+"不能为空!"); showTopMessage("输入"+origins+"不能为空!", LOGINERROR);
return false; return false;
} }
else else
@ -164,13 +149,45 @@ bool UserLogin::checkEditFormat(const QString &edit, const QString &origins)
// 检查输入内容 // 检查输入内容
if (!regExp.match(edit).hasMatch()) if (!regExp.match(edit).hasMatch())
{ {
QMessageBox::information(NULL, "提示", origins +"至少输入 6 个字符,且只能包含大写字母、小写字母、数字和特殊符号!"); showTopMessage(origins +"至少输入 6 个字符,且只能包含大写字母、小写字母、数字和特殊符号!", LOGINERROR);
return false; return false;
} }
} }
return true; return true;
} }
void UserLogin::showTopMessage(QString message, MyNotifyType type)
{
if(g_notifyManager)
{
g_notifyManager->notify(message, "", type, 3000);
}
}
bool UserLogin::queryDataByUsername(const QString &username)
{
if(dataBase.queryDataByUsername(username, 0))
{
_queryUserData = dataBase.getQueryUserData();
if(_queryUserData.password == ui->passwordlineEdit->text())//密码匹配
{
return true;
}
else
{
showTopMessage("密码输入错误!", LOGINERROR);
return false;
}
}
else
{
//用户名不存在
showTopMessage("用户名不存在!", LOGINERROR);
return false;
}
}
void UserLogin::resizeEvent(QResizeEvent *event) void UserLogin::resizeEvent(QResizeEvent *event)
{ {
QWidget::resizeEvent(event); QWidget::resizeEvent(event);
@ -185,35 +202,28 @@ void UserLogin::on_loginButton_clicked()
return; return;
//查询到数据 //查询到数据
if(dataBase.queryDataByUsername(ui->userlineEdit->text())) if(queryDataByUsername(ui->userlineEdit->text()))
{
_queryUserData = dataBase.getQueryUserData();
if(_queryUserData.password == ui->passwordlineEdit->text())//密码匹配
{ {
//判断场景 //判断场景
if(_queryUserData.scene == "yingji") if(_queryUserData.scene == "emergency")
{ {
emit sendSenceData(use_sence::Emergency); emit sendSenceData(use_sence::Emergency);
QMessageBox::information(NULL, "提示", "进入应急场景!"); //QMessageBox::information(NULL, "提示", "进入应急场景!");
showTopMessage("进入应急场景!", LONGINSUCCESS);
} }
else if(_queryUserData.scene == "ceshi") else if(_queryUserData.scene == "seaRescue")
{ {
emit sendSenceData(use_sence::Sea_Rescue); emit sendSenceData(use_sence::Sea_Rescue);
QMessageBox::information(NULL, "提示", "进入测试场景!"); showTopMessage("进入海上救捞场景!", LONGINSUCCESS);
}
} }
else else if(_queryUserData.scene == "admin")
{ {
QMessageBox::information(NULL, "提示", "密码输入错误!"); showTopMessage("进入注册页面!", LONGINSUCCESS);
return; ui->userlineEdit->setText("");
ui->passwordlineEdit->setText("");
ui->stackedWidget_2->setCurrentWidget(ui->page_register);
} }
} }
else
{
//用户名不存在
QMessageBox::information(NULL, "提示", "用户名不存在!");
return;
}
} }
@ -228,3 +238,73 @@ void UserLogin::on_exitButton_clicked()
emit loginDlgClick(click_type::ExitLogin); emit loginDlgClick(click_type::ExitLogin);
} }
void UserLogin::on_pushButton_register_clicked()
{
showTopMessage("请输入管理员账号及密码!", LOGININFORMATION);
if(!checkEditFormat(ui->userlineEdit->text(),"用户名"))
return;
if(!checkEditFormat(ui->passwordlineEdit->text(),"密码"))
return;
//校验管理员账号
if(queryDataByUsername(ui->userlineEdit->text()))
{
//判断场景
if(_queryUserData.scene == "admin")
{
showTopMessage("进入注册页面!", LONGINSUCCESS);
ui->stackedWidget_2->setCurrentWidget(ui->page_register);
ui->userlineEdit->setText("");
ui->passwordlineEdit->setText("");
}
else
{
showTopMessage("请输入管理员账号及密码!", LOGINERROR);
}
}
}
void UserLogin::on_pushButton_login_clicked()
{
ui->stackedWidget_2->setCurrentWidget(ui->page_login);
}
void UserLogin::on_registerButton_clicked()
{
if(!checkEditFormat(ui->userlineEdit->text(),"用户名"))
return;
if(!checkEditFormat(ui->passwordlineEdit->text(),"密码"))
return;
//查询用户名,用户名不存在方可注册 注意 注册的时候需要查询是否是被删掉的数据
//先查询是否是数据库中已经删除的数据
if(dataBase.queryDataByUsername(ui->userlineEdit->text(),1))
{
QVariant currentSenceData = ui->senceComboBox->currentData();//获取当前下拉列表数据
userData registerUser = {ui->userlineEdit->text(),ui->passwordlineEdit->text(),currentSenceData.toString()};
if(dataBase.updateDataByUsername(registerUser, 0))
{
showTopMessage("注册成功!", LONGINSUCCESS);
return;
}
}
if(!dataBase.queryDataByUsername(ui->userlineEdit->text(),0))
{
QVariant currentSenceData = ui->senceComboBox->currentData();//获取当前下拉列表数据
userData registerUser = {ui->userlineEdit->text(),ui->passwordlineEdit->text(),currentSenceData.toString()};
if(dataBase.singleInsertData(registerUser))
{
showTopMessage("注册成功!", LONGINSUCCESS);
}
}
else
{
showTopMessage("用户名已存在,请换一个!", LOGINERROR);
}
}

@ -21,6 +21,7 @@ public:
{ {
Emergency = 1, //应急 1 Emergency = 1, //应急 1
Sea_Rescue, //海上救捞 2 Sea_Rescue, //海上救捞 2
AdminUser, //管理员用户
}; };
enum click_type : unsigned char enum click_type : unsigned char
@ -29,6 +30,12 @@ public:
ExitLogin, //退出登录 ExitLogin, //退出登录
}; };
enum MyNotifyType : unsigned char
{ LOGININFORMATION = 0,
LONGINSUCCESS = 1,
LOGINERROR = 2,
LOGINWARNING = 3,
};
private slots: private slots:
void on_loginButton_clicked(); void on_loginButton_clicked();
@ -36,20 +43,74 @@ private slots:
void on_exitButton_clicked(); void on_exitButton_clicked();
void on_pushButton_register_clicked();
void on_pushButton_login_clicked();
void on_registerButton_clicked();
private: private:
Ui::UserLogin *ui; Ui::UserLogin *ui;
MyDatabase dataBase; MyDatabase dataBase;
void initLineEdit(); void initLineEdit();
void initControls(); void initControls();
bool checkEditFormat(const QString &edit, const QString &origins); bool checkEditFormat(const QString &edit, const QString &origins);
void showTopMessage(QString message, MyNotifyType type);
userData _queryUserData; userData _queryUserData;
QCheckBox *_passwordCheckBox; QCheckBox *_passwordCheckBox;
signals: signals:
void sendSenceData(use_sence sence); void sendSenceData(use_sence sence);
void loginDlgClick(int clickType); void loginDlgClick(int clickType);
public:
bool queryDataByUsername(const QString &username);
protected: protected:
void resizeEvent(QResizeEvent *event) override; void resizeEvent(QResizeEvent *event) override;
}; };
const QString g_loginButtonStyle = "QPushButton {"
"border: none;" // 没有边框
"color: #CFCFCF;" // 默认字体颜色为白色
"font-size: 18px;" // 字体大小为 20
"font-weight: bold;"
"background-color: transparent;" // 背景透明
"font-family: 'STHeiti';"
"}"
// 设置按钮悬停时的样式
"QPushButton:hover {"
"color: #5289C1;" // 悬停时字体颜色变为橙色
"}"
// 设置按钮按下时的字体颜色
"QPushButton:pressed {"
"color: #4A7DB0;" // 按下时字体颜色变为绿色
"}"
// 设置按钮选中时的样式
"QPushButton:checked {"
"color: #5289C1;" // 选中时字体颜色变为绿色
"}";
const QString g_okButtonStyle = "QPushButton{"
"font-family: STHupo;"
"border-radius: 15px;"
"color: white;"
"font-weight: bold;"
"border: none;"
"background-color: #5289C1;"
"font-size: 20px;"
"}"
// 设置按钮悬停时的样式
"QPushButton:hover {"
"background-color: #4078A9;" // 悬停时的背景颜色
"}"
// 设置按钮按下或选中时的渐变背景
"QPushButton::pressed, QPushButton::checked {"
"color: #FFFFFF;" // 字体颜色为白色
"background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, "
"stop:0 #273c75, stop:1 #487eb0);" // 渐变背景
"}";
#endif // USERLOGIN_H #endif // USERLOGIN_H

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1288</width> <width>1288</width>
<height>826</height> <height>869</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -27,105 +27,7 @@
</property> </property>
<widget class="QWidget" name="page"> <widget class="QWidget" name="page">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="3">
<widget class="QWidget" name="widget" native="true">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="1">
<widget class="QPushButton" name="pushButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>主页</string>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="2" column="1"> <item row="2" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>130</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QWidget" name="widget_l" native="true"> <widget class="QWidget" name="widget_l" native="true">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing"> <property name="spacing">
@ -228,6 +130,21 @@
<item> <item>
<widget class="QWidget" name="widget_3" native="true"> <widget class="QWidget" name="widget_3" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<spacer name="verticalSpacer_4"> <spacer name="verticalSpacer_4">
<property name="orientation"> <property name="orientation">
@ -344,13 +261,13 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>400</width> <width>400</width>
<height>39</height> <height>40</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>480</width> <width>480</width>
<height>40</height> <height>50</height>
</size> </size>
</property> </property>
<property name="echoMode"> <property name="echoMode">
@ -395,6 +312,19 @@
</property> </property>
</spacer> </spacer>
</item> </item>
</layout>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget_2">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page_login">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing"> <property name="spacing">
@ -410,7 +340,7 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>11</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@ -445,7 +375,7 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>11</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@ -454,7 +384,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<spacer name="verticalSpacer_6"> <spacer name="verticalSpacer_7">
<property name="orientation"> <property name="orientation">
<enum>Qt::Orientation::Vertical</enum> <enum>Qt::Orientation::Vertical</enum>
</property> </property>
@ -484,7 +414,7 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>11</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@ -517,9 +447,158 @@
<property name="sizeType"> <property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum> <enum>QSizePolicy::Policy::Fixed</enum>
</property> </property>
<property name="sizeHint" stdset="0">
<size>
<width>11</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_register">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="spacing">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_18">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>11</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="senceComboBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_19">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>11</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="spacing">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_16">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>11</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="registerButton">
<property name="minimumSize">
<size>
<width>200</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>480</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>注册</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>11</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@ -545,11 +624,46 @@
</item> </item>
</layout> </layout>
</widget> </widget>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_4" native="true">
<layout class="QVBoxLayout" name="verticalLayout_5"/>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="4" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>130</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Orientation::Horizontal</enum> <enum>Qt::Orientation::Horizontal</enum>
@ -562,6 +676,127 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="0" colspan="3">
<widget class="QWidget" name="widget" native="true">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="8">
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>主页</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="pushButton_login">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>登录</string>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="7">
<widget class="QPushButton" name="pushButton_register">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>注册</string>
</property>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="6">
<widget class="QLabel" name="label_2">
<property name="text">
<string>|</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>

@ -369,13 +369,13 @@ void MainWindow::getUserSence(UserLogin::use_sence sence)
{ {
case UserLogin::Emergency: case UserLogin::Emergency:
{ {
QMessageBox::information(NULL, "提示", "进入switch emergency"); // QMessageBox::information(NULL, "提示", "进入switch emergency");
emergencySceneShow(); emergencySceneShow();
break; break;
} }
case UserLogin::Sea_Rescue: case UserLogin::Sea_Rescue:
{ {
QMessageBox::information(NULL, "提示", "进入switch Sea_Rescue!"); // QMessageBox::information(NULL, "提示", "进入switch Sea_Rescue!");
seaRescueSceneShow(); seaRescueSceneShow();
break; break;
} }

Loading…
Cancel
Save