Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
CyberPushButton Class Referencefinal

A custom QPushButton styled with a cyberpunk aesthetic, featuring pulsing glow effects. More...

#include <cyber_push_button.h>

Inheritance diagram for CyberPushButton:
Collaboration diagram for CyberPushButton:

Public Member Functions

 CyberPushButton (const QString &text, QWidget *parent=nullptr)
 Constructs a CyberPushButton. Initializes the button style (transparent background, no border via stylesheet), sets the cursor, starts a timer for the pulsing glow effect, and sets the initial base glow.
 
double GetGlowIntensity () const
 Gets the current intensity of the glow effect.
 
void SetGlowIntensity (const double intensity)
 Sets the intensity of the glow effect. Triggers a repaint of the button.
 
 ~CyberPushButton () override
 Destructor. Stops the pulse timer.
 

Protected Member Functions

void enterEvent (QEvent *event) override
 Overridden enter event handler. Increases the base glow intensity when the mouse enters.
 
void leaveEvent (QEvent *event) override
 Overridden leave event handler. Resets the base glow intensity when the mouse leaves.
 
void mousePressEvent (QMouseEvent *event) override
 Overridden mouse press event handler. Maximizes the base glow intensity when pressed.
 
void mouseReleaseEvent (QMouseEvent *event) override
 Overridden mouse release event handler. Sets the base glow intensity back to the hover level if still hovering.
 
void paintEvent (QPaintEvent *event) override
 Overridden paint event handler. Draws the custom cyberpunk button appearance. Renders the clipped background, neon border, glow effect, decorative lines/markers, and text.
 

Properties

double glowIntensity
 Property controlling the intensity of the button's glow effect (0.0 to 1.0+). Animatable.
 

Private Attributes

double base_glow_intensity_
 Base level for the glow effect, modified by hover/press states.
 
double glow_intensity_
 Current overall glow intensity, influenced by base_glow_intensity_ and pulse_timer_.
 
QTimer * pulse_timer_
 Timer responsible for the subtle pulsing animation of the glow effect.
 

Detailed Description

A custom QPushButton styled with a cyberpunk aesthetic, featuring pulsing glow effects.

This button has a dark blue background, clipped corners, a neon blue border, and neon blue text. It includes decorative corner markers and inner-dotted lines. A key feature is a subtle pulsing glow effect managed by a QTimer, which intensifies on hover and press events.

Constructor & Destructor Documentation

◆ CyberPushButton()

CyberPushButton::CyberPushButton ( const QString & text,
QWidget * parent = nullptr )
explicit

Constructs a CyberPushButton. Initializes the button style (transparent background, no border via stylesheet), sets the cursor, starts a timer for the pulsing glow effect, and sets the initial base glow.

Parameters
textThe text to display on the button.
parentOptional parent widget.
Here is the call graph for this function:

◆ ~CyberPushButton()

CyberPushButton::~CyberPushButton ( )
inlineoverride

Destructor. Stops the pulse timer.

Member Function Documentation

◆ enterEvent()

void CyberPushButton::enterEvent ( QEvent * event)
inlineoverrideprotected

Overridden enter event handler. Increases the base glow intensity when the mouse enters.

Parameters
eventThe enter event.

◆ GetGlowIntensity()

double CyberPushButton::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 CyberPushButton::leaveEvent ( QEvent * event)
inlineoverrideprotected

Overridden leave event handler. Resets the base glow intensity when the mouse leaves.

Parameters
eventThe leave event.

◆ mousePressEvent()

void CyberPushButton::mousePressEvent ( QMouseEvent * event)
inlineoverrideprotected

Overridden mouse press event handler. Maximizes the base glow intensity when pressed.

Parameters
eventThe mouse press event.

◆ mouseReleaseEvent()

void CyberPushButton::mouseReleaseEvent ( QMouseEvent * event)
inlineoverrideprotected

Overridden mouse release event handler. Sets the base glow intensity back to the hover level if still hovering.

Parameters
eventThe mouse release event.

◆ paintEvent()

void CyberPushButton::paintEvent ( QPaintEvent * event)
overrideprotected

Overridden paint event handler. Draws the custom cyberpunk button appearance. Renders the clipped background, neon border, glow effect, decorative lines/markers, and text.

Parameters
eventThe paint event.

◆ SetGlowIntensity()

void CyberPushButton::SetGlowIntensity ( const double intensity)
inline

Sets the intensity of the glow effect. Triggers a repaint of the button.

Parameters
intensityThe desired glow intensity.
Here is the caller graph for this function:

Member Data Documentation

◆ base_glow_intensity_

double CyberPushButton::base_glow_intensity_
private

Base level for the glow effect, modified by hover/press states.

◆ glow_intensity_

double CyberPushButton::glow_intensity_
private

Current overall glow intensity, influenced by base_glow_intensity_ and pulse_timer_.

◆ pulse_timer_

QTimer* CyberPushButton::pulse_timer_
private

Timer responsible for the subtle pulsing animation of the glow effect.

Property Documentation

◆ glowIntensity

double CyberPushButton::glowIntensity
readwrite

Property controlling the intensity of the button's glow effect (0.0 to 1.0+). Animatable.


The documentation for this class was generated from the following files: