38 lines
708 B
C++
38 lines
708 B
C++
#ifndef PAGEINDICATOR_H
|
|
#define PAGEINDICATOR_H
|
|
|
|
#include <QWidget>
|
|
|
|
class PageIndicator : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit PageIndicator(int pageCount = 3, QWidget *parent = nullptr);
|
|
~PageIndicator();
|
|
|
|
void setPageCount(int count);
|
|
void setCurrentPage(int page);
|
|
int currentPage() const { return m_currentPage; }
|
|
|
|
signals:
|
|
void pageClicked(int page);
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *event) override;
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
|
|
private:
|
|
int m_pageCount;
|
|
int m_currentPage;
|
|
|
|
// 指示器样式参数
|
|
int m_dotSize;
|
|
int m_selectedDotSize;
|
|
int m_dotSpacing;
|
|
QColor m_dotColor;
|
|
QColor m_selectedColor;
|
|
};
|
|
|
|
#endif // PAGEINDICATOR_H
|