QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
Public Member Functions | Properties | List of all members
QgsTextPreview Class Reference

A widget for previewing text formatting settings. More...

#include <qgstextpreview.h>

Inheritance diagram for QgsTextPreview:
Inheritance graph
[legend]

Public Member Functions

 QgsTextPreview (QWidget *parent=nullptr)
 Constructor for QgsTextPreview.
 
QgsTextFormat format () const
 Returns the text format used for previewing text in the widget.
 
Qgis::DistanceUnit mapUnits () const
 Returns the map unit type used for previewing format sizes in map units.
 
void paintEvent (QPaintEvent *e) override
 
double scale () const
 Returns the scale used for previewing format sizes in map units.
 
void setFormat (const QgsTextFormat &format)
 Sets the text format for previewing in the widget.
 
void setMapUnits (Qgis::DistanceUnit unit)
 Sets the map unit type for previewing format sizes in map units.
 
void setScale (double scale)
 Sets the scale to use for previewing format sizes in map units.
 

Properties

QgsTextFormat format
 
Qgis::DistanceUnit mapUnits
 
double scale
 

Detailed Description

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().

Definition at line 40 of file qgstextpreview.h.

Constructor & Destructor Documentation

◆ QgsTextPreview()

QgsTextPreview::QgsTextPreview ( QWidget *  parent = nullptr)

Constructor for QgsTextPreview.

Parameters
parentparent widget

Definition at line 23 of file qgstextpreview.cpp.

Member Function Documentation

◆ format()

QgsTextFormat QgsTextPreview::format ( ) const
inline

Returns the text format used for previewing text in the widget.

See also
setFormat()

Definition at line 69 of file qgstextpreview.h.

◆ mapUnits()

Qgis::DistanceUnit QgsTextPreview::mapUnits ( ) const
inline

Returns the map unit type used for previewing format sizes in map units.

See also
setMapUnits()
scale()

Definition at line 100 of file qgstextpreview.h.

◆ paintEvent()

void QgsTextPreview::paintEvent ( QPaintEvent *  e)
override

Definition at line 46 of file qgstextpreview.cpp.

◆ scale()

double QgsTextPreview::scale ( ) const
inline

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
setScale()
mapUnits()

Definition at line 85 of file qgstextpreview.h.

◆ setFormat()

void QgsTextPreview::setFormat ( const QgsTextFormat format)

Sets the text format for previewing in the widget.

Parameters
formattext format
See also
format()

Definition at line 87 of file qgstextpreview.cpp.

◆ setMapUnits()

void QgsTextPreview::setMapUnits ( Qgis::DistanceUnit  unit)

Sets the map unit type for previewing format sizes in map units.

Parameters
unitmap units
See also
mapUnits()
setScale()

Definition at line 109 of file qgstextpreview.cpp.

◆ setScale()

void QgsTextPreview::setScale ( double  scale)

Sets the scale to use 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
scale()
setMapUnits()

Definition at line 103 of file qgstextpreview.cpp.

Property Documentation

◆ format

QgsTextFormat QgsTextPreview::format
readwrite

Definition at line 44 of file qgstextpreview.h.

◆ mapUnits

Qgis::DistanceUnit QgsTextPreview::mapUnits
readwrite

Definition at line 46 of file qgstextpreview.h.

◆ scale

double QgsTextPreview::scale
readwrite

Definition at line 45 of file qgstextpreview.h.


The documentation for this class was generated from the following files: