QInstaller::AspectRatioLabel Class

class QInstaller::AspectRatioLabel

The AspectRatioLabel class provides a label for displaying a pixmap that maintains its original aspect ratio when resized. More...

Header: #include <AspectRatioLabel>
Inherits: QLabel

Public Functions

AspectRatioLabel(QWidget *parent = nullptr)

Reimplemented Public Functions

virtual int heightForWidth(int w) const override
virtual QSize sizeHint() const override

Public Slots

virtual void resizeEvent(QResizeEvent *event) override
void setPixmap(const QPixmap &pixmap)
void setPixmapAndUrl(const QPixmap &pixmap, const QString &url)

Reimplemented Protected Functions

virtual bool event(QEvent *e) override
virtual void mousePressEvent(QMouseEvent *event) override

Detailed Description

Member Function Documentation

[explicit] AspectRatioLabel::AspectRatioLabel(QWidget *parent = nullptr)

Constructs the label with parent as parent.

[override virtual protected] bool AspectRatioLabel::event(QEvent *e)

Reimplements: QLabel::event(QEvent *e).

[override virtual] int AspectRatioLabel::heightForWidth(int w) const

Reimplements: QLabel::heightForWidth(int w) const.

[override virtual protected] void AspectRatioLabel::mousePressEvent(QMouseEvent *event)

Reimplements: QLabel::mousePressEvent(QMouseEvent *ev).

[override virtual slot] void AspectRatioLabel::resizeEvent(QResizeEvent *event)

Reimplements: QWidget::resizeEvent(QResizeEvent *event).

[slot] void AspectRatioLabel::setPixmap(const QPixmap &pixmap)

Sets the pixmap shown on the label. Setting a new pixmap clears the previous content.

Note: This redefines the non-virtual slot of the same signature from the QLabel base class, which results in non polymorphic behavior when called via a base class pointer.

[slot] void AspectRatioLabel::setPixmapAndUrl(const QPixmap &pixmap, const QString &url)

Sets the pixmap shown on the label and an url. Setting a new pixmap clears the previous content. When clicking the pixmap, url is opened in a browser. If the url is a reference to a file, it will be opened with a suitable application instead of a Web browser.

[override virtual] QSize AspectRatioLabel::sizeHint() const

Reimplements: QLabel::sizeHint() const.

© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. The Qt Company, Qt and their respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.