CreateProjWidget.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #ifndef CREATEPROJWIDGET_H
  2. #define CREATEPROJWIDGET_H
  3. #include <QDialog>
  4. class ProjectInfo;
  5. class LineEdit;
  6. class CheckBox;
  7. class PushButton;
  8. class DateTimeEdit;
  9. class TextEdit;
  10. class QVBoxLayout;
  11. class QHBoxLayout;
  12. class QGridLayout;
  13. class QLabel;
  14. /// 创建工程页面
  15. class CreateProjWidget : public QDialog
  16. {
  17. Q_OBJECT
  18. public:
  19. typedef enum
  20. {
  21. Create, // 创建
  22. Update, // 编辑
  23. Info, // 查看
  24. } Mode;
  25. CreateProjWidget(QWidget *parent = nullptr);
  26. Mode mode() const;
  27. void setMode(Mode mode);
  28. void resetInputs();
  29. ProjectInfo *projInfo() const;
  30. ProjectInfo editedProjInfo() const;
  31. void setProjectInfo(ProjectInfo *info);
  32. signals:
  33. void signalCreate();
  34. private:
  35. void initWindow();
  36. void initWidgets();
  37. void initLayout();
  38. void connectSignalsAndSlots();
  39. void updateCreateButtonState();
  40. private slots:
  41. void slotTextChanged();
  42. void slotCheckBoxChanged();
  43. void slotCreateClicked();
  44. void slotCancelClicked();
  45. private:
  46. Mode m_mode = Create;
  47. ProjectInfo *m_projInfo = nullptr;
  48. // 项目概要
  49. QLabel *m_summary = nullptr; // 项目概要
  50. LineEdit *m_taskName = nullptr; // 任务名称
  51. DateTimeEdit *m_evalTime = nullptr; // 评估时间
  52. LineEdit *m_evalPurpose = nullptr; // 评估目的
  53. LineEdit *m_evalUnit = nullptr; // 评估单位
  54. LineEdit *m_evalCrew = nullptr; // 评估人员
  55. LineEdit *m_rank = nullptr; // 职称
  56. TextEdit *m_note = nullptr; // 备注
  57. QWidget *m_separator = nullptr; // 分隔线
  58. // 项目信息
  59. QLabel *m_nameLabel = nullptr;
  60. LineEdit *m_name = nullptr;
  61. QLabel *m_typeLabel = nullptr;
  62. CheckBox *m_type1 = nullptr;
  63. CheckBox *m_type2 = nullptr;
  64. CheckBox *m_type3 = nullptr;
  65. // 按钮
  66. PushButton *m_confirm = nullptr;
  67. PushButton *m_cancel = nullptr;
  68. // 布局
  69. QVBoxLayout *m_layout = nullptr;
  70. QVBoxLayout *m_summaryLayout = nullptr;
  71. QGridLayout *m_projLayout = nullptr;
  72. QHBoxLayout *m_btnLayout = nullptr;
  73. };
  74. #endif // CREATEPROJWIDGET_H