A custom overlay widget that creates a "reveal" effect using a moving scanline.
More...
#include <mask_overlay_effect.h>
|
| void | SetRevealProgress (int percentage) |
| | Sets the vertical reveal progress as a percentage. Controls how much of the underlying widget is revealed (from top to bottom).
|
| |
| void | StartScanning () |
| | Starts or restarts the scanline animation and reveal effect. Resets the reveal percentage and scanline position, makes the overlay visible, and ensures the scanline timer is running.
|
| |
| void | StopScanning () |
| | Stops the scanline animation and hides the overlay.
|
| |
|
| | MaskOverlayEffect (QWidget *parent=nullptr) |
| | Constructs a MaskOverlay widget. Initializes the widget attributes (transparent for mouse events, no system background), sets up and starts the timer for the scanline animation.
|
| |
|
| void | paintEvent (QPaintEvent *event) override |
| | Overridden paint event handler. Draws the overlay's appearance. Renders the semi-transparent mask over the unrevealed area (with glitch patterns), draws the moving scanline with a glow effect, and potentially adds effects near the reveal boundary.
|
| |
|
| void | UpdateScanLine () |
| | Slot called by the scan_timer_ to update the vertical position of the scanline. Moves the scanline downwards and wraps it back to the top when it reaches the bottom. Triggers a repaint.
|
| |
|
| int | reveal_percentage_ |
| | The current reveal progress percentage (0-100). Determines the height of the revealed area.
|
| |
| QTimer * | scan_timer_ |
| | Timer controlling the animation of the scanline's movement.
|
| |
| int | scanline_y_ |
| | The current vertical position (y-coordinate) of the scanline.
|
| |
A custom overlay widget that creates a "reveal" effect using a moving scanline.
This widget sits on top of another widget and initially covers it with a semi-transparent mask featuring glitch-like patterns. A bright scanline moves down the widget. As the scanline progresses (controlled by SetRevealProgress), the masked area above the scanline becomes transparent, revealing the content underneath. The widget is transparent to mouse events, allowing interaction with the underlying widget.
◆ MaskOverlayEffect()
| MaskOverlayEffect::MaskOverlayEffect |
( |
QWidget * | parent = nullptr | ) |
|
|
explicit |
Constructs a MaskOverlay widget. Initializes the widget attributes (transparent for mouse events, no system background), sets up and starts the timer for the scanline animation.
- Parameters
-
| parent | Optional parent widget. |
◆ paintEvent()
| void MaskOverlayEffect::paintEvent |
( |
QPaintEvent * | event | ) |
|
|
overrideprotected |
Overridden paint event handler. Draws the overlay's appearance. Renders the semi-transparent mask over the unrevealed area (with glitch patterns), draws the moving scanline with a glow effect, and potentially adds effects near the reveal boundary.
- Parameters
-
◆ SetRevealProgress
| void MaskOverlayEffect::SetRevealProgress |
( |
int | percentage | ) |
|
|
slot |
Sets the vertical reveal progress as a percentage. Controls how much of the underlying widget is revealed (from top to bottom).
- Parameters
-
| percentage | The reveal percentage (0-100). Values outside this range are clamped. |
◆ StartScanning
| void MaskOverlayEffect::StartScanning |
( |
| ) |
|
|
slot |
Starts or restarts the scanline animation and reveal effect. Resets the reveal percentage and scanline position, makes the overlay visible, and ensures the scanline timer is running.
◆ StopScanning
| void MaskOverlayEffect::StopScanning |
( |
| ) |
|
|
slot |
Stops the scanline animation and hides the overlay.
◆ UpdateScanLine
| void MaskOverlayEffect::UpdateScanLine |
( |
| ) |
|
|
privateslot |
Slot called by the scan_timer_ to update the vertical position of the scanline. Moves the scanline downwards and wraps it back to the top when it reaches the bottom. Triggers a repaint.
◆ reveal_percentage_
| int MaskOverlayEffect::reveal_percentage_ |
|
private |
The current reveal progress percentage (0-100). Determines the height of the revealed area.
◆ scan_timer_
| QTimer* MaskOverlayEffect::scan_timer_ |
|
private |
Timer controlling the animation of the scanline's movement.
◆ scanline_y_
| int MaskOverlayEffect::scanline_y_ |
|
private |
The current vertical position (y-coordinate) of the scanline.
The documentation for this class was generated from the following files: