12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #ifndef TIMEPARTWIDGET_H
- #define TIMEPARTWIDGET_H
- #include <QWidget>
- 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();
- /* 设置QSS */
- void setQSS();
- 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<MyTimeDelegate> m_delegate;
- QScopedPointer<QScrollBar> m_pListBar;
- };
- #endif // TIMEPARTWIDGET_H
|