xref: /OK3568_Linux_fs/app/forlinx/flapp/src/plugins/serialassistant/rollswitchwidget.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 #ifndef ROLLSWITCHWIDGET_H
2 #define ROLLSWITCHWIDGET_H
3 #include <QWidget>
4 
5 class RollSwitchWidget : public QWidget
6 {
7     Q_OBJECT
8 public:
9     explicit RollSwitchWidget(QWidget *parent = nullptr);
10     void setCount(int count);
11     int currentIndex();
12 
13 Q_SIGNALS:
14     void indexChange(int index);
15 
16 protected:
17     void paintEvent(QPaintEvent *e) override;
18     void mousePressEvent(QMouseEvent*e) override;
19 
20 private:
21     QPointF getPoint(const QRect &rect, int angle);
22 
23 private:
24     QString m_text;
25     QRect m_leftRect;
26     QRect m_rightRect;
27     int m_index;
28     int m_count;
29 };
30 
31 #endif // ROLLSWITCHWIDGET_H
32