#ifndef EXPERTINFOWIDGET_H #define EXPERTINFOWIDGET_H #include class QFUser; class LineEdit; class PasswordLineEdit; class PushButton; class TextEdit; class DateTimeEdit; class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QLabel; /// /// 专家信息页面 class ExpertInfoWidget : public QWidget { Q_OBJECT public: typedef enum { Create, // 新增 Update, // 编辑 Info, // 查看 } Mode; Q_ENUM(Mode) explicit ExpertInfoWidget(QWidget *parent = nullptr); void showEvent(QShowEvent *event) override; void hideEvent(QHideEvent *event) override; void setMode(Mode mode); void clearInputs(); void setUser(QFUser *user); /// Create 模式下,构造新的 QFUser /// 其他模式下直接返回 m_user QFUser *user() const; private: void initWindow(); void initialize(); void initLayout(); void connectSignalsAndSlots(); void updateState(); void setDetailsHideen(bool hidden); void setEditable(bool editable); private slots: void slotConfirm(); void slotCancel(); signals: void sigConfirm(); private: Mode m_mode = Create; QVBoxLayout *m_vBoxLayout = nullptr; QGridLayout *m_gridLayout = nullptr; QLabel *m_idLabel = nullptr; LineEdit *m_idLineEdit = nullptr; QLabel *m_passwordLabel = nullptr; PasswordLineEdit *m_passwordLineEdit = nullptr; QLabel *m_nameLabel = nullptr; LineEdit *m_nameLineEdit = nullptr; QLabel *m_companyLabel = nullptr; LineEdit *m_companyLineEdit = nullptr; QLabel *m_jobLabel = nullptr; LineEdit *m_jobLineEdit = nullptr; QLabel *m_majorLabel = nullptr; LineEdit *m_majorLineEdit = nullptr; QLabel *m_contactInfoLabel = nullptr; LineEdit *m_contactInfoLineEdit = nullptr; QLabel *m_timeLabel = nullptr; DateTimeEdit *m_timeLineEdit = nullptr; QLabel *m_noteLabel = nullptr; TextEdit *m_noteTextEdit = nullptr; QHBoxLayout *m_hBoxLayout = nullptr; PushButton *m_confirmButton = nullptr; PushButton *m_cancelButton = nullptr; QFUser *m_user; }; #endif // EXPERTINFOWIDGET_H