AspectRatioLabel Class
class QInstaller::AspectRatioLabelThe AspectRatioLabel class provides a label for displaying a pixmap that maintains its original aspect ratio when resized. More...
Header: | #include <AspectRatioLabel> |
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
AspectRatioLabel::AspectRatioLabel(QWidget *parent = nullptr)
Constructs the label with parent as parent.
[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.