A custom QLineEdit styled with a cyberpunk aesthetic.
More...
#include <cyber_line_edit.h>
|
| 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.
|
| |
|
| 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.
|
| |
|
| double | glowIntensity |
| | Property controlling the intensity of the border glow effect (0.0 to 1.0). Animatable.
|
| |
|
| 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.
|
| |
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.
◆ 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
-
| parent | Optional parent widget. |
◆ ~CyberLineEdit()
| CyberLineEdit::~CyberLineEdit |
( |
| ) |
|
|
override |
Destructor. Stops the cursor blink timer.
◆ 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.
◆ 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
-
◆ focusInEvent()
| void CyberLineEdit::focusInEvent |
( |
QFocusEvent * | event | ) |
|
|
overrideprotected |
Overridden focus in event handler. Starts the cursor blink timer and animates the glow effect in.
- Parameters
-
◆ focusOutEvent()
| void CyberLineEdit::focusOutEvent |
( |
QFocusEvent * | event | ) |
|
|
overrideprotected |
Overridden focus out event handler. Stops the cursor blink timer and animates the glow effect out.
- Parameters
-
◆ 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
-
◆ leaveEvent()
| void CyberLineEdit::leaveEvent |
( |
QEvent * | event | ) |
|
|
overrideprotected |
Overridden leave event handler. Animates the glow effect out if the widget doesn't have focus.
- Parameters
-
◆ 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
-
◆ SetGlowIntensity()
| void CyberLineEdit::SetGlowIntensity |
( |
double | intensity | ) |
|
Sets the intensity of the glow effect. Triggers a repaint of the line edit.
- Parameters
-
| intensity | The 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.
◆ 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.
◆ 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: