- add: styles
This commit is contained in:
@@ -16,7 +16,9 @@ find_package(Qt6 COMPONENTS
|
||||
PrintSupport
|
||||
REQUIRED)
|
||||
|
||||
add_executable(StationManager)
|
||||
add_executable(StationManager
|
||||
src/resources.qrc
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE SOURCES "src/*.cpp")
|
||||
target_sources(StationManager PRIVATE ${SOURCES})
|
||||
|
||||
10
src/main.cpp
10
src/main.cpp
@@ -6,9 +6,13 @@
|
||||
#include "userinterfaces/windows/mainwindow.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
QApplication a(argc, argv);
|
||||
a.setApplicationName("StationManager");
|
||||
a.setOrganizationName("Station");
|
||||
QApplication application(argc, argv);
|
||||
application.setApplicationName("StationManager");
|
||||
application.setOrganizationName("Station");
|
||||
|
||||
QFile qss(":/userinterfaces/styles.qss");
|
||||
if (qss.open(QFile::ReadOnly))
|
||||
application.setStyleSheet(qss.readAll());
|
||||
|
||||
if (!Database::instance().initialize()) {
|
||||
QMessageBox::critical(nullptr, "Ошибка",
|
||||
|
||||
5
src/resources.qrc
Normal file
5
src/resources.qrc
Normal file
@@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>userinterfaces/styles.qss</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
67
src/userinterfaces/styles.qss
Normal file
67
src/userinterfaces/styles.qss
Normal file
@@ -0,0 +1,67 @@
|
||||
#bannerFrame {
|
||||
background-color: #721F1E;
|
||||
}
|
||||
#bannerFrame QLabel {
|
||||
color: white;
|
||||
}
|
||||
#bannerLogo {
|
||||
font-size: 64px;
|
||||
}
|
||||
#bannerTitle {
|
||||
font-size: 22px;
|
||||
font-weight: bold;
|
||||
line-height: 1.4;
|
||||
}
|
||||
#bannerInfo {
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
#bannerVersion {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
font-size: 11px;
|
||||
}
|
||||
#formFrame {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
#formTitle {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
color: #721F1E;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.formLabel {
|
||||
font-size: 13px;
|
||||
color: #555;
|
||||
font-weight: 500;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.formInput {
|
||||
color: #222;
|
||||
padding: 0 15px;
|
||||
font-size: 14px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 0px;
|
||||
background: white;
|
||||
min-height: 40px;
|
||||
}
|
||||
#messageLabel {
|
||||
color: #d32f2f;
|
||||
font-size: 13px;
|
||||
min-height: 20px;
|
||||
}
|
||||
#loginBtn {
|
||||
background-color: #721F1E;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 0px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
min-height: 45px;
|
||||
}
|
||||
#loginBtn:hover {
|
||||
background-color: #8A2A2A;
|
||||
}
|
||||
#loginBtn:pressed {
|
||||
background-color: #571414;
|
||||
}
|
||||
@@ -7,38 +7,87 @@ LoginWindow::LoginWindow(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowTitle("Авторизация - Система вокзала");
|
||||
setFixedSize(400, 280);
|
||||
setFixedSize(700, 500);
|
||||
setModal(true);
|
||||
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setSpacing(15);
|
||||
mainLayout->setContentsMargins(30, 30, 30, 30);
|
||||
QHBoxLayout* mainLayout = new QHBoxLayout(this);
|
||||
mainLayout->setSpacing(0);
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
QLabel* titleLabel = new QLabel("Система учета вокзала", this);
|
||||
titleLabel->setAlignment(Qt::AlignCenter);
|
||||
titleLabel->setStyleSheet("font-size: 18px; font-weight: bold;");
|
||||
mainLayout->addWidget(titleLabel);
|
||||
m_bannerFrame = new QFrame(this);
|
||||
m_bannerFrame->setObjectName("bannerFrame");
|
||||
m_bannerFrame->setFixedWidth(280);
|
||||
QVBoxLayout* bannerLayout = new QVBoxLayout(m_bannerFrame);
|
||||
bannerLayout->setContentsMargins(20, 40, 20, 40);
|
||||
bannerLayout->setAlignment(Qt::AlignCenter);
|
||||
|
||||
QLabel* userLabel = new QLabel("Логин:", this);
|
||||
m_usernameEdit = new QLineEdit(this);
|
||||
QLabel* logoIcon = new QLabel("🚂", m_bannerFrame);
|
||||
logoIcon->setObjectName("bannerLogo");
|
||||
logoIcon->setAlignment(Qt::AlignCenter);
|
||||
bannerLayout->addWidget(logoIcon);
|
||||
|
||||
QLabel* titleBanner = new QLabel("Система учета\nжелезнодорожного\nвокзала", m_bannerFrame);
|
||||
titleBanner->setObjectName("bannerTitle");
|
||||
titleBanner->setAlignment(Qt::AlignCenter);
|
||||
bannerLayout->addWidget(titleBanner);
|
||||
|
||||
bannerLayout->addSpacing(20);
|
||||
|
||||
bannerLayout->addStretch();
|
||||
|
||||
QLabel* versionLabel = new QLabel("Версия 0.1", m_bannerFrame);
|
||||
versionLabel->setObjectName("bannerVersion");
|
||||
versionLabel->setAlignment(Qt::AlignCenter);
|
||||
bannerLayout->addWidget(versionLabel);
|
||||
|
||||
mainLayout->addWidget(m_bannerFrame);
|
||||
|
||||
QFrame* formFrame = new QFrame(this);
|
||||
formFrame->setObjectName("formFrame");
|
||||
QVBoxLayout* formLayout = new QVBoxLayout(formFrame);
|
||||
formLayout->setContentsMargins(50, 50, 50, 50);
|
||||
formLayout->setAlignment(Qt::AlignCenter);
|
||||
|
||||
QLabel* formTitle = new QLabel("Вход в систему", formFrame);
|
||||
formTitle->setObjectName("formTitle");
|
||||
formTitle->setAlignment(Qt::AlignCenter);
|
||||
formLayout->addWidget(formTitle);
|
||||
|
||||
QLabel* userLabel = new QLabel("Логин", formFrame);
|
||||
userLabel->setObjectName("userLabel");
|
||||
userLabel->setProperty("class", "formLabel");
|
||||
formLayout->addWidget(userLabel);
|
||||
|
||||
m_usernameEdit = new QLineEdit(formFrame);
|
||||
m_usernameEdit->setObjectName("usernameEdit");
|
||||
m_usernameEdit->setProperty("class", "formInput");
|
||||
m_usernameEdit->setPlaceholderText("Введите логин");
|
||||
mainLayout->addWidget(userLabel);
|
||||
mainLayout->addWidget(m_usernameEdit);
|
||||
formLayout->addWidget(m_usernameEdit);
|
||||
formLayout->addSpacing(15);
|
||||
|
||||
QLabel* passLabel = new QLabel("Пароль:", this);
|
||||
m_passwordEdit = new QLineEdit(this);
|
||||
QLabel* passLabel = new QLabel("Пароль", formFrame);
|
||||
passLabel->setObjectName("passLabel");
|
||||
passLabel->setProperty("class", "formLabel");
|
||||
formLayout->addWidget(passLabel);
|
||||
|
||||
m_passwordEdit = new QLineEdit(formFrame);
|
||||
m_passwordEdit->setObjectName("passwordEdit");
|
||||
m_passwordEdit->setProperty("class", "formInput");
|
||||
m_passwordEdit->setPlaceholderText("Введите пароль");
|
||||
m_passwordEdit->setEchoMode(QLineEdit::Password);
|
||||
mainLayout->addWidget(passLabel);
|
||||
mainLayout->addWidget(m_passwordEdit);
|
||||
formLayout->addWidget(m_passwordEdit);
|
||||
formLayout->addSpacing(15);
|
||||
|
||||
m_messageLabel = new QLabel(this);
|
||||
m_messageLabel = new QLabel(formFrame);
|
||||
m_messageLabel->setObjectName("messageLabel");
|
||||
m_messageLabel->setAlignment(Qt::AlignCenter);
|
||||
m_messageLabel->setStyleSheet("color: red;");
|
||||
mainLayout->addWidget(m_messageLabel);
|
||||
formLayout->addWidget(m_messageLabel);
|
||||
|
||||
m_loginBtn = new QPushButton("Войти", this);
|
||||
mainLayout->addWidget(m_loginBtn);
|
||||
m_loginBtn = new QPushButton("Войти", formFrame);
|
||||
m_loginBtn->setObjectName("loginBtn");
|
||||
formLayout->addWidget(m_loginBtn);
|
||||
|
||||
mainLayout->addWidget(formFrame);
|
||||
|
||||
connect(m_loginBtn, &QPushButton::clicked, this, &LoginWindow::onLoginClicked);
|
||||
}
|
||||
@@ -61,4 +110,4 @@ void LoginWindow::onLoginClicked() {
|
||||
m_messageLabel->setText("Неверный логин или пароль!");
|
||||
m_passwordEdit->clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFrame>
|
||||
|
||||
class LoginWindow : public QDialog {
|
||||
Q_OBJECT
|
||||
@@ -27,6 +29,7 @@ private:
|
||||
QLabel* m_messageLabel;
|
||||
QString m_username;
|
||||
QString m_role;
|
||||
QFrame* m_bannerFrame;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user