A custom QPushButton styled with a cyberpunk aesthetic, featuring pulsing glow effects.
More...
#include <cyber_push_button.h>
|
| | 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.
|
| |
|
| 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.
|
| |
|
| double | glowIntensity |
| | Property controlling the intensity of the button's glow effect (0.0 to 1.0+). Animatable.
|
| |
|
| 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.
|
| |
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.
◆ 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
-
| text | The text to display on the button. |
| parent | Optional parent widget. |
◆ ~CyberPushButton()
| CyberPushButton::~CyberPushButton |
( |
| ) |
|
|
inlineoverride |
Destructor. Stops the pulse timer.
◆ enterEvent()
| void CyberPushButton::enterEvent |
( |
QEvent * | event | ) |
|
|
inlineoverrideprotected |
Overridden enter event handler. Increases the base glow intensity when the mouse enters.
- Parameters
-
◆ 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
-
◆ mousePressEvent()
| void CyberPushButton::mousePressEvent |
( |
QMouseEvent * | event | ) |
|
|
inlineoverrideprotected |
Overridden mouse press event handler. Maximizes the base glow intensity when pressed.
- Parameters
-
| event | The 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
-
| event | The 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
-
◆ SetGlowIntensity()
| void CyberPushButton::SetGlowIntensity |
( |
const double | intensity | ) |
|
|
inline |
Sets the intensity of the glow effect. Triggers a repaint of the button.
- Parameters
-
| intensity | The desired glow intensity. |
◆ 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.
◆ 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: