A custom QPushButton styled with a cyberpunk aesthetic.
More...
#include <cyber_button.h>
|
| | 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.
|
| |
|
| 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).
|
| |
|
| double | glowIntensity |
| | Property controlling the intensity of the button's glow effect (0.0 to 1.0+). Animatable.
|
| |
|
| 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).
|
| |
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.
◆ 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
-
| text | The text to display on the button. |
| parent | Optional parent widget. |
| isPrimary | If true, uses the primary (blue/cyan) color scheme; otherwise, uses the secondary (pink/magenta) scheme. Defaults to true. |
◆ enterEvent()
| void CyberButton::enterEvent |
( |
QEvent * | event | ) |
|
|
overrideprotected |
Overridden enter event handler. Animates the glow intensity to a higher value.
- Parameters
-
◆ 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
-
◆ mousePressEvent()
| void CyberButton::mousePressEvent |
( |
QMouseEvent * | event | ) |
|
|
overrideprotected |
Overridden mouse press event handler. Sets the glow intensity to maximum and triggers a repaint.
- Parameters
-
| event | The 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
-
| event | The 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
-
◆ SetGlowIntensity()
| void CyberButton::SetGlowIntensity |
( |
double | intensity | ) |
|
Sets the intensity of the glow effect. Triggers a repaint of the button.
- Parameters
-
| intensity | The desired glow intensity. |
◆ 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).
◆ 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: