1#ifndef AUTO_SCALING_ATTACHMENT_H
2#define AUTO_SCALING_ATTACHMENT_H
84 bool eventFilter(QObject *watched, QEvent *event)
override;
QWidget * content_
Pointer to the original widget displaying the attachment content.
Definition auto_scaling_attachment.h:123
void resizeEvent(QResizeEvent *event) override
Handles resize events for the widget. Updates the position of the "Click to enlarge" label if it's vi...
Definition auto_scaling_attachment.cpp:120
QSize ContentOriginalSize() const
Gets the original, unscaled size of the content widget. Primarily uses the content's sizeHint().
Definition auto_scaling_attachment.cpp:72
AutoScalingAttachment(QWidget *content, QWidget *parent=nullptr)
Constructs an AutoScalingAttachment widget. Sets up the layout, installs event filters,...
Definition auto_scaling_attachment.cpp:12
QWidget * content_container_
Container widget that holds the content_ and whose size is adjusted during scaling.
Definition auto_scaling_attachment.h:125
bool eventFilter(QObject *watched, QEvent *event) override
Filters events for the content container, specifically capturing mouse clicks. Emits the clicked() si...
Definition auto_scaling_attachment.cpp:95
QSize sizeHint() const override
Provides a size hint for the AutoScalingAttachment widget. Returns the current (potentially scaled) s...
Definition auto_scaling_attachment.cpp:82
QSize scaled_size_
The current scaled size of the content_container_.
Definition auto_scaling_attachment.h:131
void UpdateInfoLabelPosition() const
Updates the position of the info_label_ ("Click to enlarge") to be centered at the bottom of the cont...
Definition auto_scaling_attachment.cpp:182
void CheckAndScaleContent()
Checks the content's original size against the maximum allowed size and applies scaling if necessary....
Definition auto_scaling_attachment.cpp:127
void enterEvent(QEvent *event) override
Handles mouse enter events. Shows the "Click to enlarge" label if the content is scaled.
Definition auto_scaling_attachment.cpp:106
void clicked()
Emitted when the user clicks on the attachment container. Typically used to trigger showing the full-...
void leaveEvent(QEvent *event) override
Handles mouse leave events. Hides the "Click to enlarge" label.
Definition auto_scaling_attachment.cpp:115
QLabel * info_label_
Label displayed over scaled content on hover ("Click to enlarge").
Definition auto_scaling_attachment.h:127
bool is_scaled_
Flag indicating whether the content is currently scaled down.
Definition auto_scaling_attachment.h:129
QSize max_allowed_size_
The maximum size allowed for the content before scaling is applied.
Definition auto_scaling_attachment.h:133
bool IsScaled() const
Checks if the content is currently scaled down.
Definition auto_scaling_attachment.h:50
QWidget * Content() const
Gets a pointer to the original content widget.
Definition auto_scaling_attachment.h:58
void SetMaxAllowedSize(const QSize &max_size)
Sets the maximum allowed size for the content. If the content's original size exceeds this,...
Definition auto_scaling_attachment.cpp:67