CreateProjWidget.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 signalConfirm();
  34. private:
  35. void initWindow();
  36. void initWidgets();
  37. void initLayout();
  38. void connectSignalsAndSlots();
  39. private slots:
  40. void slotTextChanged();
  41. void slotCheckBoxChanged();
  42. void slotEditClicked();
  43. void slotConfirmClicked();
  44. void slotCancelClicked();
  45. private:
  46. Mode m_mode = Create;
  47. ProjectInfo *m_projInfo = nullptr;
  48. // 项目概要
  49. QLabel *m_summary = nullptr; // 项目概要
  50. LineEdit *m_task = nullptr; // 任务名称
  51. DateTimeEdit *m_time = nullptr; // 评估时间
  52. LineEdit *m_unit = nullptr; // 评估单位
  53. LineEdit *m_crew = nullptr; // 评估人员
  54. LineEdit *m_rank = nullptr; // 职称
  55. TextEdit *m_purpose = nullptr; // 评估目的
  56. TextEdit *m_note = nullptr; // 备注
  57. QLabel *m_taskLabel = nullptr;
  58. QLabel *m_timeLabel = nullptr;
  59. QLabel *m_unitLabel = nullptr;
  60. QLabel *m_crewLabel = nullptr;
  61. QLabel *m_rankLabel = nullptr;
  62. QLabel *m_purposeLabel = nullptr;
  63. QLabel *m_noteLabel = nullptr;
  64. QWidget *m_separator = nullptr; // 分隔线
  65. // 项目信息
  66. QLabel *m_projLabel = nullptr;
  67. LineEdit *m_proj = nullptr;
  68. QLabel *m_typeLabel = nullptr;
  69. CheckBox *m_type1 = nullptr;
  70. CheckBox *m_type2 = nullptr;
  71. CheckBox *m_type3 = nullptr;
  72. // 按钮
  73. PushButton *m_edit = nullptr;
  74. PushButton *m_confirm = nullptr;
  75. PushButton *m_cancel = nullptr;
  76. // 布局
  77. QVBoxLayout *m_layout = nullptr;
  78. QGridLayout *m_summaryLayout = nullptr;
  79. QGridLayout *m_projLayout = nullptr;
  80. QHBoxLayout *m_btnLayout = nullptr;
  81. };
  82. #endif // CREATEPROJWIDGET_H