-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtogglebutton.h
More file actions
37 lines (30 loc) · 911 Bytes
/
Copy pathtogglebutton.h
File metadata and controls
37 lines (30 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef TOGGLEBUTTON_H
#define TOGGLEBUTTON_H
#include <QAbstractButton>
#include <QObject>
#include <QPropertyAnimation>
#include <QWidget>
class ToggleButton : public QAbstractButton
{
Q_OBJECT
private:
bool state;
QPropertyAnimation *animation = nullptr;
QBrush trackEdit, circleEdit, trackReadonly, circleReadonly;
QPoint cirlePoint;
public:
ToggleButton(QWidget * parent);
bool getState() const;
void keyPressEvent(QKeyEvent *e) override;
void keyReleaseEvent(QKeyEvent *e) override;
void mouseMoveEvent(QMouseEvent *e) override;
void mousePressEvent(QMouseEvent *e) override;
void mouseDoubleClickEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *e) override;
void paintEvent(QPaintEvent *e) override;
signals:
void toggleState(bool state);
public slots:
void setChecked(bool state);
};
#endif // TOGGLEBUTTON_H