#ifndef TIMEPARTWIDGET_H #define TIMEPARTWIDGET_H #include class MyTimeDelegate; class QListWidgetItem; class QScrollBar; namespace Ui { class TimePartWidget; } class TimePartWidget : public QWidget { Q_OBJECT public: enum emSection { HOUR = 0, MINUTE = 1, SECOND = 2, MAX_SECTION }; public: explicit TimePartWidget(QWidget *parent = nullptr); TimePartWidget(emSection type, QWidget* parent = nullptr); ~TimePartWidget(); emSection GetType() const {return m_type;} void SetTime(const QDateTime& dt); void SetMaxWidth(int w); void ScrollToSelect(); protected: void enterEvent(QEvent* event) override; void leaveEvent(QEvent* event) override; signals: void sigItemClicked(QListWidgetItem* item); private: void InitListWidget(int total); void SelectListItem(int time); private: Ui::TimePartWidget *ui; emSection m_type; QScopedPointer m_delegate; QScopedPointer m_pListBar; }; #endif // TIMEPARTWIDGET_H