diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/StartupForm.ui b/StartupForm.ui index 1a8c5b2..afb610f 100644 --- a/StartupForm.ui +++ b/StartupForm.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 600 + 1280 + 800 @@ -15,14 +15,14 @@ - + Qt::Vertical - 20 - 40 + 17 + 166 @@ -48,40 +48,118 @@ - + Qt::Vertical - 20 - 40 + 17 + 167 - - - TextLabel - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 用户 + + + + :/images/user.png:/images/user.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设置 + + + + :/images/setting.png:/images/setting.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + Qt::Vertical - 20 - 40 + 17 + 166 - + + + diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/StartupForm.ui b/StartupForm.ui index 1a8c5b2..afb610f 100644 --- a/StartupForm.ui +++ b/StartupForm.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 600 + 1280 + 800 @@ -15,14 +15,14 @@ - + Qt::Vertical - 20 - 40 + 17 + 166 @@ -48,40 +48,118 @@ - + Qt::Vertical - 20 - 40 + 17 + 167 - - - TextLabel - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 用户 + + + + :/images/user.png:/images/user.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设置 + + + + :/images/setting.png:/images/setting.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + Qt::Vertical - 20 - 40 + 17 + 166 - + + + diff --git a/UserListForm.cpp b/UserListForm.cpp new file mode 100644 index 0000000..4527aff --- /dev/null +++ b/UserListForm.cpp @@ -0,0 +1,31 @@ +#include "UserListForm.h" +#include "ui_UserListForm.h" + +UserListForm::UserListForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserListForm) +{ + ui->setupUi(this); + + // 加载css文件设置控件样式 + QFile file(QApplication::applicationDirPath() + "/qss/userList.css"); + if (file.open(QFile::ReadOnly)) + { + QString qssStr = QLatin1String(file.readAll()); + this->setStyleSheet(qssStr); + file.close(); + } + + // 设置弹簧的尺寸 + ui->vsContentTop->changeSize(0, 20); + ui->vsTableTop->changeSize(0, 20); + ui->hsCondRight->changeSize(660, 0); + + ui->hsPageRight->changeSize(100, 0); + ui->vsContentBottom->changeSize(0, 40); +} + +UserListForm::~UserListForm() +{ + delete ui; +} diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/StartupForm.ui b/StartupForm.ui index 1a8c5b2..afb610f 100644 --- a/StartupForm.ui +++ b/StartupForm.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 600 + 1280 + 800 @@ -15,14 +15,14 @@ - + Qt::Vertical - 20 - 40 + 17 + 166 @@ -48,40 +48,118 @@ - + Qt::Vertical - 20 - 40 + 17 + 167 - - - TextLabel - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 用户 + + + + :/images/user.png:/images/user.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设置 + + + + :/images/setting.png:/images/setting.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + Qt::Vertical - 20 - 40 + 17 + 166 - + + + diff --git a/UserListForm.cpp b/UserListForm.cpp new file mode 100644 index 0000000..4527aff --- /dev/null +++ b/UserListForm.cpp @@ -0,0 +1,31 @@ +#include "UserListForm.h" +#include "ui_UserListForm.h" + +UserListForm::UserListForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserListForm) +{ + ui->setupUi(this); + + // 加载css文件设置控件样式 + QFile file(QApplication::applicationDirPath() + "/qss/userList.css"); + if (file.open(QFile::ReadOnly)) + { + QString qssStr = QLatin1String(file.readAll()); + this->setStyleSheet(qssStr); + file.close(); + } + + // 设置弹簧的尺寸 + ui->vsContentTop->changeSize(0, 20); + ui->vsTableTop->changeSize(0, 20); + ui->hsCondRight->changeSize(660, 0); + + ui->hsPageRight->changeSize(100, 0); + ui->vsContentBottom->changeSize(0, 40); +} + +UserListForm::~UserListForm() +{ + delete ui; +} diff --git a/UserListForm.h b/UserListForm.h new file mode 100644 index 0000000..f6efc2f --- /dev/null +++ b/UserListForm.h @@ -0,0 +1,24 @@ +#ifndef USERLISTFORM_H +#define USERLISTFORM_H + +#include +#include +#include "utils/SettingConfig.h" + +namespace Ui { +class UserListForm; +} + +class UserListForm : public QWidget +{ + Q_OBJECT + +public: + explicit UserListForm(QWidget *parent = nullptr); + ~UserListForm(); + +private: + Ui::UserListForm *ui; +}; + +#endif // USERLISTFORM_H diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/StartupForm.ui b/StartupForm.ui index 1a8c5b2..afb610f 100644 --- a/StartupForm.ui +++ b/StartupForm.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 600 + 1280 + 800 @@ -15,14 +15,14 @@ - + Qt::Vertical - 20 - 40 + 17 + 166 @@ -48,40 +48,118 @@ - + Qt::Vertical - 20 - 40 + 17 + 167 - - - TextLabel - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 用户 + + + + :/images/user.png:/images/user.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设置 + + + + :/images/setting.png:/images/setting.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + Qt::Vertical - 20 - 40 + 17 + 166 - + + + diff --git a/UserListForm.cpp b/UserListForm.cpp new file mode 100644 index 0000000..4527aff --- /dev/null +++ b/UserListForm.cpp @@ -0,0 +1,31 @@ +#include "UserListForm.h" +#include "ui_UserListForm.h" + +UserListForm::UserListForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserListForm) +{ + ui->setupUi(this); + + // 加载css文件设置控件样式 + QFile file(QApplication::applicationDirPath() + "/qss/userList.css"); + if (file.open(QFile::ReadOnly)) + { + QString qssStr = QLatin1String(file.readAll()); + this->setStyleSheet(qssStr); + file.close(); + } + + // 设置弹簧的尺寸 + ui->vsContentTop->changeSize(0, 20); + ui->vsTableTop->changeSize(0, 20); + ui->hsCondRight->changeSize(660, 0); + + ui->hsPageRight->changeSize(100, 0); + ui->vsContentBottom->changeSize(0, 40); +} + +UserListForm::~UserListForm() +{ + delete ui; +} diff --git a/UserListForm.h b/UserListForm.h new file mode 100644 index 0000000..f6efc2f --- /dev/null +++ b/UserListForm.h @@ -0,0 +1,24 @@ +#ifndef USERLISTFORM_H +#define USERLISTFORM_H + +#include +#include +#include "utils/SettingConfig.h" + +namespace Ui { +class UserListForm; +} + +class UserListForm : public QWidget +{ + Q_OBJECT + +public: + explicit UserListForm(QWidget *parent = nullptr); + ~UserListForm(); + +private: + Ui::UserListForm *ui; +}; + +#endif // USERLISTFORM_H diff --git a/UserListForm.ui b/UserListForm.ui new file mode 100644 index 0000000..59e2237 --- /dev/null +++ b/UserListForm.ui @@ -0,0 +1,332 @@ + + + UserListForm + + + + 0 + 0 + 960 + 600 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + 15 + + + 15 + + + 15 + + + 15 + + + + + ... + + + + :/images/back.png:/images/back.png + + + + 52 + 52 + + + + + + + + 人员列表 + + + Qt::AlignCenter + + + + + + + ... + + + + :/images/home.png:/images/home.png + + + + 52 + 52 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + 请输入姓名 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 1 / 1 + + + + + + + + + + ... + + + + :/images/btnPageFirst.png:/images/btnPageFirst.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPagePre.png:/images/btnPagePre.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageNext.png:/images/btnPageNext.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageLast.png:/images/btnPageLast.png + + + + 36 + 36 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/StartupForm.ui b/StartupForm.ui index 1a8c5b2..afb610f 100644 --- a/StartupForm.ui +++ b/StartupForm.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 600 + 1280 + 800 @@ -15,14 +15,14 @@ - + Qt::Vertical - 20 - 40 + 17 + 166 @@ -48,40 +48,118 @@ - + Qt::Vertical - 20 - 40 + 17 + 167 - - - TextLabel - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 用户 + + + + :/images/user.png:/images/user.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设置 + + + + :/images/setting.png:/images/setting.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + Qt::Vertical - 20 - 40 + 17 + 166 - + + + diff --git a/UserListForm.cpp b/UserListForm.cpp new file mode 100644 index 0000000..4527aff --- /dev/null +++ b/UserListForm.cpp @@ -0,0 +1,31 @@ +#include "UserListForm.h" +#include "ui_UserListForm.h" + +UserListForm::UserListForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserListForm) +{ + ui->setupUi(this); + + // 加载css文件设置控件样式 + QFile file(QApplication::applicationDirPath() + "/qss/userList.css"); + if (file.open(QFile::ReadOnly)) + { + QString qssStr = QLatin1String(file.readAll()); + this->setStyleSheet(qssStr); + file.close(); + } + + // 设置弹簧的尺寸 + ui->vsContentTop->changeSize(0, 20); + ui->vsTableTop->changeSize(0, 20); + ui->hsCondRight->changeSize(660, 0); + + ui->hsPageRight->changeSize(100, 0); + ui->vsContentBottom->changeSize(0, 40); +} + +UserListForm::~UserListForm() +{ + delete ui; +} diff --git a/UserListForm.h b/UserListForm.h new file mode 100644 index 0000000..f6efc2f --- /dev/null +++ b/UserListForm.h @@ -0,0 +1,24 @@ +#ifndef USERLISTFORM_H +#define USERLISTFORM_H + +#include +#include +#include "utils/SettingConfig.h" + +namespace Ui { +class UserListForm; +} + +class UserListForm : public QWidget +{ + Q_OBJECT + +public: + explicit UserListForm(QWidget *parent = nullptr); + ~UserListForm(); + +private: + Ui::UserListForm *ui; +}; + +#endif // USERLISTFORM_H diff --git a/UserListForm.ui b/UserListForm.ui new file mode 100644 index 0000000..59e2237 --- /dev/null +++ b/UserListForm.ui @@ -0,0 +1,332 @@ + + + UserListForm + + + + 0 + 0 + 960 + 600 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + 15 + + + 15 + + + 15 + + + 15 + + + + + ... + + + + :/images/back.png:/images/back.png + + + + 52 + 52 + + + + + + + + 人员列表 + + + Qt::AlignCenter + + + + + + + ... + + + + :/images/home.png:/images/home.png + + + + 52 + 52 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + 请输入姓名 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 1 / 1 + + + + + + + + + + ... + + + + :/images/btnPageFirst.png:/images/btnPageFirst.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPagePre.png:/images/btnPagePre.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageNext.png:/images/btnPageNext.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageLast.png:/images/btnPageLast.png + + + + 36 + 36 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + diff --git a/images/back.png b/images/back.png new file mode 100644 index 0000000..1419d0b --- /dev/null +++ b/images/back.png Binary files differ diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/StartupForm.ui b/StartupForm.ui index 1a8c5b2..afb610f 100644 --- a/StartupForm.ui +++ b/StartupForm.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 600 + 1280 + 800 @@ -15,14 +15,14 @@ - + Qt::Vertical - 20 - 40 + 17 + 166 @@ -48,40 +48,118 @@ - + Qt::Vertical - 20 - 40 + 17 + 167 - - - TextLabel - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 用户 + + + + :/images/user.png:/images/user.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设置 + + + + :/images/setting.png:/images/setting.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + Qt::Vertical - 20 - 40 + 17 + 166 - + + + diff --git a/UserListForm.cpp b/UserListForm.cpp new file mode 100644 index 0000000..4527aff --- /dev/null +++ b/UserListForm.cpp @@ -0,0 +1,31 @@ +#include "UserListForm.h" +#include "ui_UserListForm.h" + +UserListForm::UserListForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserListForm) +{ + ui->setupUi(this); + + // 加载css文件设置控件样式 + QFile file(QApplication::applicationDirPath() + "/qss/userList.css"); + if (file.open(QFile::ReadOnly)) + { + QString qssStr = QLatin1String(file.readAll()); + this->setStyleSheet(qssStr); + file.close(); + } + + // 设置弹簧的尺寸 + ui->vsContentTop->changeSize(0, 20); + ui->vsTableTop->changeSize(0, 20); + ui->hsCondRight->changeSize(660, 0); + + ui->hsPageRight->changeSize(100, 0); + ui->vsContentBottom->changeSize(0, 40); +} + +UserListForm::~UserListForm() +{ + delete ui; +} diff --git a/UserListForm.h b/UserListForm.h new file mode 100644 index 0000000..f6efc2f --- /dev/null +++ b/UserListForm.h @@ -0,0 +1,24 @@ +#ifndef USERLISTFORM_H +#define USERLISTFORM_H + +#include +#include +#include "utils/SettingConfig.h" + +namespace Ui { +class UserListForm; +} + +class UserListForm : public QWidget +{ + Q_OBJECT + +public: + explicit UserListForm(QWidget *parent = nullptr); + ~UserListForm(); + +private: + Ui::UserListForm *ui; +}; + +#endif // USERLISTFORM_H diff --git a/UserListForm.ui b/UserListForm.ui new file mode 100644 index 0000000..59e2237 --- /dev/null +++ b/UserListForm.ui @@ -0,0 +1,332 @@ + + + UserListForm + + + + 0 + 0 + 960 + 600 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + 15 + + + 15 + + + 15 + + + 15 + + + + + ... + + + + :/images/back.png:/images/back.png + + + + 52 + 52 + + + + + + + + 人员列表 + + + Qt::AlignCenter + + + + + + + ... + + + + :/images/home.png:/images/home.png + + + + 52 + 52 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + 请输入姓名 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 1 / 1 + + + + + + + + + + ... + + + + :/images/btnPageFirst.png:/images/btnPageFirst.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPagePre.png:/images/btnPagePre.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageNext.png:/images/btnPageNext.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageLast.png:/images/btnPageLast.png + + + + 36 + 36 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + diff --git a/images/back.png b/images/back.png new file mode 100644 index 0000000..1419d0b --- /dev/null +++ b/images/back.png Binary files differ diff --git a/images/btnPageFirst.png b/images/btnPageFirst.png new file mode 100644 index 0000000..3759e8c --- /dev/null +++ b/images/btnPageFirst.png Binary files differ diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/StartupForm.ui b/StartupForm.ui index 1a8c5b2..afb610f 100644 --- a/StartupForm.ui +++ b/StartupForm.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 600 + 1280 + 800 @@ -15,14 +15,14 @@ - + Qt::Vertical - 20 - 40 + 17 + 166 @@ -48,40 +48,118 @@ - + Qt::Vertical - 20 - 40 + 17 + 167 - - - TextLabel - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 用户 + + + + :/images/user.png:/images/user.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设置 + + + + :/images/setting.png:/images/setting.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + Qt::Vertical - 20 - 40 + 17 + 166 - + + + diff --git a/UserListForm.cpp b/UserListForm.cpp new file mode 100644 index 0000000..4527aff --- /dev/null +++ b/UserListForm.cpp @@ -0,0 +1,31 @@ +#include "UserListForm.h" +#include "ui_UserListForm.h" + +UserListForm::UserListForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserListForm) +{ + ui->setupUi(this); + + // 加载css文件设置控件样式 + QFile file(QApplication::applicationDirPath() + "/qss/userList.css"); + if (file.open(QFile::ReadOnly)) + { + QString qssStr = QLatin1String(file.readAll()); + this->setStyleSheet(qssStr); + file.close(); + } + + // 设置弹簧的尺寸 + ui->vsContentTop->changeSize(0, 20); + ui->vsTableTop->changeSize(0, 20); + ui->hsCondRight->changeSize(660, 0); + + ui->hsPageRight->changeSize(100, 0); + ui->vsContentBottom->changeSize(0, 40); +} + +UserListForm::~UserListForm() +{ + delete ui; +} diff --git a/UserListForm.h b/UserListForm.h new file mode 100644 index 0000000..f6efc2f --- /dev/null +++ b/UserListForm.h @@ -0,0 +1,24 @@ +#ifndef USERLISTFORM_H +#define USERLISTFORM_H + +#include +#include +#include "utils/SettingConfig.h" + +namespace Ui { +class UserListForm; +} + +class UserListForm : public QWidget +{ + Q_OBJECT + +public: + explicit UserListForm(QWidget *parent = nullptr); + ~UserListForm(); + +private: + Ui::UserListForm *ui; +}; + +#endif // USERLISTFORM_H diff --git a/UserListForm.ui b/UserListForm.ui new file mode 100644 index 0000000..59e2237 --- /dev/null +++ b/UserListForm.ui @@ -0,0 +1,332 @@ + + + UserListForm + + + + 0 + 0 + 960 + 600 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + 15 + + + 15 + + + 15 + + + 15 + + + + + ... + + + + :/images/back.png:/images/back.png + + + + 52 + 52 + + + + + + + + 人员列表 + + + Qt::AlignCenter + + + + + + + ... + + + + :/images/home.png:/images/home.png + + + + 52 + 52 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + 请输入姓名 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 1 / 1 + + + + + + + + + + ... + + + + :/images/btnPageFirst.png:/images/btnPageFirst.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPagePre.png:/images/btnPagePre.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageNext.png:/images/btnPageNext.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageLast.png:/images/btnPageLast.png + + + + 36 + 36 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + diff --git a/images/back.png b/images/back.png new file mode 100644 index 0000000..1419d0b --- /dev/null +++ b/images/back.png Binary files differ diff --git a/images/btnPageFirst.png b/images/btnPageFirst.png new file mode 100644 index 0000000..3759e8c --- /dev/null +++ b/images/btnPageFirst.png Binary files differ diff --git a/images/btnPageLast.png b/images/btnPageLast.png new file mode 100644 index 0000000..89eb51d --- /dev/null +++ b/images/btnPageLast.png Binary files differ diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/StartupForm.ui b/StartupForm.ui index 1a8c5b2..afb610f 100644 --- a/StartupForm.ui +++ b/StartupForm.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 600 + 1280 + 800 @@ -15,14 +15,14 @@ - + Qt::Vertical - 20 - 40 + 17 + 166 @@ -48,40 +48,118 @@ - + Qt::Vertical - 20 - 40 + 17 + 167 - - - TextLabel - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 用户 + + + + :/images/user.png:/images/user.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设置 + + + + :/images/setting.png:/images/setting.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + Qt::Vertical - 20 - 40 + 17 + 166 - + + + diff --git a/UserListForm.cpp b/UserListForm.cpp new file mode 100644 index 0000000..4527aff --- /dev/null +++ b/UserListForm.cpp @@ -0,0 +1,31 @@ +#include "UserListForm.h" +#include "ui_UserListForm.h" + +UserListForm::UserListForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserListForm) +{ + ui->setupUi(this); + + // 加载css文件设置控件样式 + QFile file(QApplication::applicationDirPath() + "/qss/userList.css"); + if (file.open(QFile::ReadOnly)) + { + QString qssStr = QLatin1String(file.readAll()); + this->setStyleSheet(qssStr); + file.close(); + } + + // 设置弹簧的尺寸 + ui->vsContentTop->changeSize(0, 20); + ui->vsTableTop->changeSize(0, 20); + ui->hsCondRight->changeSize(660, 0); + + ui->hsPageRight->changeSize(100, 0); + ui->vsContentBottom->changeSize(0, 40); +} + +UserListForm::~UserListForm() +{ + delete ui; +} diff --git a/UserListForm.h b/UserListForm.h new file mode 100644 index 0000000..f6efc2f --- /dev/null +++ b/UserListForm.h @@ -0,0 +1,24 @@ +#ifndef USERLISTFORM_H +#define USERLISTFORM_H + +#include +#include +#include "utils/SettingConfig.h" + +namespace Ui { +class UserListForm; +} + +class UserListForm : public QWidget +{ + Q_OBJECT + +public: + explicit UserListForm(QWidget *parent = nullptr); + ~UserListForm(); + +private: + Ui::UserListForm *ui; +}; + +#endif // USERLISTFORM_H diff --git a/UserListForm.ui b/UserListForm.ui new file mode 100644 index 0000000..59e2237 --- /dev/null +++ b/UserListForm.ui @@ -0,0 +1,332 @@ + + + UserListForm + + + + 0 + 0 + 960 + 600 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + 15 + + + 15 + + + 15 + + + 15 + + + + + ... + + + + :/images/back.png:/images/back.png + + + + 52 + 52 + + + + + + + + 人员列表 + + + Qt::AlignCenter + + + + + + + ... + + + + :/images/home.png:/images/home.png + + + + 52 + 52 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + 请输入姓名 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 1 / 1 + + + + + + + + + + ... + + + + :/images/btnPageFirst.png:/images/btnPageFirst.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPagePre.png:/images/btnPagePre.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageNext.png:/images/btnPageNext.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageLast.png:/images/btnPageLast.png + + + + 36 + 36 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + diff --git a/images/back.png b/images/back.png new file mode 100644 index 0000000..1419d0b --- /dev/null +++ b/images/back.png Binary files differ diff --git a/images/btnPageFirst.png b/images/btnPageFirst.png new file mode 100644 index 0000000..3759e8c --- /dev/null +++ b/images/btnPageFirst.png Binary files differ diff --git a/images/btnPageLast.png b/images/btnPageLast.png new file mode 100644 index 0000000..89eb51d --- /dev/null +++ b/images/btnPageLast.png Binary files differ diff --git a/images/btnPageNext.png b/images/btnPageNext.png new file mode 100644 index 0000000..4de6904 --- /dev/null +++ b/images/btnPageNext.png Binary files differ diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/StartupForm.ui b/StartupForm.ui index 1a8c5b2..afb610f 100644 --- a/StartupForm.ui +++ b/StartupForm.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 600 + 1280 + 800 @@ -15,14 +15,14 @@ - + Qt::Vertical - 20 - 40 + 17 + 166 @@ -48,40 +48,118 @@ - + Qt::Vertical - 20 - 40 + 17 + 167 - - - TextLabel - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 用户 + + + + :/images/user.png:/images/user.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设置 + + + + :/images/setting.png:/images/setting.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + Qt::Vertical - 20 - 40 + 17 + 166 - + + + diff --git a/UserListForm.cpp b/UserListForm.cpp new file mode 100644 index 0000000..4527aff --- /dev/null +++ b/UserListForm.cpp @@ -0,0 +1,31 @@ +#include "UserListForm.h" +#include "ui_UserListForm.h" + +UserListForm::UserListForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserListForm) +{ + ui->setupUi(this); + + // 加载css文件设置控件样式 + QFile file(QApplication::applicationDirPath() + "/qss/userList.css"); + if (file.open(QFile::ReadOnly)) + { + QString qssStr = QLatin1String(file.readAll()); + this->setStyleSheet(qssStr); + file.close(); + } + + // 设置弹簧的尺寸 + ui->vsContentTop->changeSize(0, 20); + ui->vsTableTop->changeSize(0, 20); + ui->hsCondRight->changeSize(660, 0); + + ui->hsPageRight->changeSize(100, 0); + ui->vsContentBottom->changeSize(0, 40); +} + +UserListForm::~UserListForm() +{ + delete ui; +} diff --git a/UserListForm.h b/UserListForm.h new file mode 100644 index 0000000..f6efc2f --- /dev/null +++ b/UserListForm.h @@ -0,0 +1,24 @@ +#ifndef USERLISTFORM_H +#define USERLISTFORM_H + +#include +#include +#include "utils/SettingConfig.h" + +namespace Ui { +class UserListForm; +} + +class UserListForm : public QWidget +{ + Q_OBJECT + +public: + explicit UserListForm(QWidget *parent = nullptr); + ~UserListForm(); + +private: + Ui::UserListForm *ui; +}; + +#endif // USERLISTFORM_H diff --git a/UserListForm.ui b/UserListForm.ui new file mode 100644 index 0000000..59e2237 --- /dev/null +++ b/UserListForm.ui @@ -0,0 +1,332 @@ + + + UserListForm + + + + 0 + 0 + 960 + 600 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + 15 + + + 15 + + + 15 + + + 15 + + + + + ... + + + + :/images/back.png:/images/back.png + + + + 52 + 52 + + + + + + + + 人员列表 + + + Qt::AlignCenter + + + + + + + ... + + + + :/images/home.png:/images/home.png + + + + 52 + 52 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + 请输入姓名 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 1 / 1 + + + + + + + + + + ... + + + + :/images/btnPageFirst.png:/images/btnPageFirst.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPagePre.png:/images/btnPagePre.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageNext.png:/images/btnPageNext.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageLast.png:/images/btnPageLast.png + + + + 36 + 36 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + diff --git a/images/back.png b/images/back.png new file mode 100644 index 0000000..1419d0b --- /dev/null +++ b/images/back.png Binary files differ diff --git a/images/btnPageFirst.png b/images/btnPageFirst.png new file mode 100644 index 0000000..3759e8c --- /dev/null +++ b/images/btnPageFirst.png Binary files differ diff --git a/images/btnPageLast.png b/images/btnPageLast.png new file mode 100644 index 0000000..89eb51d --- /dev/null +++ b/images/btnPageLast.png Binary files differ diff --git a/images/btnPageNext.png b/images/btnPageNext.png new file mode 100644 index 0000000..4de6904 --- /dev/null +++ b/images/btnPageNext.png Binary files differ diff --git a/images/btnPagePre.png b/images/btnPagePre.png new file mode 100644 index 0000000..badfa15 --- /dev/null +++ b/images/btnPagePre.png Binary files differ diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/StartupForm.ui b/StartupForm.ui index 1a8c5b2..afb610f 100644 --- a/StartupForm.ui +++ b/StartupForm.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 600 + 1280 + 800 @@ -15,14 +15,14 @@ - + Qt::Vertical - 20 - 40 + 17 + 166 @@ -48,40 +48,118 @@ - + Qt::Vertical - 20 - 40 + 17 + 167 - - - TextLabel - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 用户 + + + + :/images/user.png:/images/user.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设置 + + + + :/images/setting.png:/images/setting.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + Qt::Vertical - 20 - 40 + 17 + 166 - + + + diff --git a/UserListForm.cpp b/UserListForm.cpp new file mode 100644 index 0000000..4527aff --- /dev/null +++ b/UserListForm.cpp @@ -0,0 +1,31 @@ +#include "UserListForm.h" +#include "ui_UserListForm.h" + +UserListForm::UserListForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserListForm) +{ + ui->setupUi(this); + + // 加载css文件设置控件样式 + QFile file(QApplication::applicationDirPath() + "/qss/userList.css"); + if (file.open(QFile::ReadOnly)) + { + QString qssStr = QLatin1String(file.readAll()); + this->setStyleSheet(qssStr); + file.close(); + } + + // 设置弹簧的尺寸 + ui->vsContentTop->changeSize(0, 20); + ui->vsTableTop->changeSize(0, 20); + ui->hsCondRight->changeSize(660, 0); + + ui->hsPageRight->changeSize(100, 0); + ui->vsContentBottom->changeSize(0, 40); +} + +UserListForm::~UserListForm() +{ + delete ui; +} diff --git a/UserListForm.h b/UserListForm.h new file mode 100644 index 0000000..f6efc2f --- /dev/null +++ b/UserListForm.h @@ -0,0 +1,24 @@ +#ifndef USERLISTFORM_H +#define USERLISTFORM_H + +#include +#include +#include "utils/SettingConfig.h" + +namespace Ui { +class UserListForm; +} + +class UserListForm : public QWidget +{ + Q_OBJECT + +public: + explicit UserListForm(QWidget *parent = nullptr); + ~UserListForm(); + +private: + Ui::UserListForm *ui; +}; + +#endif // USERLISTFORM_H diff --git a/UserListForm.ui b/UserListForm.ui new file mode 100644 index 0000000..59e2237 --- /dev/null +++ b/UserListForm.ui @@ -0,0 +1,332 @@ + + + UserListForm + + + + 0 + 0 + 960 + 600 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + 15 + + + 15 + + + 15 + + + 15 + + + + + ... + + + + :/images/back.png:/images/back.png + + + + 52 + 52 + + + + + + + + 人员列表 + + + Qt::AlignCenter + + + + + + + ... + + + + :/images/home.png:/images/home.png + + + + 52 + 52 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + 请输入姓名 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 1 / 1 + + + + + + + + + + ... + + + + :/images/btnPageFirst.png:/images/btnPageFirst.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPagePre.png:/images/btnPagePre.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageNext.png:/images/btnPageNext.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageLast.png:/images/btnPageLast.png + + + + 36 + 36 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + diff --git a/images/back.png b/images/back.png new file mode 100644 index 0000000..1419d0b --- /dev/null +++ b/images/back.png Binary files differ diff --git a/images/btnPageFirst.png b/images/btnPageFirst.png new file mode 100644 index 0000000..3759e8c --- /dev/null +++ b/images/btnPageFirst.png Binary files differ diff --git a/images/btnPageLast.png b/images/btnPageLast.png new file mode 100644 index 0000000..89eb51d --- /dev/null +++ b/images/btnPageLast.png Binary files differ diff --git a/images/btnPageNext.png b/images/btnPageNext.png new file mode 100644 index 0000000..4de6904 --- /dev/null +++ b/images/btnPageNext.png Binary files differ diff --git a/images/btnPagePre.png b/images/btnPagePre.png new file mode 100644 index 0000000..badfa15 --- /dev/null +++ b/images/btnPagePre.png Binary files differ diff --git a/images/home.png b/images/home.png new file mode 100644 index 0000000..f63d3e3 --- /dev/null +++ b/images/home.png Binary files differ diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/StartupForm.ui b/StartupForm.ui index 1a8c5b2..afb610f 100644 --- a/StartupForm.ui +++ b/StartupForm.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 600 + 1280 + 800 @@ -15,14 +15,14 @@ - + Qt::Vertical - 20 - 40 + 17 + 166 @@ -48,40 +48,118 @@ - + Qt::Vertical - 20 - 40 + 17 + 167 - - - TextLabel - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 用户 + + + + :/images/user.png:/images/user.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设置 + + + + :/images/setting.png:/images/setting.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + Qt::Vertical - 20 - 40 + 17 + 166 - + + + diff --git a/UserListForm.cpp b/UserListForm.cpp new file mode 100644 index 0000000..4527aff --- /dev/null +++ b/UserListForm.cpp @@ -0,0 +1,31 @@ +#include "UserListForm.h" +#include "ui_UserListForm.h" + +UserListForm::UserListForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserListForm) +{ + ui->setupUi(this); + + // 加载css文件设置控件样式 + QFile file(QApplication::applicationDirPath() + "/qss/userList.css"); + if (file.open(QFile::ReadOnly)) + { + QString qssStr = QLatin1String(file.readAll()); + this->setStyleSheet(qssStr); + file.close(); + } + + // 设置弹簧的尺寸 + ui->vsContentTop->changeSize(0, 20); + ui->vsTableTop->changeSize(0, 20); + ui->hsCondRight->changeSize(660, 0); + + ui->hsPageRight->changeSize(100, 0); + ui->vsContentBottom->changeSize(0, 40); +} + +UserListForm::~UserListForm() +{ + delete ui; +} diff --git a/UserListForm.h b/UserListForm.h new file mode 100644 index 0000000..f6efc2f --- /dev/null +++ b/UserListForm.h @@ -0,0 +1,24 @@ +#ifndef USERLISTFORM_H +#define USERLISTFORM_H + +#include +#include +#include "utils/SettingConfig.h" + +namespace Ui { +class UserListForm; +} + +class UserListForm : public QWidget +{ + Q_OBJECT + +public: + explicit UserListForm(QWidget *parent = nullptr); + ~UserListForm(); + +private: + Ui::UserListForm *ui; +}; + +#endif // USERLISTFORM_H diff --git a/UserListForm.ui b/UserListForm.ui new file mode 100644 index 0000000..59e2237 --- /dev/null +++ b/UserListForm.ui @@ -0,0 +1,332 @@ + + + UserListForm + + + + 0 + 0 + 960 + 600 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + 15 + + + 15 + + + 15 + + + 15 + + + + + ... + + + + :/images/back.png:/images/back.png + + + + 52 + 52 + + + + + + + + 人员列表 + + + Qt::AlignCenter + + + + + + + ... + + + + :/images/home.png:/images/home.png + + + + 52 + 52 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + 请输入姓名 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 1 / 1 + + + + + + + + + + ... + + + + :/images/btnPageFirst.png:/images/btnPageFirst.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPagePre.png:/images/btnPagePre.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageNext.png:/images/btnPageNext.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageLast.png:/images/btnPageLast.png + + + + 36 + 36 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + diff --git a/images/back.png b/images/back.png new file mode 100644 index 0000000..1419d0b --- /dev/null +++ b/images/back.png Binary files differ diff --git a/images/btnPageFirst.png b/images/btnPageFirst.png new file mode 100644 index 0000000..3759e8c --- /dev/null +++ b/images/btnPageFirst.png Binary files differ diff --git a/images/btnPageLast.png b/images/btnPageLast.png new file mode 100644 index 0000000..89eb51d --- /dev/null +++ b/images/btnPageLast.png Binary files differ diff --git a/images/btnPageNext.png b/images/btnPageNext.png new file mode 100644 index 0000000..4de6904 --- /dev/null +++ b/images/btnPageNext.png Binary files differ diff --git a/images/btnPagePre.png b/images/btnPagePre.png new file mode 100644 index 0000000..badfa15 --- /dev/null +++ b/images/btnPagePre.png Binary files differ diff --git a/images/home.png b/images/home.png new file mode 100644 index 0000000..f63d3e3 --- /dev/null +++ b/images/home.png Binary files differ diff --git a/images/setting.png b/images/setting.png new file mode 100644 index 0000000..62ff2eb --- /dev/null +++ b/images/setting.png Binary files differ diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/StartupForm.ui b/StartupForm.ui index 1a8c5b2..afb610f 100644 --- a/StartupForm.ui +++ b/StartupForm.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 600 + 1280 + 800 @@ -15,14 +15,14 @@ - + Qt::Vertical - 20 - 40 + 17 + 166 @@ -48,40 +48,118 @@ - + Qt::Vertical - 20 - 40 + 17 + 167 - - - TextLabel - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 用户 + + + + :/images/user.png:/images/user.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设置 + + + + :/images/setting.png:/images/setting.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + Qt::Vertical - 20 - 40 + 17 + 166 - + + + diff --git a/UserListForm.cpp b/UserListForm.cpp new file mode 100644 index 0000000..4527aff --- /dev/null +++ b/UserListForm.cpp @@ -0,0 +1,31 @@ +#include "UserListForm.h" +#include "ui_UserListForm.h" + +UserListForm::UserListForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserListForm) +{ + ui->setupUi(this); + + // 加载css文件设置控件样式 + QFile file(QApplication::applicationDirPath() + "/qss/userList.css"); + if (file.open(QFile::ReadOnly)) + { + QString qssStr = QLatin1String(file.readAll()); + this->setStyleSheet(qssStr); + file.close(); + } + + // 设置弹簧的尺寸 + ui->vsContentTop->changeSize(0, 20); + ui->vsTableTop->changeSize(0, 20); + ui->hsCondRight->changeSize(660, 0); + + ui->hsPageRight->changeSize(100, 0); + ui->vsContentBottom->changeSize(0, 40); +} + +UserListForm::~UserListForm() +{ + delete ui; +} diff --git a/UserListForm.h b/UserListForm.h new file mode 100644 index 0000000..f6efc2f --- /dev/null +++ b/UserListForm.h @@ -0,0 +1,24 @@ +#ifndef USERLISTFORM_H +#define USERLISTFORM_H + +#include +#include +#include "utils/SettingConfig.h" + +namespace Ui { +class UserListForm; +} + +class UserListForm : public QWidget +{ + Q_OBJECT + +public: + explicit UserListForm(QWidget *parent = nullptr); + ~UserListForm(); + +private: + Ui::UserListForm *ui; +}; + +#endif // USERLISTFORM_H diff --git a/UserListForm.ui b/UserListForm.ui new file mode 100644 index 0000000..59e2237 --- /dev/null +++ b/UserListForm.ui @@ -0,0 +1,332 @@ + + + UserListForm + + + + 0 + 0 + 960 + 600 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + 15 + + + 15 + + + 15 + + + 15 + + + + + ... + + + + :/images/back.png:/images/back.png + + + + 52 + 52 + + + + + + + + 人员列表 + + + Qt::AlignCenter + + + + + + + ... + + + + :/images/home.png:/images/home.png + + + + 52 + 52 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + 请输入姓名 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 1 / 1 + + + + + + + + + + ... + + + + :/images/btnPageFirst.png:/images/btnPageFirst.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPagePre.png:/images/btnPagePre.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageNext.png:/images/btnPageNext.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageLast.png:/images/btnPageLast.png + + + + 36 + 36 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + diff --git a/images/back.png b/images/back.png new file mode 100644 index 0000000..1419d0b --- /dev/null +++ b/images/back.png Binary files differ diff --git a/images/btnPageFirst.png b/images/btnPageFirst.png new file mode 100644 index 0000000..3759e8c --- /dev/null +++ b/images/btnPageFirst.png Binary files differ diff --git a/images/btnPageLast.png b/images/btnPageLast.png new file mode 100644 index 0000000..89eb51d --- /dev/null +++ b/images/btnPageLast.png Binary files differ diff --git a/images/btnPageNext.png b/images/btnPageNext.png new file mode 100644 index 0000000..4de6904 --- /dev/null +++ b/images/btnPageNext.png Binary files differ diff --git a/images/btnPagePre.png b/images/btnPagePre.png new file mode 100644 index 0000000..badfa15 --- /dev/null +++ b/images/btnPagePre.png Binary files differ diff --git a/images/home.png b/images/home.png new file mode 100644 index 0000000..f63d3e3 --- /dev/null +++ b/images/home.png Binary files differ diff --git a/images/setting.png b/images/setting.png new file mode 100644 index 0000000..62ff2eb --- /dev/null +++ b/images/setting.png Binary files differ diff --git a/images/user.png b/images/user.png new file mode 100644 index 0000000..6cc248e --- /dev/null +++ b/images/user.png Binary files differ diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/StartupForm.ui b/StartupForm.ui index 1a8c5b2..afb610f 100644 --- a/StartupForm.ui +++ b/StartupForm.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 600 + 1280 + 800 @@ -15,14 +15,14 @@ - + Qt::Vertical - 20 - 40 + 17 + 166 @@ -48,40 +48,118 @@ - + Qt::Vertical - 20 - 40 + 17 + 167 - - - TextLabel - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 用户 + + + + :/images/user.png:/images/user.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设置 + + + + :/images/setting.png:/images/setting.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + Qt::Vertical - 20 - 40 + 17 + 166 - + + + diff --git a/UserListForm.cpp b/UserListForm.cpp new file mode 100644 index 0000000..4527aff --- /dev/null +++ b/UserListForm.cpp @@ -0,0 +1,31 @@ +#include "UserListForm.h" +#include "ui_UserListForm.h" + +UserListForm::UserListForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserListForm) +{ + ui->setupUi(this); + + // 加载css文件设置控件样式 + QFile file(QApplication::applicationDirPath() + "/qss/userList.css"); + if (file.open(QFile::ReadOnly)) + { + QString qssStr = QLatin1String(file.readAll()); + this->setStyleSheet(qssStr); + file.close(); + } + + // 设置弹簧的尺寸 + ui->vsContentTop->changeSize(0, 20); + ui->vsTableTop->changeSize(0, 20); + ui->hsCondRight->changeSize(660, 0); + + ui->hsPageRight->changeSize(100, 0); + ui->vsContentBottom->changeSize(0, 40); +} + +UserListForm::~UserListForm() +{ + delete ui; +} diff --git a/UserListForm.h b/UserListForm.h new file mode 100644 index 0000000..f6efc2f --- /dev/null +++ b/UserListForm.h @@ -0,0 +1,24 @@ +#ifndef USERLISTFORM_H +#define USERLISTFORM_H + +#include +#include +#include "utils/SettingConfig.h" + +namespace Ui { +class UserListForm; +} + +class UserListForm : public QWidget +{ + Q_OBJECT + +public: + explicit UserListForm(QWidget *parent = nullptr); + ~UserListForm(); + +private: + Ui::UserListForm *ui; +}; + +#endif // USERLISTFORM_H diff --git a/UserListForm.ui b/UserListForm.ui new file mode 100644 index 0000000..59e2237 --- /dev/null +++ b/UserListForm.ui @@ -0,0 +1,332 @@ + + + UserListForm + + + + 0 + 0 + 960 + 600 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + 15 + + + 15 + + + 15 + + + 15 + + + + + ... + + + + :/images/back.png:/images/back.png + + + + 52 + 52 + + + + + + + + 人员列表 + + + Qt::AlignCenter + + + + + + + ... + + + + :/images/home.png:/images/home.png + + + + 52 + 52 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + 请输入姓名 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 1 / 1 + + + + + + + + + + ... + + + + :/images/btnPageFirst.png:/images/btnPageFirst.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPagePre.png:/images/btnPagePre.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageNext.png:/images/btnPageNext.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageLast.png:/images/btnPageLast.png + + + + 36 + 36 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + diff --git a/images/back.png b/images/back.png new file mode 100644 index 0000000..1419d0b --- /dev/null +++ b/images/back.png Binary files differ diff --git a/images/btnPageFirst.png b/images/btnPageFirst.png new file mode 100644 index 0000000..3759e8c --- /dev/null +++ b/images/btnPageFirst.png Binary files differ diff --git a/images/btnPageLast.png b/images/btnPageLast.png new file mode 100644 index 0000000..89eb51d --- /dev/null +++ b/images/btnPageLast.png Binary files differ diff --git a/images/btnPageNext.png b/images/btnPageNext.png new file mode 100644 index 0000000..4de6904 --- /dev/null +++ b/images/btnPageNext.png Binary files differ diff --git a/images/btnPagePre.png b/images/btnPagePre.png new file mode 100644 index 0000000..badfa15 --- /dev/null +++ b/images/btnPagePre.png Binary files differ diff --git a/images/home.png b/images/home.png new file mode 100644 index 0000000..f63d3e3 --- /dev/null +++ b/images/home.png Binary files differ diff --git a/images/setting.png b/images/setting.png new file mode 100644 index 0000000..62ff2eb --- /dev/null +++ b/images/setting.png Binary files differ diff --git a/images/user.png b/images/user.png new file mode 100644 index 0000000..6cc248e --- /dev/null +++ b/images/user.png Binary files differ diff --git a/qss/startup.css b/qss/startup.css index bfad9df..9c9b4d6 100644 --- a/qss/startup.css +++ b/qss/startup.css @@ -9,4 +9,12 @@ QLabel#labTime { font-size: 100px; -} \ No newline at end of file +} + +QToolButton { + color: #6868A6; + font-family: "Microsoft YaHei"; + font-size: 48px; + background: transparent; + border-style: none; +} diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/StartupForm.ui b/StartupForm.ui index 1a8c5b2..afb610f 100644 --- a/StartupForm.ui +++ b/StartupForm.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 600 + 1280 + 800 @@ -15,14 +15,14 @@ - + Qt::Vertical - 20 - 40 + 17 + 166 @@ -48,40 +48,118 @@ - + Qt::Vertical - 20 - 40 + 17 + 167 - - - TextLabel - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 用户 + + + + :/images/user.png:/images/user.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设置 + + + + :/images/setting.png:/images/setting.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + Qt::Vertical - 20 - 40 + 17 + 166 - + + + diff --git a/UserListForm.cpp b/UserListForm.cpp new file mode 100644 index 0000000..4527aff --- /dev/null +++ b/UserListForm.cpp @@ -0,0 +1,31 @@ +#include "UserListForm.h" +#include "ui_UserListForm.h" + +UserListForm::UserListForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserListForm) +{ + ui->setupUi(this); + + // 加载css文件设置控件样式 + QFile file(QApplication::applicationDirPath() + "/qss/userList.css"); + if (file.open(QFile::ReadOnly)) + { + QString qssStr = QLatin1String(file.readAll()); + this->setStyleSheet(qssStr); + file.close(); + } + + // 设置弹簧的尺寸 + ui->vsContentTop->changeSize(0, 20); + ui->vsTableTop->changeSize(0, 20); + ui->hsCondRight->changeSize(660, 0); + + ui->hsPageRight->changeSize(100, 0); + ui->vsContentBottom->changeSize(0, 40); +} + +UserListForm::~UserListForm() +{ + delete ui; +} diff --git a/UserListForm.h b/UserListForm.h new file mode 100644 index 0000000..f6efc2f --- /dev/null +++ b/UserListForm.h @@ -0,0 +1,24 @@ +#ifndef USERLISTFORM_H +#define USERLISTFORM_H + +#include +#include +#include "utils/SettingConfig.h" + +namespace Ui { +class UserListForm; +} + +class UserListForm : public QWidget +{ + Q_OBJECT + +public: + explicit UserListForm(QWidget *parent = nullptr); + ~UserListForm(); + +private: + Ui::UserListForm *ui; +}; + +#endif // USERLISTFORM_H diff --git a/UserListForm.ui b/UserListForm.ui new file mode 100644 index 0000000..59e2237 --- /dev/null +++ b/UserListForm.ui @@ -0,0 +1,332 @@ + + + UserListForm + + + + 0 + 0 + 960 + 600 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + 15 + + + 15 + + + 15 + + + 15 + + + + + ... + + + + :/images/back.png:/images/back.png + + + + 52 + 52 + + + + + + + + 人员列表 + + + Qt::AlignCenter + + + + + + + ... + + + + :/images/home.png:/images/home.png + + + + 52 + 52 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + 请输入姓名 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 1 / 1 + + + + + + + + + + ... + + + + :/images/btnPageFirst.png:/images/btnPageFirst.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPagePre.png:/images/btnPagePre.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageNext.png:/images/btnPageNext.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageLast.png:/images/btnPageLast.png + + + + 36 + 36 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + diff --git a/images/back.png b/images/back.png new file mode 100644 index 0000000..1419d0b --- /dev/null +++ b/images/back.png Binary files differ diff --git a/images/btnPageFirst.png b/images/btnPageFirst.png new file mode 100644 index 0000000..3759e8c --- /dev/null +++ b/images/btnPageFirst.png Binary files differ diff --git a/images/btnPageLast.png b/images/btnPageLast.png new file mode 100644 index 0000000..89eb51d --- /dev/null +++ b/images/btnPageLast.png Binary files differ diff --git a/images/btnPageNext.png b/images/btnPageNext.png new file mode 100644 index 0000000..4de6904 --- /dev/null +++ b/images/btnPageNext.png Binary files differ diff --git a/images/btnPagePre.png b/images/btnPagePre.png new file mode 100644 index 0000000..badfa15 --- /dev/null +++ b/images/btnPagePre.png Binary files differ diff --git a/images/home.png b/images/home.png new file mode 100644 index 0000000..f63d3e3 --- /dev/null +++ b/images/home.png Binary files differ diff --git a/images/setting.png b/images/setting.png new file mode 100644 index 0000000..62ff2eb --- /dev/null +++ b/images/setting.png Binary files differ diff --git a/images/user.png b/images/user.png new file mode 100644 index 0000000..6cc248e --- /dev/null +++ b/images/user.png Binary files differ diff --git a/qss/startup.css b/qss/startup.css index bfad9df..9c9b4d6 100644 --- a/qss/startup.css +++ b/qss/startup.css @@ -9,4 +9,12 @@ QLabel#labTime { font-size: 100px; -} \ No newline at end of file +} + +QToolButton { + color: #6868A6; + font-family: "Microsoft YaHei"; + font-size: 48px; + background: transparent; + border-style: none; +} diff --git a/qss/userList.css b/qss/userList.css new file mode 100644 index 0000000..d633d70 --- /dev/null +++ b/qss/userList.css @@ -0,0 +1,54 @@ +QLabel { + color: #6868A6; + font-family: "Microsoft YaHei"; +} + +QLabel#labUserListTitle { + font-size: 52px; + color: #FFFFFF; +} + +QWidget#widgetTitle { + background: #6868A6; +} + +QToolButton { + font-size: 48px; + background: transparent; + border-style: none; +} + +QLineEdit#inputName { + background: #6868A6; + border-radius: 8px; + font-family: "Microsoft YaHei"; + font-size: 28px; + padding: 6px; + color: #CCCCCC; +} + +QComboBox#selectDept { + background: #6868A6; + border-radius: 8px; + font-family: "Microsoft YaHei"; + font-size: 28px; + padding: 6px; + color: #CCCCCC; + width: 100px; +} + +QTableView { + margin: 0 100px; + border: 2px solid #5F1BC6; + border-radius: 6px; +} + +QWidget#widgetPageBtn { + background: #6868A6; + border-radius: 6px; +} + +QLabel#labCurrPage { + font-size: 24px; + margin-right: 15px; +} \ No newline at end of file diff --git a/CasicBioRecNew.pro b/CasicBioRecNew.pro index 407d909..c3bbf38 100644 --- a/CasicBioRecNew.pro +++ b/CasicBioRecNew.pro @@ -20,15 +20,24 @@ SOURCES += main.cpp SOURCES += CasicBioRecWin.cpp SOURCES += StartupForm.cpp +SOURCES += UserListForm.cpp +SOURCES += SettingForm.cpp HEADERS += CasicBioRecWin.h HEADERS += StartupForm.h +HEADERS += UserListForm.h +HEADERS += SettingForm.h FORMS += CasicBioRecWin.ui FORMS += StartupForm.ui +FORMS += UserListForm.ui +FORMS += SettingForm.ui DISTFILES += conf/config.ini DISTFILES += qss/startup.css +DISTFILES += qss/userList.css + +RESOURCES += resource.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/CasicBioRecWin.cpp b/CasicBioRecWin.cpp index dff879e..e3c2325 100644 --- a/CasicBioRecWin.cpp +++ b/CasicBioRecWin.cpp @@ -17,8 +17,7 @@ // 通过调色板的颜色来设置窗口的统一背景色 qApp->setPalette(QPalette(QColor(SettingConfig::getInstance().WINDOW_BACKGROUND_COLOR))); - startForm = new StartupForm(this); - this->ui->stacked->addWidget(startForm); + this->initFormsPtr(); } CasicBioRecWin::~CasicBioRecWin() @@ -26,13 +25,45 @@ delete ui; } -void QWidget::keyPressEvent(QKeyEvent *event) +void CasicBioRecWin::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Escape: QTimer::singleShot(100, qApp, SLOT(quit())); -// default: -// QWidget::keyPressEvent(event); + default: + QWidget::keyPressEvent(event); } } + +void CasicBioRecWin::backToStandByForm() +{ + ui->stacked->setCurrentWidget(startForm); +} +void CasicBioRecWin::switchToUserListForm() +{ + ui->stacked->setCurrentWidget(userListForm); +} +void CasicBioRecWin::switchToSettingForm() +{ + +} + +void CasicBioRecWin::initFormsPtr() +{ + startForm = new StartupForm(this); + userListForm = new UserListForm(this); + settingForm = new SettingForm(this); + + ui->stacked->addWidget(startForm); + ui->stacked->addWidget(userListForm); + ui->stacked->addWidget(settingForm); + + ui->stacked->setCurrentIndex(1); + + // 绑定按钮函数 + connect(startForm, &StartupForm::switchToUserListForm, + this, &CasicBioRecWin::switchToUserListForm); + connect(startForm, &StartupForm::switchToSettingForm, + this, &CasicBioRecWin::switchToSettingForm); +} diff --git a/CasicBioRecWin.h b/CasicBioRecWin.h index 3609bfa..d533937 100644 --- a/CasicBioRecWin.h +++ b/CasicBioRecWin.h @@ -7,6 +7,8 @@ //#include "utils/easyloggingpp/easylogging++.h" #include "StartupForm.h" +#include "UserListForm.h" +#include "SettingForm.h" QT_BEGIN_NAMESPACE namespace Ui { class CasicBioRecWin; } @@ -20,10 +22,20 @@ CasicBioRecWin(QWidget *parent = nullptr); ~CasicBioRecWin(); +public slots: + void backToStandByForm(); + void switchToUserListForm(); + void switchToSettingForm(); + private: Ui::CasicBioRecWin *ui; StartupForm * startForm; + UserListForm * userListForm; + SettingForm * settingForm; + + void keyPressEvent(QKeyEvent *event); + void initFormsPtr(); }; #endif // CASICBIORECWIN_H diff --git a/SettingForm.cpp b/SettingForm.cpp new file mode 100644 index 0000000..149e4d8 --- /dev/null +++ b/SettingForm.cpp @@ -0,0 +1,14 @@ +#include "SettingForm.h" +#include "ui_SettingForm.h" + +SettingForm::SettingForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::SettingForm) +{ + ui->setupUi(this); +} + +SettingForm::~SettingForm() +{ + delete ui; +} diff --git a/SettingForm.h b/SettingForm.h new file mode 100644 index 0000000..9a8eafa --- /dev/null +++ b/SettingForm.h @@ -0,0 +1,22 @@ +#ifndef SETTINGFORM_H +#define SETTINGFORM_H + +#include + +namespace Ui { +class SettingForm; +} + +class SettingForm : public QWidget +{ + Q_OBJECT + +public: + explicit SettingForm(QWidget *parent = nullptr); + ~SettingForm(); + +private: + Ui::SettingForm *ui; +}; + +#endif // SETTINGFORM_H diff --git a/SettingForm.ui b/SettingForm.ui new file mode 100644 index 0000000..7816547 --- /dev/null +++ b/SettingForm.ui @@ -0,0 +1,21 @@ + + + + + SettingForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/StartupForm.cpp b/StartupForm.cpp index 7fdf854..0ea559c 100644 --- a/StartupForm.cpp +++ b/StartupForm.cpp @@ -7,6 +7,10 @@ { ui->setupUi(this); + // 初始化时更新显示的时间 + this->updateDateAndTime(); + + // 加载css文件设置控件样式 QFile file(QApplication::applicationDirPath() + "/qss/startup.css"); if (file.open(QFile::ReadOnly)) { @@ -15,7 +19,11 @@ file.close(); } - this->updateDateAndTime(); + // 设置弹簧的高度和宽度 + ui->vsTop->changeSize(0, 200); + ui->vsMidd->changeSize(0, 100); + ui->hsLeft->changeSize(400, 0); + ui->hsMidd->changeSize(150, 0); // 初始化更新界面的定时器 // 每分钟执行一次 @@ -34,3 +42,13 @@ ui->labTime->setText(QTime::currentTime().toString("HH:mm:ss")); ui->labDate->setText(QDate::currentDate().toString("yyyy-MM-dd")); } + +void StartupForm::on_btnUser_clicked() +{ + emit switchToUserListForm(); +} + +void StartupForm::on_btnSetting_clicked() +{ + emit switchToUserListForm(); +} diff --git a/StartupForm.h b/StartupForm.h index 2204b1a..5d07579 100644 --- a/StartupForm.h +++ b/StartupForm.h @@ -26,6 +26,12 @@ private slots: void updateDateAndTime(); + void on_btnUser_clicked(); + void on_btnSetting_clicked(); + +signals: + void switchToUserListForm(); + void switchToSettingForm(); }; #endif // STARTUPFORM_H diff --git a/StartupForm.ui b/StartupForm.ui index 1a8c5b2..afb610f 100644 --- a/StartupForm.ui +++ b/StartupForm.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 600 + 1280 + 800 @@ -15,14 +15,14 @@ - + Qt::Vertical - 20 - 40 + 17 + 166 @@ -48,40 +48,118 @@ - + Qt::Vertical - 20 - 40 + 17 + 167 - - - TextLabel - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 用户 + + + + :/images/user.png:/images/user.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设置 + + + + :/images/setting.png:/images/setting.png + + + + 164 + 164 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + Qt::Vertical - 20 - 40 + 17 + 166 - + + + diff --git a/UserListForm.cpp b/UserListForm.cpp new file mode 100644 index 0000000..4527aff --- /dev/null +++ b/UserListForm.cpp @@ -0,0 +1,31 @@ +#include "UserListForm.h" +#include "ui_UserListForm.h" + +UserListForm::UserListForm(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserListForm) +{ + ui->setupUi(this); + + // 加载css文件设置控件样式 + QFile file(QApplication::applicationDirPath() + "/qss/userList.css"); + if (file.open(QFile::ReadOnly)) + { + QString qssStr = QLatin1String(file.readAll()); + this->setStyleSheet(qssStr); + file.close(); + } + + // 设置弹簧的尺寸 + ui->vsContentTop->changeSize(0, 20); + ui->vsTableTop->changeSize(0, 20); + ui->hsCondRight->changeSize(660, 0); + + ui->hsPageRight->changeSize(100, 0); + ui->vsContentBottom->changeSize(0, 40); +} + +UserListForm::~UserListForm() +{ + delete ui; +} diff --git a/UserListForm.h b/UserListForm.h new file mode 100644 index 0000000..f6efc2f --- /dev/null +++ b/UserListForm.h @@ -0,0 +1,24 @@ +#ifndef USERLISTFORM_H +#define USERLISTFORM_H + +#include +#include +#include "utils/SettingConfig.h" + +namespace Ui { +class UserListForm; +} + +class UserListForm : public QWidget +{ + Q_OBJECT + +public: + explicit UserListForm(QWidget *parent = nullptr); + ~UserListForm(); + +private: + Ui::UserListForm *ui; +}; + +#endif // USERLISTFORM_H diff --git a/UserListForm.ui b/UserListForm.ui new file mode 100644 index 0000000..59e2237 --- /dev/null +++ b/UserListForm.ui @@ -0,0 +1,332 @@ + + + UserListForm + + + + 0 + 0 + 960 + 600 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + 15 + + + 15 + + + 15 + + + 15 + + + + + ... + + + + :/images/back.png:/images/back.png + + + + 52 + 52 + + + + + + + + 人员列表 + + + Qt::AlignCenter + + + + + + + ... + + + + :/images/home.png:/images/home.png + + + + 52 + 52 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + 请输入姓名 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 1 / 1 + + + + + + + + + + ... + + + + :/images/btnPageFirst.png:/images/btnPageFirst.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPagePre.png:/images/btnPagePre.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageNext.png:/images/btnPageNext.png + + + + 36 + 36 + + + + + + + + ... + + + + :/images/btnPageLast.png:/images/btnPageLast.png + + + + 36 + 36 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + diff --git a/images/back.png b/images/back.png new file mode 100644 index 0000000..1419d0b --- /dev/null +++ b/images/back.png Binary files differ diff --git a/images/btnPageFirst.png b/images/btnPageFirst.png new file mode 100644 index 0000000..3759e8c --- /dev/null +++ b/images/btnPageFirst.png Binary files differ diff --git a/images/btnPageLast.png b/images/btnPageLast.png new file mode 100644 index 0000000..89eb51d --- /dev/null +++ b/images/btnPageLast.png Binary files differ diff --git a/images/btnPageNext.png b/images/btnPageNext.png new file mode 100644 index 0000000..4de6904 --- /dev/null +++ b/images/btnPageNext.png Binary files differ diff --git a/images/btnPagePre.png b/images/btnPagePre.png new file mode 100644 index 0000000..badfa15 --- /dev/null +++ b/images/btnPagePre.png Binary files differ diff --git a/images/home.png b/images/home.png new file mode 100644 index 0000000..f63d3e3 --- /dev/null +++ b/images/home.png Binary files differ diff --git a/images/setting.png b/images/setting.png new file mode 100644 index 0000000..62ff2eb --- /dev/null +++ b/images/setting.png Binary files differ diff --git a/images/user.png b/images/user.png new file mode 100644 index 0000000..6cc248e --- /dev/null +++ b/images/user.png Binary files differ diff --git a/qss/startup.css b/qss/startup.css index bfad9df..9c9b4d6 100644 --- a/qss/startup.css +++ b/qss/startup.css @@ -9,4 +9,12 @@ QLabel#labTime { font-size: 100px; -} \ No newline at end of file +} + +QToolButton { + color: #6868A6; + font-family: "Microsoft YaHei"; + font-size: 48px; + background: transparent; + border-style: none; +} diff --git a/qss/userList.css b/qss/userList.css new file mode 100644 index 0000000..d633d70 --- /dev/null +++ b/qss/userList.css @@ -0,0 +1,54 @@ +QLabel { + color: #6868A6; + font-family: "Microsoft YaHei"; +} + +QLabel#labUserListTitle { + font-size: 52px; + color: #FFFFFF; +} + +QWidget#widgetTitle { + background: #6868A6; +} + +QToolButton { + font-size: 48px; + background: transparent; + border-style: none; +} + +QLineEdit#inputName { + background: #6868A6; + border-radius: 8px; + font-family: "Microsoft YaHei"; + font-size: 28px; + padding: 6px; + color: #CCCCCC; +} + +QComboBox#selectDept { + background: #6868A6; + border-radius: 8px; + font-family: "Microsoft YaHei"; + font-size: 28px; + padding: 6px; + color: #CCCCCC; + width: 100px; +} + +QTableView { + margin: 0 100px; + border: 2px solid #5F1BC6; + border-radius: 6px; +} + +QWidget#widgetPageBtn { + background: #6868A6; + border-radius: 6px; +} + +QLabel#labCurrPage { + font-size: 24px; + margin-right: 15px; +} \ No newline at end of file diff --git a/resource.qrc b/resource.qrc new file mode 100644 index 0000000..56b9af0 --- /dev/null +++ b/resource.qrc @@ -0,0 +1,12 @@ + + + images/setting.png + images/user.png + images/back.png + images/home.png + images/btnPageFirst.png + images/btnPageLast.png + images/btnPageNext.png + images/btnPagePre.png + +