#ifndef HOMEVIEW_H #define HOMEVIEW_H #include class ProjectInfo; class CreateProjWidget; class ProjectListWidget; class PushButton; class LineEdit; class QVBoxLayout; class QHBoxLayout; class QLabel; /// /// \brief The HomeView class /// 首页 class HomeView : public QWidget { Q_OBJECT public: explicit HomeView(QWidget *parent = nullptr); void showEvent(QShowEvent *event) override; void hideEvent(QHideEvent *event) override; signals: void sigOpenProject(ProjectInfo *proj); void sigDeleteProject(ProjectInfo *proj); private: void initWidgets(); void initLayout(); void connectSignalsAndSlots(); void loadProjects(); int firstPage() const; // 首页页码 int finalPage() const; // 末页页码 private slots: void slotCreateProjClicked(); void slotSearchTextChanged(); void slotFilterClicked(); void slotProjInfoConfirmed(); void slotProjectInfo(ProjectInfo *proj); void slotOpenProject(ProjectInfo *proj); void slotDeleteProject(ProjectInfo *proj); void slotExportProject(ProjectInfo *proj); void slotPreviousClicked(); void slotNextClicked(); void slotFirstClicked(); void slotFinalClicked(); private: bool m_initilized = false; QVBoxLayout *m_layout = nullptr; QHBoxLayout *m_topLayout = nullptr; QHBoxLayout *m_pageLayout = nullptr; QLabel *m_title = nullptr; PushButton *m_create = nullptr; LineEdit *m_search = nullptr; PushButton *m_filter = nullptr; QLabel *m_totalLab = nullptr; // 共 123 条, 每页 20 条 QLabel *m_pageLab = nullptr; // 第 1/5 页 PushButton *m_previous = nullptr; // 上一页 PushButton *m_next = nullptr; // 下一页 PushButton *m_first = nullptr; // 首页 PushButton *m_final = nullptr; // 末页 ProjectListWidget *m_projListWidget = nullptr; CreateProjWidget *m_createProjWidget = nullptr; QList m_projList; int m_page = 1; // 页码 int m_pageSize = 20; // 每页条数 int m_total = 0; // 总数 }; #endif // HOMEVIEW_H