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

A custom overlay widget that creates a "reveal" effect using a moving scanline. More...

#include <mask_overlay_effect.h>

Inheritance diagram for MaskOverlayEffect:
Collaboration diagram for MaskOverlayEffect:

Public Slots

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.
 

Public Member Functions

 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.
 

Protected Member Functions

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.
 

Private Slots

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.
 

Private Attributes

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ 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
parentOptional parent widget.
Here is the call graph for this function:

Member Function Documentation

◆ 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
eventThe paint event.

◆ 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
percentageThe reveal percentage (0-100). Values outside this range are clamped.
Here is the caller graph for this function:

◆ 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.

Here is the caller graph for this function:

Member Data Documentation

◆ 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: