Added smile
This commit is contained in:
37
bctoggleswitch.h
Normal file
37
bctoggleswitch.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef BCTOGGLESWITCH_H
|
||||
#define BCTOGGLESWITCH_H
|
||||
|
||||
#include <QAbstractButton>
|
||||
|
||||
// Vorwärtsdeklaration spart Include-Zeit
|
||||
class QPropertyAnimation;
|
||||
|
||||
class BCToggleSwitch : public QAbstractButton
|
||||
{
|
||||
Q_OBJECT
|
||||
// Property für die Animation (0.0 bis 1.0)
|
||||
Q_PROPERTY(float position READ position WRITE setPosition)
|
||||
|
||||
public:
|
||||
|
||||
explicit BCToggleSwitch(QWidget *parent = nullptr);
|
||||
|
||||
// Getter & Setter für die Animations-Property
|
||||
float position() const;
|
||||
void setPosition(float pos);
|
||||
|
||||
QSize sizeHint() const override;
|
||||
|
||||
protected:
|
||||
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
|
||||
float m_position; // 0.0 = Aus, 1.0 = An
|
||||
QPropertyAnimation *m_animation;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // BCTOGGLESWITCH_H
|
||||
Reference in New Issue
Block a user