QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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. More...
 
QgsTextFormat format () const
 Returns the text format used for previewing text in the widget. More...
 
QgsUnitTypes::DistanceUnit mapUnits () const
 Returns the map unit type used for previewing format sizes in map units. More...
 
void paintEvent (QPaintEvent *e) override
 
double scale () const
 Returns the scale used for previewing format sizes in map units. More...
 
void setFormat (const QgsTextFormat &format)
 Sets the text format for previewing in the widget. More...
 
void setMapUnits (QgsUnitTypes::DistanceUnit unit)
 Sets the map unit type for previewing format sizes in map units. More...
 
void setScale (double scale)
 Sets the scale to use for previewing format sizes in map units. More...
 

Properties

QgsTextFormat format
 
QgsUnitTypes::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().

Since
QGIS 3.0

Definition at line 39 of file qgstextpreview.h.

Constructor & Destructor Documentation

QgsTextPreview::QgsTextPreview ( QWidget *  parent = nullptr)

Constructor for QgsTextPreview.

Parameters
parentparent widget

Definition at line 20 of file qgstextpreview.cpp.

Member Function Documentation

QgsTextFormat QgsTextPreview::format ( ) const
inline

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

See also
setFormat()

Definition at line 68 of file qgstextpreview.h.

QgsUnitTypes::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 99 of file qgstextpreview.h.

void QgsTextPreview::paintEvent ( QPaintEvent *  e)
override

Definition at line 33 of file qgstextpreview.cpp.

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 84 of file qgstextpreview.h.

void QgsTextPreview::setFormat ( const QgsTextFormat format)

Sets the text format for previewing in the widget.

Parameters
formattext format
See also
format()

Definition at line 69 of file qgstextpreview.cpp.

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

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

Parameters
unitmap units
See also
mapUnits()
setScale()

Definition at line 91 of file qgstextpreview.cpp.

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 85 of file qgstextpreview.cpp.

Property Documentation

QgsTextFormat QgsTextPreview::format
readwrite

Definition at line 43 of file qgstextpreview.h.

QgsUnitTypes::DistanceUnit QgsTextPreview::mapUnits
readwrite

Definition at line 45 of file qgstextpreview.h.

double QgsTextPreview::scale
readwrite

Definition at line 44 of file qgstextpreview.h.


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