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

An event filter specifically designed to center a QLabel within a BlobAnimation widget whenever the BlobAnimation widget is resized. More...

#include <resize_event_filter.h>

Inheritance diagram for ResizeEventFilter:
Collaboration diagram for ResizeEventFilter:

Public Member Functions

 ResizeEventFilter (QLabel *label, BlobAnimation *animation)
 Constructs a ResizeEventFilter.
 

Protected Member Functions

bool eventFilter (QObject *watched, QEvent *event) override
 Filters events sent to the watched object (the BlobAnimation widget). Checks if the event is a Resize event for the BlobAnimation widget. If it is, it calls WavelengthUtilities::CenterLabel to recenter the label_.
 

Private Attributes

BlobAnimationanimation_
 Pointer to the BlobAnimation widget being monitored for resize events.
 
QLabel * label_
 Pointer to the QLabel that needs to be centered.
 

Detailed Description

An event filter specifically designed to center a QLabel within a BlobAnimation widget whenever the BlobAnimation widget is resized.

This filter is installed on the BlobAnimation widget. It intercepts QEvent::Resize events targeted at the BlobAnimation widget and calls WavelengthUtilities::CenterLabel to ensure the associated QLabel remains centered within the animation area.

Constructor & Destructor Documentation

◆ ResizeEventFilter()

ResizeEventFilter::ResizeEventFilter ( QLabel * label,
BlobAnimation * animation )

Constructs a ResizeEventFilter.

Parameters
labelThe QLabel widget that needs to be centered.
animationThe BlobAnimation widget within which the label should be centered, and which will be monitored for resize events. The animation widget is also set as the parent of this event filter object.

Member Function Documentation

◆ eventFilter()

bool ResizeEventFilter::eventFilter ( QObject * watched,
QEvent * event )
overrideprotected

Filters events sent to the watched object (the BlobAnimation widget). Checks if the event is a Resize event for the BlobAnimation widget. If it is, it calls WavelengthUtilities::CenterLabel to recenter the label_.

Parameters
watchedThe object that generated the event (expected to be animation_).
eventThe event being processed.
Returns
Always returns false, indicating that the event should be processed further by the watched object after the centering logic is executed.
Here is the call graph for this function:

Member Data Documentation

◆ animation_

BlobAnimation* ResizeEventFilter::animation_
private

Pointer to the BlobAnimation widget being monitored for resize events.

◆ label_

QLabel* ResizeEventFilter::label_
private

Pointer to the QLabel that needs to be centered.


The documentation for this class was generated from the following files: