#ifndef PROJECTLISTWIDGET_H #define PROJECTLISTWIDGET_H #include class ProjectInfo; class PushButton; class ToolButton; class LineEdit; class TreeWidget; class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QLabel; class QListWidget; class QListWidgetItem; class ProjectListItemWidget : public QWidget { Q_OBJECT public: explicit ProjectListItemWidget(QWidget *parent = nullptr); void setProj(ProjectInfo *info); ProjectInfo *proj() const; signals: void sigInfo(); void sigOpen(); void sigDelete(); void sigExport(); private: void initWidgets(); void initLayout(); void connectSignalsAndSlots(); private: ProjectInfo *m_proj = nullptr; QLabel *m_name = nullptr; QLabel *m_time = nullptr; QLabel *m_taskLabel = nullptr; QLabel *m_task = nullptr; QLabel *m_typeLabel = nullptr; QLabel *m_type = nullptr; PushButton *m_info = nullptr; PushButton *m_open = nullptr; PushButton *m_delete = nullptr; PushButton *m_export = nullptr; QVBoxLayout *m_layout = nullptr; QHBoxLayout *m_nameLayout = nullptr; QHBoxLayout *m_taskLayout = nullptr; QHBoxLayout *m_typeLayout = nullptr; QHBoxLayout *m_buttonLayout = nullptr; }; /// 工程列表 class ProjectListWidget : public QWidget { Q_OBJECT public: explicit ProjectListWidget(QWidget *parent = nullptr); void setProjects(QList list); void showLast() const; void addProject(ProjectInfo *proj); void removeProject(ProjectInfo *proj); ProjectListItemWidget *widgetOfItem(QListWidgetItem *item) const; QListWidgetItem *itemOfWidget(ProjectListItemWidget *widget) const; signals: void sigInfo(ProjectInfo *project); void sigOpen(ProjectInfo *project); void sigDelete(ProjectInfo *project); void sigExport(ProjectInfo *project); private: void initWidgets(); void initLayout(); void connectSiganlsAndSlots(); private slots: void slotItemDoubleClicked(QListWidgetItem *item); void slotItemClicked(QListWidgetItem *item); void slotCurrentItemChanged(QListWidgetItem *current, QListWidgetItem *previous); void slotCurrentRowChanged(int currentRow); void slotItemSelectionChanged(); void slotInfo(); void slotOpen(); void slotDelete(); void slotExport(); signals: private: QVBoxLayout *m_vBoxLayout = nullptr; QListWidget *m_listWidget = nullptr; QList m_projList; }; #endif // PROJECTLISTWIDGET_H