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

A custom QPushButton styled with a cyberpunk aesthetic. More...

#include <cyber_button.h>

Inheritance diagram for CyberButton:
Collaboration diagram for CyberButton:

Public Member Functions

 CyberButton (const QString &text, QWidget *parent=nullptr, bool isPrimary=true)
 Constructs a CyberButton. Initializes the button style (transparent background, no border, font via stylesheet), sets the cursor, and determines the color scheme based on the isPrimary flag.
 
double GetGlowIntensity () const
 Gets the current intensity of the glow effect.
 
void SetGlowIntensity (double intensity)
 Sets the intensity of the glow effect. Triggers a repaint of the button.
 

Protected Member Functions

void enterEvent (QEvent *event) override
 Overridden enter event handler. Animates the glow intensity to a higher value.
 
void leaveEvent (QEvent *event) override
 Overridden leave event handler. Animates the glow intensity back to its default value.
 
void mousePressEvent (QMouseEvent *event) override
 Overridden mouse press event handler. Sets the glow intensity to maximum and triggers a repaint.
 
void mouseReleaseEvent (QMouseEvent *event) override
 Overridden mouse release event handler. Sets the glow intensity back to the hover level and triggers a repaint.
 
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 based on the primary/secondary color scheme and current state (enabled, down).
 

Properties

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

Private Attributes

double glow_intensity_
 Current intensity of the glow effect. Modified by animations and mouse events.
 
bool is_primary_
 Flag determining the color scheme (true for primary blue/cyan, false for secondary pink/magenta).
 

Detailed Description

A custom QPushButton styled with a cyberpunk aesthetic.

This button features clipped corners, neon borders, and a subtle glow effect that animates on hover and press. It supports two color schemes: primary (blue/cyan) and secondary (pink/magenta), controlled by the isPrimary flag. It also includes decorative corner markers and inner lines.

Constructor & Destructor Documentation

◆ CyberButton()

CyberButton::CyberButton ( const QString & text,
QWidget * parent = nullptr,
bool isPrimary = true )
explicit

Constructs a CyberButton. Initializes the button style (transparent background, no border, font via stylesheet), sets the cursor, and determines the color scheme based on the isPrimary flag.

Parameters
textThe text to display on the button.
parentOptional parent widget.
isPrimaryIf true, uses the primary (blue/cyan) color scheme; otherwise, uses the secondary (pink/magenta) scheme. Defaults to true.

Member Function Documentation

◆ enterEvent()

void CyberButton::enterEvent ( QEvent * event)
overrideprotected

Overridden enter event handler. Animates the glow intensity to a higher value.

Parameters
eventThe enter event.

◆ GetGlowIntensity()

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

Overridden leave event handler. Animates the glow intensity back to its default value.

Parameters
eventThe leave event.

◆ mousePressEvent()

void CyberButton::mousePressEvent ( QMouseEvent * event)
overrideprotected

Overridden mouse press event handler. Sets the glow intensity to maximum and triggers a repaint.

Parameters
eventThe mouse press event.

◆ mouseReleaseEvent()

void CyberButton::mouseReleaseEvent ( QMouseEvent * event)
overrideprotected

Overridden mouse release event handler. Sets the glow intensity back to the hover level and triggers a repaint.

Parameters
eventThe mouse release event.

◆ paintEvent()

void CyberButton::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 based on the primary/secondary color scheme and current state (enabled, down).

Parameters
eventThe paint event.

◆ SetGlowIntensity()

void CyberButton::SetGlowIntensity ( double intensity)

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

Parameters
intensityThe desired glow intensity.

Member Data Documentation

◆ glow_intensity_

double CyberButton::glow_intensity_
private

Current intensity of the glow effect. Modified by animations and mouse events.

◆ is_primary_

bool CyberButton::is_primary_
private

Flag determining the color scheme (true for primary blue/cyan, false for secondary pink/magenta).

Property Documentation

◆ glowIntensity

double CyberButton::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: