calendardtedit.h 893 B

123456789101112131415161718192021222324252627282930
  1. #ifndef CALENDARDTEDIT_H
  2. #define CALENDARDTEDIT_H
  3. #include <QWidget>
  4. #include <QDateTimeEdit>
  5. class CalendarDTEdit : public QDateTimeEdit
  6. {
  7. Q_OBJECT
  8. public:
  9. explicit CalendarDTEdit(QWidget *parent = nullptr);
  10. virtual ~CalendarDTEdit();
  11. void SetCalendarAutoClose(bool value);
  12. void CloseCalendar();
  13. /* 手动触发日期选择弹框 */
  14. void triggerCalendarPopup();
  15. /* 设置手动禁止修改日期区域,只能使用弹窗,第二个参数设置点击日期是否会出现日期选择弹框 */
  16. void setManualDisableEdit(bool value, bool triggerPopup = false);
  17. signals:
  18. void sig_SetCurrentPage(int year, int month);
  19. protected:
  20. void mousePressEvent(QMouseEvent* e) override;
  21. bool eventFilter(QObject* watched, QEvent* event) override;
  22. private:
  23. QObject* m_pCalendar = nullptr;
  24. bool m_isPopup = false;
  25. };
  26. #endif // CALENDARDTEDIT_H