Class: QgsPixmapLabel

The QgsPixmapLabel class shows a pixmap and adjusts its size to the space given to the widget by the layout and keeping its aspect ratio.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsPixmapLabel

Base classes

QLabel

QFrame

QWidget

QObject

QPaintDevice

Methods

clear

Clears any label contents.

heightForWidth

Calculates the height for the given width.

sizeHint

An optimal size for the widget.

class qgis.gui.QgsPixmapLabel[source]

Bases: QLabel

__init__(parent: QWidget | None = None)

Constructor for QgsPixmapLabel

Parameters:

parent (Optional[QWidget] = None)

clear(self)[source]

Clears any label contents.

heightForWidth(self, width: int) int[source]

Calculates the height for the given width.

Parameters:

width (int) – The width for the widget

Return type:

int

Returns:

An appropriate height

sizeHint(self) QSize[source]

An optimal size for the widget. Effectively using the height determined from the width with the given aspect ratio.

Return type:

QSize

Returns:

A size hint