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>
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.
◆ ResizeEventFilter()
| ResizeEventFilter::ResizeEventFilter |
( |
QLabel * | label, |
|
|
BlobAnimation * | animation ) |
Constructs a ResizeEventFilter.
- Parameters
-
| label | The QLabel widget that needs to be centered. |
| animation | The 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. |
◆ 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
-
| watched | The object that generated the event (expected to be animation_). |
| event | The 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.
◆ animation_
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: