A custom QPushButton styled with a cyberpunk aesthetic, featuring animated glow effects.
More...
#include <navbar_button.h>
|
| | CyberpunkButton (const QString &text, QWidget *parent=nullptr) |
| | Constructs a CyberpunkButton. Initializes the button's appearance (stylesheet for text, colors, size policy), sets up the text glow effect (QGraphicsDropShadowEffect), and configures the QPropertyAnimation for the hover glow effect.
|
| |
| qreal | GetGlowIntensity () const |
| | Gets the current intensity of the glow effect.
|
| |
| void | SetGlowIntensity (qreal intensity) |
| | Sets the intensity of the glow effect and updates the button's appearance. Modifies the text glow effect's blur radius and color alpha based on the intensity. Triggers a repaint of the button.
|
| |
| | ~CyberpunkButton () override |
| | Destructor. Cleans up allocated animation objects.
|
| |
|
| void | enterEvent (QEvent *event) override |
| | Overridden enter event handler. Starts the animation to increase glow intensity.
|
| |
| void | leaveEvent (QEvent *event) override |
| | Overridden leave event handler. Starts the animation to decrease glow intensity.
|
| |
| void | paintEvent (QPaintEvent *event) override |
| | Overridden paint event handler. Draws the custom cyberpunk button frame. Calls the base class paintEvent first, then draws a rounded rectangle frame whose color alpha and thickness depend on the current glow_intensity_. Optionally draws a secondary outer glow for the frame at higher intensities.
|
| |
| void | resizeEvent (QResizeEvent *event) override |
| | Overridden resize event handler. Currently only calls the base class implementation.
|
| |
|
| qreal | glowIntensity |
| | Property controlling the intensity of the button's glow effect (0.0 to 1.0). Animatable. It affects the brightness and thickness of the frame border and the text's drop shadow.
|
| |
|
| QColor | frame_color_ |
| | Base color for the neon frame (alpha adjusted by glow_intensity_).
|
| |
| int | frame_width_ |
| | Base width for the frame border (thickness adjusted by glow_intensity_).
|
| |
| QPropertyAnimation * | glow_animation_ |
| | Animation controlling the glowIntensity property on hover.
|
| |
| QColor | glow_color_ |
| | Base color for the frame's outer glow (alpha adjusted by glow_intensity_).
|
| |
| QGraphicsDropShadowEffect * | glow_effect_ |
| | Graphics effect providing the glow/shadow for the button text.
|
| |
| qreal | glow_intensity_ |
| | Current intensity of the glow effect (0.0 to 1.0). Controlled by glow_animation_.
|
| |
A custom QPushButton styled with a cyberpunk aesthetic, featuring animated glow effects.
This button provides a distinct visual style with a neon blue frame and text. It includes a glow effect for both the frame and the text, which animates smoothly on mouse hover (enter/leave events) using QPropertyAnimation. The intensity of the glow and the thickness of the frame adjust based on the animation state.
◆ CyberpunkButton()
| CyberpunkButton::CyberpunkButton |
( |
const QString & | text, |
|
|
QWidget * | parent = nullptr ) |
|
explicit |
Constructs a CyberpunkButton. Initializes the button's appearance (stylesheet for text, colors, size policy), sets up the text glow effect (QGraphicsDropShadowEffect), and configures the QPropertyAnimation for the hover glow effect.
- Parameters
-
| text | The text to display on the button. |
| parent | Optional parent widget. |
◆ ~CyberpunkButton()
| CyberpunkButton::~CyberpunkButton |
( |
| ) |
|
|
override |
Destructor. Cleans up allocated animation objects.
◆ enterEvent()
| void CyberpunkButton::enterEvent |
( |
QEvent * | event | ) |
|
|
overrideprotected |
Overridden enter event handler. Starts the animation to increase glow intensity.
- Parameters
-
◆ GetGlowIntensity()
| qreal CyberpunkButton::GetGlowIntensity |
( |
| ) |
const |
|
inline |
Gets the current intensity of the glow effect.
- Returns
- The glow intensity value (typically between 0.0 and 1.0).
◆ leaveEvent()
| void CyberpunkButton::leaveEvent |
( |
QEvent * | event | ) |
|
|
overrideprotected |
Overridden leave event handler. Starts the animation to decrease glow intensity.
- Parameters
-
◆ paintEvent()
| void CyberpunkButton::paintEvent |
( |
QPaintEvent * | event | ) |
|
|
overrideprotected |
Overridden paint event handler. Draws the custom cyberpunk button frame. Calls the base class paintEvent first, then draws a rounded rectangle frame whose color alpha and thickness depend on the current glow_intensity_. Optionally draws a secondary outer glow for the frame at higher intensities.
- Parameters
-
◆ resizeEvent()
| void CyberpunkButton::resizeEvent |
( |
QResizeEvent * | event | ) |
|
|
overrideprotected |
Overridden resize event handler. Currently only calls the base class implementation.
- Parameters
-
◆ SetGlowIntensity()
| void CyberpunkButton::SetGlowIntensity |
( |
qreal | intensity | ) |
|
Sets the intensity of the glow effect and updates the button's appearance. Modifies the text glow effect's blur radius and color alpha based on the intensity. Triggers a repaint of the button.
- Parameters
-
| intensity | The desired glow intensity (typically between 0.0 and 1.0). |
◆ frame_color_
| QColor CyberpunkButton::frame_color_ |
|
private |
Base color for the neon frame (alpha adjusted by glow_intensity_).
◆ frame_width_
| int CyberpunkButton::frame_width_ |
|
private |
Base width for the frame border (thickness adjusted by glow_intensity_).
◆ glow_animation_
| QPropertyAnimation* CyberpunkButton::glow_animation_ |
|
private |
Animation controlling the glowIntensity property on hover.
◆ glow_color_
| QColor CyberpunkButton::glow_color_ |
|
private |
Base color for the frame's outer glow (alpha adjusted by glow_intensity_).
◆ glow_effect_
| QGraphicsDropShadowEffect* CyberpunkButton::glow_effect_ |
|
private |
Graphics effect providing the glow/shadow for the button text.
◆ glow_intensity_
| qreal CyberpunkButton::glow_intensity_ |
|
private |
Current intensity of the glow effect (0.0 to 1.0). Controlled by glow_animation_.
◆ glowIntensity
| qreal CyberpunkButton::glowIntensity |
|
readwrite |
Property controlling the intensity of the button's glow effect (0.0 to 1.0). Animatable. It affects the brightness and thickness of the frame border and the text's drop shadow.
The documentation for this class was generated from the following files: