add QbreathingLight Class
This commit is contained in:
35
QMainwindow/QBreathingLight.h
Normal file
35
QMainwindow/QBreathingLight.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
#include <QColor>
|
||||
#include <QTime>
|
||||
|
||||
class QBreathingLight : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QBreathingLight(QWidget *parent = nullptr);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸<EFBFBD><CBB8><EFBFBD><EFBFBD>
|
||||
void setFlashDuration(int milliseconds); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸<EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
void setFlashColor(const QColor &color); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸<EFBFBD><CBB8>ɫ
|
||||
|
||||
public slots:
|
||||
void triggerSignal(); // <20><><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA><C5A3><EFBFBD>ʼ<EFBFBD><CABC>˸
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void updateAnimation();
|
||||
|
||||
private:
|
||||
float m_opacity; // <20><>ǰ<C7B0><CDB8><EFBFBD><EFBFBD>
|
||||
bool m_isFlashing; // <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸
|
||||
QTimer m_animationTimer; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
QColor m_flashColor; // <20><>˸<EFBFBD><CBB8>ɫ
|
||||
QTime m_flashStartTime; // <20><>˸<EFBFBD><CBB8>ʼʱ<CABC><CAB1>
|
||||
int m_flashDuration; // <20><>˸<EFBFBD><CBB8><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>(<28><><EFBFBD><EFBFBD>)
|
||||
};
|
||||
Reference in New Issue
Block a user