ExpertInfoWidget.h 2.2 KB

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