未验证 提交 ebc51440 编写于 作者: 梦醒贰零壹柒's avatar 梦醒贰零壹柒 提交者: GitHub

Merge pull request #45 from mengxing2017/40-reconstruct-login-ui

40 reconstruct login UI
......@@ -2,6 +2,7 @@
#include <QDir>
#include <QFile>
#include <QStandardPaths>
#include <QTextCodec>
#include <QtDebug>
#include "mainwindow.h"
......@@ -9,6 +10,10 @@
#include "slot/login_slot.h"
int main(int argc, char *argv[]) {
QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf8"));
QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf8"));
QApplication a(argc, argv);
InitDbService *initDb = new InitDbService();
......
......@@ -6,7 +6,6 @@ LoginSlot::LoginSlot() {
connect(ui->loginBt, SIGNAL(clicked()), this, SLOT(loginClicked()));
connect(ui->quitBt, SIGNAL(clicked()), this, SLOT(closeClicked()));
connect(ui->closeBt, SIGNAL(clicked()), this, SLOT(closeClicked()));
}
void LoginSlot::show() { ui->exec(); }
......
......@@ -8,93 +8,80 @@ LoginDlgUi::LoginDlgUi(QWidget *parent) : QDialog(parent) {
this->setWindowTitle("登录窗口");
//登录框大小
this->resize(420, 320);
//调色板
QPalette LoginPal(this->palette());
//设置背景图片
LoginPal.setBrush(QPalette::Window,
QBrush(QPixmap(":/icon/res/images/login_background.jpeg")));
this->setAutoFillBackground(true);
this->setPalette(LoginPal);
this->resize(1000, 480);
this->setWindowFlags(Qt::FramelessWindowHint);
// 顶部
top = new QWidget(this);
top->setObjectName(QStringLiteral("layoutWidget_top"));
top->setGeometry(QRect(0, 0, 420, 180));
// 底部
bottom = new QWidget(this);
bottom->setObjectName(QStringLiteral("layoutWidget_bottom"));
bottom->setGeometry(QRect(120, 210, 180, 90));
// 垂直布局盒子
vLayout = new QVBoxLayout(bottom);
vLayout->setObjectName(QStringLiteral("verticalLayout"));
vLayout->setContentsMargins(0, 0, 0, 0);
// 网格布局
gridLayout = new QGridLayout();
gridLayout->setObjectName(QStringLiteral("gridLayout"));
left = new QWidget(this);
left->setGeometry(QRect(0, 0, 480, 480));
left->setStyleSheet("background-color: rgb(166,211,255);");
softName = new QWidget(left);
softName->setGeometry(85, 180, 310, 120);
softCnNameLb = new QLabel(softName);
softCnNameLb->setGeometry(0, 0, 310, 54);
softCnNameLb->setAlignment(Qt::AlignHCenter);
softCnNameLb->setStyleSheet("color:white;");
QFont softCnNameFont;
softCnNameFont.setPixelSize(40);
softCnNameFont.setFamily("宋体");
softCnNameLb->setFont(softCnNameFont);
welcomeLb = new QLabel(softName);
welcomeLb->setGeometry(0, 75, 310, 44);
welcomeLb->setAlignment(Qt::AlignHCenter);
welcomeLb->setStyleSheet("color:white;");
QFont welcomeFont;
welcomeFont.setPixelSize(20);
welcomeFont.setFamily("宋体");
welcomeLb->setFont(welcomeFont);
welcomeLoginLb = new QLabel(this);
welcomeLoginLb->setGeometry(635, 85, 160, 40);
QFont welcomeLoginFont;
welcomeLoginFont.setFamily("宋体");
welcomeLoginFont.setPixelSize(40);
welcomeLoginLb->setFont(welcomeLoginFont);
// 通用字体
QFont commonFont;
commonFont.setFamily("宋体");
commonFont.setPixelSize(20);
// 用户名标签
usernameLb = new QLabel(bottom);
usernameLb = new QLabel(this);
usernameLb->setObjectName(QStringLiteral("label_UserName"));
usernameLb->setGeometry(1, 1, 40, 26);
gridLayout->addWidget(usernameLb, 0, 0, 1, 1);
usernameLb->setGeometry(635, 185, 40, 20);
usernameLb->setFont(commonFont);
// 用户名输入框
usernameLe = new QLineEdit(bottom);
usernameLe = new QLineEdit(this);
usernameLe->setObjectName(QStringLiteral("lineEdit_UserName"));
usernameLe->setGeometry(47, 1, 128, 26);
gridLayout->addWidget(usernameLe, 0, 1, 1, 1);
usernameLe->setGeometry(635, 210, 270, 40);
//密码标签
passwordLb = new QLabel(bottom);
passwordLb = new QLabel(this);
passwordLb->setObjectName(QStringLiteral("label_Password"));
passwordLb->setGeometry(1, 33, 40, 26);
gridLayout->addWidget(passwordLb, 1, 0, 1, 1);
passwordLb->setGeometry(635, 255, 40, 20);
passwordLb->setFont(commonFont);
// 密码输入框
passwordLe = new QLineEdit(bottom);
passwordLe = new QLineEdit(this);
passwordLe->setObjectName(QStringLiteral("lineEdit_Password"));
passwordLe->setEchoMode(QLineEdit::Password);
passwordLe->setGeometry(47, 33, 128, 26);
gridLayout->addWidget(passwordLe, 1, 1, 1, 1);
vLayout->addLayout(gridLayout);
//水平布局
hLayout = new QHBoxLayout();
hLayout->setObjectName(QStringLiteral("horizontalLayout"));
passwordLe->setGeometry(635, 280, 270, 40);
// 登录按钮
loginBt = new QPushButton(bottom);
loginBt = new QPushButton(this);
loginBt->setObjectName(QStringLiteral("button_Login"));
loginBt->setGeometry(1, 1, 84, 26);
hLayout->addWidget(loginBt);
loginBt->setGeometry(635, 380, 80, 40);
loginBt->setFont(commonFont);
//退出按钮
quitBt = new QPushButton(bottom);
quitBt = new QPushButton(this);
quitBt->setObjectName(QStringLiteral("button_Quit"));
quitBt->setGeometry(91, 1, 86, 26);
hLayout->addWidget(quitBt);
vLayout->addLayout(hLayout);
// 关闭按钮
closeBt = new QPushButton(this);
closeBt->setObjectName(QStringLiteral("button_Close"));
closeBt->setGeometry(395, 0, 25, 25);
QIcon closeIcon;
closeIcon.addFile(":/icon/res/images/close.jpeg");
closeBt->setIcon(closeIcon);
quitBt->setGeometry(825, 380, 80, 40);
quitBt->setFont(commonFont);
QMetaObject::connectSlotsByName(this);
......@@ -105,10 +92,11 @@ LoginDlgUi::LoginDlgUi(QWidget *parent) : QDialog(parent) {
void LoginDlgUi::retranslateUi(QDialog *LoginDialog) {
LoginDialog->setWindowTitle(
QApplication::translate("LoginDialog", "Dialog", nullptr));
usernameLb->setText(QApplication::translate(
"LoginDialog", "\347\224\250\346\210\267\345\220\215:", nullptr));
passwordLb->setText(QApplication::translate(
"LoginDialog", "\345\257\206\347\240\201:", nullptr));
softCnNameLb->setText(QObject::tr("RMS餐饮管理系统"));
welcomeLb->setText(QObject::tr("Welcome to RMS System"));
welcomeLoginLb->setText(QObject::tr("欢迎登录"));
usernameLb->setText(QObject::tr("账号"));
passwordLb->setText(QObject::tr("密码"));
loginBt->setText(QApplication::translate(
"LoginDialog", "\347\231\273\345\275\225", nullptr));
quitBt->setText(QApplication::translate("LoginDialog",
......
......@@ -30,19 +30,18 @@ class LoginDlgUi : public QDialog {
public:
explicit LoginDlgUi(QWidget *parent = nullptr);
QWidget *top;
QWidget *bottom;
QVBoxLayout *vLayout;
QGridLayout *gridLayout;
QHBoxLayout *hLayout;
QWidget *left;
QWidget *softName;
QLabel *softCnNameLb;
QLabel *welcomeLb;
QLabel *welcomeLoginLb;
QLabel *usernameLb; //用户名标签
QLineEdit *usernameLe; //用户名输入框
QLabel *passwordLb; //密码标签
QLineEdit *passwordLe; //密码输入框
QPushButton *loginBt; //登录按钮
QPushButton *quitBt; //退出按钮
QPushButton *closeBt; //关闭按钮
void setupUi(QDialog *LoginDialog); // setupUi
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册