CreateProjWidget.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 projectInfo() const;
  30. void setProjectInfo(ProjectInfo *info);
  31. signals:
  32. void signalCreate();
  33. private:
  34. void initWindow();
  35. void initWidgets();
  36. void initLayout();
  37. void connectSignalsAndSlots();
  38. void updateCreateButtonState();
  39. private slots:
  40. void slotTextChanged();
  41. void slotCheckBoxChanged();
  42. void slotCreateClicked();
  43. void slotCancelClicked();
  44. private:
  45. Mode m_mode = Create;
  46. // 项目概要
  47. QLabel *m_summary = nullptr; // 项目概要
  48. LineEdit *m_taskName = nullptr; // 任务名称
  49. DateTimeEdit *m_evalTime = nullptr; // 评估时间
  50. LineEdit *m_evalPurpose = nullptr; // 评估目的
  51. LineEdit *m_evalUnit = nullptr; // 评估单位
  52. LineEdit *m_evalCrew = nullptr; // 评估人员
  53. LineEdit *m_rank = nullptr; // 职称
  54. TextEdit *m_note = nullptr; // 备注
  55. QWidget *m_separator = nullptr; // 分隔线
  56. // 项目信息
  57. QLabel *m_nameLabel = nullptr;
  58. LineEdit *m_name = nullptr;
  59. QLabel *m_typeLabel = nullptr;
  60. CheckBox *m_type1 = nullptr;
  61. CheckBox *m_type2 = nullptr;
  62. CheckBox *m_type3 = nullptr;
  63. // 按钮
  64. PushButton *m_confirm = nullptr;
  65. PushButton *m_cancel = nullptr;
  66. // 布局
  67. QVBoxLayout *m_layout = nullptr;
  68. QVBoxLayout *m_summaryLayout = nullptr;
  69. QGridLayout *m_projLayout = nullptr;
  70. QHBoxLayout *m_btnLayout = nullptr;
  71. };
  72. #endif // CREATEPROJWIDGET_H