You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
3.6 KiB
C++
98 lines
3.6 KiB
C++
#ifndef LOGINWIDGET_H
|
|
#define LOGINWIDGET_H
|
|
|
|
#include <QWidget>
|
|
#include <QLabel>
|
|
#include <QLineEdit>
|
|
#include <QPushButton>
|
|
#include <QVBoxLayout>
|
|
#include <QShortcut>
|
|
#include <QTextCodec>
|
|
#include <QtWidgets/QApplication>
|
|
|
|
class LoginWidget:public QWidget
|
|
{
|
|
public:
|
|
QLabel *picLabel;
|
|
QLineEdit *userEdit;
|
|
QLineEdit *pwdEdit;
|
|
QPushButton *loginButton;
|
|
QPushButton *exitButton;
|
|
QHBoxLayout *horizontalLayout;
|
|
QVBoxLayout *verticalLayout;
|
|
QVBoxLayout *conVerLayout;
|
|
|
|
|
|
void setupUi(QWidget* LoginWidget)
|
|
{
|
|
resize(306, 451);
|
|
|
|
picLabel = new QLabel();
|
|
picLabel->setObjectName(QString::fromUtf8("picLabel"));
|
|
picLabel->setPixmap(QPixmap(":/Static/userPic.png"));
|
|
picLabel->setScaledContents(true);
|
|
|
|
userEdit = new QLineEdit();
|
|
userEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
|
userEdit->setObjectName(QString::fromUtf8("userEdit"));
|
|
|
|
pwdEdit = new QLineEdit();
|
|
pwdEdit->setEchoMode(QLineEdit::Password);
|
|
pwdEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
|
pwdEdit->setObjectName(QString::fromUtf8("pwdEdit"));
|
|
|
|
loginButton = new QPushButton();
|
|
connect(loginButton, SIGNAL(clicked()), this, SLOT(login()));
|
|
QShortcut* enter_shortcut = new QShortcut(QKeySequence(Qt::Key_Return), this);
|
|
connect(enter_shortcut, SIGNAL(activated()), loginButton, SLOT(click()));
|
|
loginButton->setObjectName(QString::fromUtf8("loginButton"));
|
|
|
|
exitButton = new QPushButton();
|
|
connect(exitButton, SIGNAL(clicked()), this, SLOT(close()));
|
|
exitButton->setObjectName(QString::fromUtf8("exitButton"));
|
|
|
|
horizontalLayout = new QHBoxLayout();
|
|
horizontalLayout->addWidget(loginButton);
|
|
horizontalLayout->addWidget(exitButton);
|
|
horizontalLayout->setSpacing(10);
|
|
horizontalLayout->setContentsMargins(0, 0, 0, 0);
|
|
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
|
|
|
|
conVerLayout = new QVBoxLayout();
|
|
conVerLayout->addWidget(userEdit);
|
|
conVerLayout->addWidget(pwdEdit);
|
|
conVerLayout->addLayout(horizontalLayout);
|
|
conVerLayout->setSpacing(32);
|
|
conVerLayout->setContentsMargins(34, 26, 34, 65);
|
|
conVerLayout->setObjectName(QString::fromUtf8("conVerLayout"));
|
|
|
|
verticalLayout = new QVBoxLayout();
|
|
verticalLayout->addWidget(picLabel);
|
|
verticalLayout->addLayout(conVerLayout);
|
|
verticalLayout->setStretch(0, 4);
|
|
verticalLayout->setStretch(1, 6);
|
|
verticalLayout->setSpacing(0);
|
|
verticalLayout->setContentsMargins(0, 0, 0, 0);
|
|
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
|
|
|
|
setLayout(verticalLayout);
|
|
}// setupUi
|
|
|
|
void retranslateUi(QWidget* LoginWidget)
|
|
{
|
|
LoginWidget->setWindowTitle(QCoreApplication::translate("LoginWidget", "Form", nullptr));
|
|
|
|
userEdit->setText(QCoreApplication::translate("LoginWidget", "\345\244\247\345\260\217\345\233\276\346\240\207\345\210\207\346\215\242", nullptr));
|
|
pwdEdit->setText(QCoreApplication::translate("LoginWidget", "\351\200\232\350\256\257\344\270\255\346\226\255 x\345\217\260", nullptr));
|
|
loginButton->setText(QCoreApplication::translate("LoginWidget", "\346\255\243\345\270\270\350\277\220\350\241\214 x\345\217\260", nullptr));
|
|
exitButton->setText(QCoreApplication::translate("LoginWidget", "\345\276\205\346\234\272\347\255\211\351\243\216 x\345\217\260", nullptr));
|
|
} // retranslateUi
|
|
|
|
LoginWidget(){
|
|
this->setupUi(this);
|
|
}
|
|
|
|
};
|
|
|
|
#endif // LOGINWIDGET_H
|