26 lines
605 B
C
26 lines
605 B
C
|
|
#pragma once
|
||
|
|
#include <QWidget>
|
||
|
|
#include <QTimer>
|
||
|
|
#include <QColor>
|
||
|
|
#include <QTime>
|
||
|
|
class QBreathingLight : public QWidget
|
||
|
|
{
|
||
|
|
Q_OBJECT
|
||
|
|
public:
|
||
|
|
explicit QBreathingLight(QWidget *parent = nullptr);
|
||
|
|
void setFlashDuration(int milliseconds);
|
||
|
|
void setFlashColor(const QColor &color);
|
||
|
|
public slots:
|
||
|
|
void triggerSignal();
|
||
|
|
protected:
|
||
|
|
void paintEvent(QPaintEvent *event) override;
|
||
|
|
private slots:
|
||
|
|
void updateAnimation();
|
||
|
|
private:
|
||
|
|
float m_opacity;
|
||
|
|
bool m_isFlashing;
|
||
|
|
QTimer m_animationTimer;
|
||
|
|
QColor m_flashColor;
|
||
|
|
QTime m_flashStartTime;
|
||
|
|
int m_flashDuration;
|
||
|
|
};
|