123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- #ifndef PROJECTLISTWIDGET_H
- #define PROJECTLISTWIDGET_H
- #include <QWidget>
- 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<ProjectInfo *> 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<ProjectInfo *> m_projList;
- };
- #endif // PROJECTLISTWIDGET_H
|