ExpertInfoWidget.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. private:
  34. void initWindow();
  35. void initialize();
  36. void initLayout();
  37. void connectSignalsAndSlots();
  38. void updateState();
  39. void setDetailsHideen(bool hidden);
  40. void setEditable(bool editable);
  41. private slots:
  42. void slotConfirm();
  43. void slotCancel();
  44. signals:
  45. private:
  46. Mode m_mode = Create;
  47. QVBoxLayout *m_vBoxLayout = nullptr;
  48. QGridLayout *m_gridLayout = nullptr;
  49. QLabel *m_idLabel = nullptr;
  50. LineEdit *m_idLineEdit = nullptr;
  51. QLabel *m_passwordLabel = nullptr;
  52. PasswordLineEdit *m_passwordLineEdit = nullptr;
  53. QLabel *m_nameLabel = nullptr;
  54. LineEdit *m_nameLineEdit = nullptr;
  55. QLabel *m_companyLabel = nullptr;
  56. LineEdit *m_companyLineEdit = nullptr;
  57. QLabel *m_jobLabel = nullptr;
  58. LineEdit *m_jobLineEdit = nullptr;
  59. QLabel *m_majorLabel = nullptr;
  60. LineEdit *m_majorLineEdit = nullptr;
  61. QLabel *m_contactInfoLabel = nullptr;
  62. LineEdit *m_contactInfoLineEdit = nullptr;
  63. QLabel *m_timeLabel = nullptr;
  64. DateTimeEdit *m_timeLineEdit = nullptr;
  65. QLabel *m_noteLabel = nullptr;
  66. TextEdit *m_noteTextEdit = nullptr;
  67. QHBoxLayout *m_hBoxLayout = nullptr;
  68. PushButton *m_confirmButton = nullptr;
  69. PushButton *m_cancelButton = nullptr;
  70. QFUser *m_user;
  71. };
  72. #endif // EXPERTINFOWIDGET_H