Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
navbar_button.h
Go to the documentation of this file.
1#ifndef CYBERPUNK_BUTTON_H
2#define CYBERPUNK_BUTTON_H
3
4#include <QPushButton>
5
6class QGraphicsDropShadowEffect;
7class QPropertyAnimation;
8
17class CyberpunkButton final : public QPushButton {
18 Q_OBJECT
19
24 Q_PROPERTY(qreal glowIntensity READ GetGlowIntensity WRITE SetGlowIntensity)
25
26public:
35 explicit CyberpunkButton(const QString &text, QWidget *parent = nullptr);
36
40 ~CyberpunkButton() override;
41
46 qreal GetGlowIntensity() const { return glow_intensity_; }
47
54 void SetGlowIntensity(qreal intensity);
55
56protected:
61 void enterEvent(QEvent *event) override;
62
67 void leaveEvent(QEvent *event) override;
68
73 void resizeEvent(QResizeEvent *event) override;
74
82 void paintEvent(QPaintEvent *event) override;
83
84private:
86 QPropertyAnimation *glow_animation_;
88 QGraphicsDropShadowEffect *glow_effect_;
89
98};
99
100#endif // CYBERPUNK_BUTTON_H
void enterEvent(QEvent *event) override
Overridden enter event handler. Starts the animation to increase glow intensity.
Definition navbar_button.cpp:110
qreal glow_intensity_
Current intensity of the glow effect (0.0 to 1.0). Controlled by glow_animation_.
Definition navbar_button.h:91
QColor glow_color_
Base color for the frame's outer glow (alpha adjusted by glow_intensity_).
Definition navbar_button.h:95
void resizeEvent(QResizeEvent *event) override
Overridden resize event handler. Currently only calls the base class implementation.
Definition navbar_button.cpp:125
qreal GetGlowIntensity() const
Gets the current intensity of the glow effect.
Definition navbar_button.h:46
CyberpunkButton(const QString &text, QWidget *parent=nullptr)
Constructs a CyberpunkButton. Initializes the button's appearance (stylesheet for text,...
Definition navbar_button.cpp:7
void SetGlowIntensity(qreal intensity)
Sets the intensity of the glow effect and updates the button's appearance. Modifies the text glow eff...
Definition navbar_button.cpp:95
~CyberpunkButton() override
Destructor. Cleans up allocated animation objects.
Definition navbar_button.cpp:49
qreal glowIntensity
Property controlling the intensity of the button's glow effect (0.0 to 1.0). Animatable....
Definition navbar_button.h:24
QPropertyAnimation * glow_animation_
Animation controlling the glowIntensity property on hover.
Definition navbar_button.h:86
QGraphicsDropShadowEffect * glow_effect_
Graphics effect providing the glow/shadow for the button text.
Definition navbar_button.h:88
void leaveEvent(QEvent *event) override
Overridden leave event handler. Starts the animation to decrease glow intensity.
Definition navbar_button.cpp:118
int frame_width_
Base width for the frame border (thickness adjusted by glow_intensity_).
Definition navbar_button.h:97
QColor frame_color_
Base color for the neon frame (alpha adjusted by glow_intensity_).
Definition navbar_button.h:93
void paintEvent(QPaintEvent *event) override
Overridden paint event handler. Draws the custom cyberpunk button frame. Calls the base class paintEv...
Definition navbar_button.cpp:53