QGIS API Documentation  3.2.0-Bonn (bc43194)
Public Slots | Signals | Public Member Functions | Protected Types | Protected Slots | Protected Member Functions | Protected Attributes | Properties | List of all members
QgsTextFormatWidget Class Reference

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

#include <qgstextformatwidget.h>

Inheritance diagram for QgsTextFormatWidget:
Inheritance graph
[legend]

Public Slots

void setDockMode (bool enabled)
 Sets whether the widget should be shown in a compact dock mode. More...
 

Signals

void widgetChanged ()
 Emitted when the text format defined by the widget changes. More...
 

Public Member Functions

 QgsTextFormatWidget (const QgsTextFormat &format=QgsTextFormat(), QgsMapCanvas *mapCanvas=nullptr, QWidget *parent=nullptr)
 Constructor for QgsTextFormatWidget. More...
 
 ~QgsTextFormatWidget () override
 
QgsTextFormat format () const
 Returns the current formatting settings defined by the widget. More...
 
void setFormat (const QgsTextFormat &format)
 Sets the current formatting settings. More...
 

Protected Types

enum  Mode { Text = 0, Labeling }
 Widget mode. More...
 

Protected Slots

void updateLinePlacementOptions ()
 Updates line placement options to reflect current state of widget. More...
 
void updatePlacementWidgets ()
 Updates label placement options to reflect current state of widget. More...
 

Protected Member Functions

 QgsTextFormatWidget (QgsMapCanvas *mapCanvas, QWidget *parent, Mode mode)
 Constructor for QgsTextFormatWidget. More...
 
void enableDataDefinedAlignment (bool enable)
 Controls whether data defined alignment buttons are enabled. More...
 
void setPreviewBackground (const QColor &color)
 Sets the background color for the text preview widget. More...
 
void updateWidgetForFormat (const QgsTextFormat &format)
 Updates the widget's state to reflect the settings in a QgsTextFormat. More...
 

Protected Attributes

QButtonGroup * mDirectSymbBtnGrp = nullptr
 Symbol direction button group. More...
 
int mMinPixelLimit = 0
 Pixel size font limit. More...
 
QButtonGroup * mPlaceLineBtnGrp = nullptr
 Line placement button group. More...
 
QButtonGroup * mPlacePointBtnGrp = nullptr
 Point placement button group. More...
 
QButtonGroup * mPlacePolygonBtnGrp = nullptr
 Polygon placement button group. More...
 
QButtonGroup * mQuadrantBtnGrp = nullptr
 Quadrant button group. More...
 
QgsStringReplacementCollection mSubstitutions
 Text substitution list. More...
 
QButtonGroup * mUpsidedownBtnGrp = nullptr
 Upside down labels button group. More...
 

Properties

QgsTextFormat format
 

Detailed Description

A widget for customizing text formatting settings.

QgsTextFormatWidget provides a widget for controlling the appearance of text rendered using QgsTextRenderer. The widget includes all settings contained within a QgsTextFormat, including shadow, background and buffer.

Additionally, the widget can handle labeling settings due to the large overlap between the text renderer settings and the labeling settings. This mode is possible by subclassing QgsTextFormatWidget and calling the protected constructor with a mode of Labeling.

Since
QGIS 3.0

Definition at line 49 of file qgstextformatwidget.h.

Member Enumeration Documentation

◆ Mode

enum QgsTextFormatWidget::Mode
protected

Widget mode.

Enumerator
Text 

Default mode, show text formatting settings only.

Labeling 

Show labeling settings in addition to text formatting settings.

Definition at line 93 of file qgstextformatwidget.h.

Constructor & Destructor Documentation

◆ QgsTextFormatWidget() [1/2]

QgsTextFormatWidget::QgsTextFormatWidget ( const QgsTextFormat format = QgsTextFormat(),
QgsMapCanvas mapCanvas = nullptr,
QWidget *  parent = nullptr 
)

Constructor for QgsTextFormatWidget.

Parameters
formatinitial formatting settings to show in widget
mapCanvasassociated map canvas
parentparent widget

Definition at line 34 of file qgstextformatwidget.cpp.

◆ ~QgsTextFormatWidget()

QgsTextFormatWidget::~QgsTextFormatWidget ( )
override

Definition at line 739 of file qgstextformatwidget.cpp.

◆ QgsTextFormatWidget() [2/2]

QgsTextFormatWidget::QgsTextFormatWidget ( QgsMapCanvas mapCanvas,
QWidget *  parent,
Mode  mode 
)
protected

Constructor for QgsTextFormatWidget.

Parameters
mapCanvasassociated map canvas
parentparent widget
modewidget mode

Definition at line 43 of file qgstextformatwidget.cpp.

Member Function Documentation

◆ enableDataDefinedAlignment()

void QgsTextFormatWidget::enableDataDefinedAlignment ( bool  enable)
protected

Controls whether data defined alignment buttons are enabled.

Parameters
enableset to true to enable alignment controls

Definition at line 1436 of file qgstextformatwidget.cpp.

◆ format()

QgsTextFormat QgsTextFormatWidget::format ( ) const

Returns the current formatting settings defined by the widget.

◆ setDockMode

void QgsTextFormatWidget::setDockMode ( bool  enabled)
slot

Sets whether the widget should be shown in a compact dock mode.

Parameters
enabledset to true to show in dock mode.

Definition at line 536 of file qgstextformatwidget.cpp.

◆ setFormat()

void QgsTextFormatWidget::setFormat ( const QgsTextFormat format)

Sets the current formatting settings.

Since
QGIS 3.2

Definition at line 831 of file qgstextformatwidget.cpp.

◆ setPreviewBackground()

void QgsTextFormatWidget::setPreviewBackground ( const QColor &  color)
protected

Sets the background color for the text preview widget.

Parameters
colorbackground color

Definition at line 925 of file qgstextformatwidget.cpp.

◆ updateLinePlacementOptions

void QgsTextFormatWidget::updateLinePlacementOptions ( )
protectedslot

Updates line placement options to reflect current state of widget.

Definition at line 1220 of file qgstextformatwidget.cpp.

◆ updatePlacementWidgets

void QgsTextFormatWidget::updatePlacementWidgets ( )
protectedslot

Updates label placement options to reflect current state of widget.

Definition at line 938 of file qgstextformatwidget.cpp.

◆ updateWidgetForFormat()

void QgsTextFormatWidget::updateWidgetForFormat ( const QgsTextFormat format)
protected

Updates the widget's state to reflect the settings in a QgsTextFormat.

Parameters
formatsource format

Definition at line 615 of file qgstextformatwidget.cpp.

◆ widgetChanged

void QgsTextFormatWidget::widgetChanged ( )
signal

Emitted when the text format defined by the widget changes.

Member Data Documentation

◆ mDirectSymbBtnGrp

QButtonGroup* QgsTextFormatWidget::mDirectSymbBtnGrp = nullptr
protected

Symbol direction button group.

Definition at line 130 of file qgstextformatwidget.h.

◆ mMinPixelLimit

int QgsTextFormatWidget::mMinPixelLimit = 0
protected

Pixel size font limit.

Definition at line 140 of file qgstextformatwidget.h.

◆ mPlaceLineBtnGrp

QButtonGroup* QgsTextFormatWidget::mPlaceLineBtnGrp = nullptr
protected

Line placement button group.

Definition at line 136 of file qgstextformatwidget.h.

◆ mPlacePointBtnGrp

QButtonGroup* QgsTextFormatWidget::mPlacePointBtnGrp = nullptr
protected

Point placement button group.

Definition at line 134 of file qgstextformatwidget.h.

◆ mPlacePolygonBtnGrp

QButtonGroup* QgsTextFormatWidget::mPlacePolygonBtnGrp = nullptr
protected

Polygon placement button group.

Definition at line 138 of file qgstextformatwidget.h.

◆ mQuadrantBtnGrp

QButtonGroup* QgsTextFormatWidget::mQuadrantBtnGrp = nullptr
protected

Quadrant button group.

Definition at line 128 of file qgstextformatwidget.h.

◆ mSubstitutions

QgsStringReplacementCollection QgsTextFormatWidget::mSubstitutions
protected

Text substitution list.

Definition at line 126 of file qgstextformatwidget.h.

◆ mUpsidedownBtnGrp

QButtonGroup* QgsTextFormatWidget::mUpsidedownBtnGrp = nullptr
protected

Upside down labels button group.

Definition at line 132 of file qgstextformatwidget.h.

Property Documentation

◆ format

QgsTextFormat QgsTextFormatWidget::format
read

Definition at line 52 of file qgstextformatwidget.h.


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