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

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

#include <cyber_line_edit.h>

Inheritance diagram for CyberLineEdit:
Collaboration diagram for CyberLineEdit:

Public Member Functions

QRect CyberCursorRect () const
 Calculates the rectangle occupied by the custom cursor. Determines the cursor's position based on the text content and cursor position, and returns a QRect representing its visual bounds.
 
 CyberLineEdit (QWidget *parent=nullptr)
 Constructs a CyberLineEdit. Initializes the widget with cyberpunk styling (border, background, padding, font) via stylesheet, sets the text color, cursor type, minimum height, and starts a timer for the custom cursor blinking animation.
 
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 line edit.
 
QSize sizeHint () const override
 Returns the recommended size for the line edit. Enforces a minimum height of 30 pixels.
 
 ~CyberLineEdit () override
 Destructor. Stops the cursor blink timer.
 

Protected Member Functions

void enterEvent (QEvent *event) override
 Overridden enter event handler. Animates the glow effect partially in if the widget doesn't have focus.
 
void focusInEvent (QFocusEvent *event) override
 Overridden focus in event handler. Starts the cursor blink timer and animates the glow effect in.
 
void focusOutEvent (QFocusEvent *event) override
 Overridden focus out event handler. Stops the cursor blink timer and animates the glow effect out.
 
void keyPressEvent (QKeyEvent *event) override
 Overridden key press event handler. Resets the cursor blink state and timer on key press.
 
void leaveEvent (QEvent *event) override
 Overridden leave event handler. Animates the glow effect out if the widget doesn't have focus.
 
void paintEvent (QPaintEvent *event) override
 Overridden paint event handler. Draws the custom line edit appearance. Renders the clipped background, border, glow effect, placeholder text (if applicable), the actual text content (handling password mode), and the custom blinking cursor.
 

Properties

double glowIntensity
 Property controlling the intensity of the border glow effect (0.0 to 1.0). Animatable.
 

Private Attributes

QTimer * cursor_blink_timer_
 Timer controlling the blinking animation of the custom cursor.
 
bool cursor_visible_
 Flag indicating whether the custom cursor is currently visible (part of the blink cycle).
 
double glow_intensity_
 Current intensity of the glow effect. Modified by animations on focus/hover.
 

Detailed Description

A custom QLineEdit styled with a cyberpunk aesthetic.

This line edit features a dark background, clipped corners, a neon blue border, and a subtle glow effect that animates on focus and hover. It also implements a custom-drawn blinking cursor instead of the default system cursor.

Constructor & Destructor Documentation

◆ CyberLineEdit()

CyberLineEdit::CyberLineEdit ( QWidget * parent = nullptr)
explicit

Constructs a CyberLineEdit. Initializes the widget with cyberpunk styling (border, background, padding, font) via stylesheet, sets the text color, cursor type, minimum height, and starts a timer for the custom cursor blinking animation.

Parameters
parentOptional parent widget.
Here is the call graph for this function:

◆ ~CyberLineEdit()

CyberLineEdit::~CyberLineEdit ( )
override

Destructor. Stops the cursor blink timer.

Member Function Documentation

◆ CyberCursorRect()

QRect CyberLineEdit::CyberCursorRect ( ) const

Calculates the rectangle occupied by the custom cursor. Determines the cursor's position based on the text content and cursor position, and returns a QRect representing its visual bounds.

Returns
The QRect for the custom cursor.
Here is the caller graph for this function:

◆ enterEvent()

void CyberLineEdit::enterEvent ( QEvent * event)
overrideprotected

Overridden enter event handler. Animates the glow effect partially in if the widget doesn't have focus.

Parameters
eventThe enter event.

◆ focusInEvent()

void CyberLineEdit::focusInEvent ( QFocusEvent * event)
overrideprotected

Overridden focus in event handler. Starts the cursor blink timer and animates the glow effect in.

Parameters
eventThe focus event.

◆ focusOutEvent()

void CyberLineEdit::focusOutEvent ( QFocusEvent * event)
overrideprotected

Overridden focus out event handler. Stops the cursor blink timer and animates the glow effect out.

Parameters
eventThe focus event.

◆ GetGlowIntensity()

double CyberLineEdit::GetGlowIntensity ( ) const
inline

Gets the current intensity of the glow effect.

Returns
The glow intensity value (typically 0.0 to 1.0).

◆ keyPressEvent()

void CyberLineEdit::keyPressEvent ( QKeyEvent * event)
overrideprotected

Overridden key press event handler. Resets the cursor blink state and timer on key press.

Parameters
eventThe key event.

◆ leaveEvent()

void CyberLineEdit::leaveEvent ( QEvent * event)
overrideprotected

Overridden leave event handler. Animates the glow effect out if the widget doesn't have focus.

Parameters
eventThe leave event.

◆ paintEvent()

void CyberLineEdit::paintEvent ( QPaintEvent * event)
overrideprotected

Overridden paint event handler. Draws the custom line edit appearance. Renders the clipped background, border, glow effect, placeholder text (if applicable), the actual text content (handling password mode), and the custom blinking cursor.

Parameters
eventThe paint event.

◆ SetGlowIntensity()

void CyberLineEdit::SetGlowIntensity ( double intensity)

Sets the intensity of the glow effect. Triggers a repaint of the line edit.

Parameters
intensityThe desired glow intensity.

◆ sizeHint()

QSize CyberLineEdit::sizeHint ( ) const
override

Returns the recommended size for the line edit. Enforces a minimum height of 30 pixels.

Returns
The calculated QSize hint.

Member Data Documentation

◆ cursor_blink_timer_

QTimer* CyberLineEdit::cursor_blink_timer_
private

Timer controlling the blinking animation of the custom cursor.

◆ cursor_visible_

bool CyberLineEdit::cursor_visible_
private

Flag indicating whether the custom cursor is currently visible (part of the blink cycle).

◆ glow_intensity_

double CyberLineEdit::glow_intensity_
private

Current intensity of the glow effect. Modified by animations on focus/hover.

Property Documentation

◆ glowIntensity

double CyberLineEdit::glowIntensity
readwrite

Property controlling the intensity of the border glow effect (0.0 to 1.0). Animatable.


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