ExpertInfoWidget.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef EXPERTINFOWIDGET_H
  2. #define EXPERTINFOWIDGET_H
  3. #include <QDialog>
  4. class LineEdit;
  5. class PasswordLineEdit;
  6. class PushButton;
  7. class TextEdit;
  8. class DateTimeEdit;
  9. class QVBoxLayout;
  10. class QHBoxLayout;
  11. class QGridLayout;
  12. class QLabel;
  13. ///
  14. /// 专家信息页面
  15. class ExpertInfoWidget : public QWidget
  16. {
  17. Q_OBJECT
  18. public:
  19. typedef enum
  20. {
  21. Add, // 新增
  22. Update, // 编辑
  23. Read, // 查看
  24. } Mode;
  25. Q_ENUM(Mode)
  26. explicit ExpertInfoWidget(QWidget *parent = nullptr);
  27. void showEvent(QShowEvent *event) override;
  28. void hideEvent(QHideEvent *event) override;
  29. void setMode(Mode mode);
  30. void clearInputs();
  31. private:
  32. void initWindow();
  33. void initialize();
  34. void initLayout();
  35. void connectSignalsAndSlots();
  36. void updateState();
  37. void setDetailsHideen(bool hidden);
  38. void setEditable(bool editable);
  39. private slots:
  40. void slotConfirm();
  41. void slotCancel();
  42. signals:
  43. private:
  44. Mode m_mode = Add;
  45. QVBoxLayout *m_vBoxLayout = nullptr;
  46. QGridLayout *m_gridLayout = nullptr;
  47. QLabel *m_idLabel = nullptr;
  48. LineEdit *m_idLineEdit = nullptr;
  49. QLabel *m_passwordLabel = nullptr;
  50. PasswordLineEdit *m_passwordLineEdit = nullptr;
  51. QLabel *m_nameLabel = nullptr;
  52. LineEdit *m_nameLineEdit = nullptr;
  53. QLabel *m_companyLabel = nullptr;
  54. LineEdit *m_companyLineEdit = nullptr;
  55. QLabel *m_jobLabel = nullptr;
  56. LineEdit *m_jobLineEdit = nullptr;
  57. QLabel *m_majorLabel = nullptr;
  58. LineEdit *m_majorLineEdit = nullptr;
  59. QLabel *m_contactInfoLabel = nullptr;
  60. LineEdit *m_contactInfoLineEdit = nullptr;
  61. QLabel *m_timeLabel = nullptr;
  62. DateTimeEdit *m_timeLineEdit = nullptr;
  63. QLabel *m_noteLabel = nullptr;
  64. TextEdit *m_noteTextEdit = nullptr;
  65. QHBoxLayout *m_hBoxLayout = nullptr;
  66. PushButton *m_confirmButton = nullptr;
  67. PushButton *m_cancelButton = nullptr;
  68. };
  69. #endif // EXPERTINFOWIDGET_H