AspectRatioLabel Class | Qt Installer Framework Manual

- Qt Installer Framework Manual
- AspectRatioLabel

# AspectRatioLabel 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>

- List of all members, including inherited members

## 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)

## Static Public Members

const QMetaObject | staticMetaObject

## Reimplemented Protected Functions

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

## Detailed Description

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

## Member Function Documentation

### AspectRatioLabel::AspectRatioLabel(QWidget *parent = nullptr)

Constructs the label with parent as parent.

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

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

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

### `[override virtual slot]` void AspectRatioLabel::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