Class: QgsTextPreview¶
A widget for previewing text formatting settings.
QgsTextPreview
provides a widget for previewing the
appearance of text rendered using QgsTextRenderer
. The
preview includes all settings contained within a
QgsTextFormat
, including shadow, background and buffer.
In order to preview the exact appearance of text which uses sizes in map
units, the scale and map units must be set by calling
setScale()
and setMapUnits()
.
Class Hierarchy¶
Base classes¶
Methods
Returns the text format used for previewing text in the widget. |
|
Returns the map unit type used for previewing format sizes in map units. |
|
Returns the scale used for previewing format sizes in map units. |
|
Sets the text format for previewing in the widget. |
|
Sets the map unit type for previewing format sizes in map units. |
|
Sets the scale to use for previewing format sizes in map units. |
- class qgis.gui.QgsTextPreview[source]¶
Bases:
QLabel
- __init__(parent: QWidget | None = None)
Constructor for QgsTextPreview
- Parameters:
parent (Optional[QWidget] = None) – parent widget
- format(self) QgsTextFormat [source]¶
Returns the text format used for previewing text in the widget.
See also
- Return type:
- mapUnits(self) Qgis.DistanceUnit [source]¶
Returns the map unit type used for previewing format sizes in map units.
See also
See also
- Return type:
- scale(self) float [source]¶
Returns the scale used for previewing format sizes in map units. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
See also
See also
- Return type:
float
- setFormat(self, format: QgsTextFormat)[source]¶
Sets the text format for previewing in the widget.
- Parameters:
format (QgsTextFormat) – text format
See also
- setMapUnits(self, unit: Qgis.DistanceUnit)[source]¶
Sets the map unit type for previewing format sizes in map units.
- Parameters:
unit (Qgis.DistanceUnit) – map units
See also
See also