Class: QgsPixmapLabel

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.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsPixmapLabel. See the FAQ for more details.

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.

virtual 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

virtual 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