QGIS API Documentation
3.10.0-A Coruña (6c816b4204)
|
A widget for customizing text formatting settings. More...
#include <qgstextformatwidget.h>
Public Slots | |
void | setDockMode (bool enabled) |
Sets whether the widget should be shown in a compact dock mode. More... | |
Signals | |
void | auxiliaryFieldCreated () |
Emitted when an auxiliary field is creatd in the widget. More... | |
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, QgsVectorLayer *layer=nullptr) | |
Constructor for QgsTextFormatWidget. More... | |
~QgsTextFormatWidget () override | |
QgsSymbolWidgetContext | context () const |
Returns the context in which the widget is shown, e.g., the associated map canvas and expression contexts. More... | |
void | deactivateField (QgsPalLayerSettings::Property key) |
Deactivate a field from data defined properties and update the corresponding button. More... | |
QgsTextFormat | format (bool includeDataDefinedProperties=true) const |
Returns the current formatting settings defined by the widget. More... | |
virtual void | setContext (const QgsSymbolWidgetContext &context) |
Sets the context in which the widget is shown, e.g., the associated map canvas and expression contexts. More... | |
void | setFormat (const QgsTextFormat &format) |
Sets the current formatting settings. More... | |
Public Member Functions inherited from QgsExpressionContextGenerator | |
virtual | ~QgsExpressionContextGenerator ()=default |
Protected Types | |
enum | Mode { Text = 0, Labeling } |
Widget mode. More... | |
Protected Slots | |
void | populateDataDefinedButtons () |
Sets up connections required for data defined buttons, or updates the existing definition of these buttons. More... | |
virtual void | saveFormat () |
Saves the current text settings to a style entry. More... | |
virtual void | setFormatFromStyle (const QString &name, QgsStyle::StyleEntity type) |
Sets the current text settings from a style entry. More... | |
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... | |
void | updatePreview () |
Updates the text preview. More... | |
Protected Member Functions | |
QgsTextFormatWidget (QgsMapCanvas *mapCanvas, QWidget *parent, Mode mode, QgsVectorLayer *layer=nullptr) | |
Constructor for QgsTextFormatWidget. More... | |
QgsExpressionContext | createExpressionContext () const override |
This method needs to be reimplemented in all classes which implement this interface and return an expression context. 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 | |
QgsSymbolWidgetContext | mContext |
Context in which widget is shown. More... | |
QgsPropertyCollection | mDataDefinedProperties |
Data defined properties as defined in the widget. More... | |
QButtonGroup * | mDirectSymbBtnGrp = nullptr |
Symbol direction button group. More... | |
QgsVectorLayer * | mLayer = nullptr |
Associated vector layer. More... | |
QgsMapCanvas * | mMapCanvas = nullptr |
Associated map canvas. 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 |
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.
Definition at line 50 of file qgstextformatwidget.h.
|
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 129 of file qgstextformatwidget.h.
QgsTextFormatWidget::QgsTextFormatWidget | ( | const QgsTextFormat & | format = QgsTextFormat() , |
QgsMapCanvas * | mapCanvas = nullptr , |
||
QWidget * | parent = nullptr , |
||
QgsVectorLayer * | layer = nullptr |
||
) |
Constructor for QgsTextFormatWidget.
format | initial formatting settings to show in widget |
mapCanvas | associated map canvas |
parent | parent widget |
layer | associated vector layer |
Definition at line 42 of file qgstextformatwidget.cpp.
|
override |
Definition at line 933 of file qgstextformatwidget.cpp.
|
protected |
Constructor for QgsTextFormatWidget.
mapCanvas | associated map canvas |
parent | parent widget |
mode | widget mode |
layer | associated vector layer |
Definition at line 53 of file qgstextformatwidget.cpp.
|
signal |
Emitted when an auxiliary field is creatd in the widget.
QgsSymbolWidgetContext QgsTextFormatWidget::context | ( | ) | const |
Returns the context in which the widget is shown, e.g., the associated map canvas and expression contexts.
Definition at line 1049 of file qgstextformatwidget.cpp.
|
overrideprotectedvirtual |
This method needs to be reimplemented in all classes which implement this interface and return an expression context.
Implements QgsExpressionContextGenerator.
Definition at line 1868 of file qgstextformatwidget.cpp.
void QgsTextFormatWidget::deactivateField | ( | QgsPalLayerSettings::Property | key | ) |
Deactivate a field from data defined properties and update the corresponding button.
key | The property key to deactivate |
Definition at line 1054 of file qgstextformatwidget.cpp.
|
protected |
Controls whether data defined alignment buttons are enabled.
enable | set to true to enable alignment controls |
Definition at line 1863 of file qgstextformatwidget.cpp.
QgsTextFormat QgsTextFormatWidget::format | ( | bool | includeDataDefinedProperties = true | ) | const |
Returns the current formatting settings defined by the widget.
If includateDataDefinedProperties is true
, then data defined properties specified in the widget will be included in the format definition.
Definition at line 941 of file qgstextformatwidget.cpp.
|
protectedslot |
Sets up connections required for data defined buttons, or updates the existing definition of these buttons.
Definition at line 634 of file qgstextformatwidget.cpp.
|
protectedvirtualslot |
Saves the current text settings to a style entry.
Definition at line 1689 of file qgstextformatwidget.cpp.
|
virtual |
Sets the context in which the widget is shown, e.g., the associated map canvas and expression contexts.
Definition at line 1075 of file qgstextformatwidget.cpp.
|
slot |
Sets whether the widget should be shown in a compact dock mode.
enabled | set to true to show in dock mode. |
Definition at line 545 of file qgstextformatwidget.cpp.
void QgsTextFormatWidget::setFormat | ( | const QgsTextFormat & | format | ) |
Sets the current formatting settings.
Definition at line 1031 of file qgstextformatwidget.cpp.
|
protectedvirtualslot |
Sets the current text settings from a style entry.
Definition at line 1657 of file qgstextformatwidget.cpp.
|
protected |
Sets the background color for the text preview widget.
color | background color |
Definition at line 1178 of file qgstextformatwidget.cpp.
|
protectedslot |
Updates line placement options to reflect current state of widget.
Definition at line 1489 of file qgstextformatwidget.cpp.
|
protectedslot |
Updates label placement options to reflect current state of widget.
Definition at line 1193 of file qgstextformatwidget.cpp.
|
protectedslot |
|
protected |
Updates the widget's state to reflect the settings in a QgsTextFormat.
format | source format |
Definition at line 792 of file qgstextformatwidget.cpp.
|
signal |
Emitted when the text format defined by the widget changes.
|
protected |
Context in which widget is shown.
Definition at line 185 of file qgstextformatwidget.h.
|
protected |
Data defined properties as defined in the widget.
Definition at line 188 of file qgstextformatwidget.h.
|
protected |
Symbol direction button group.
Definition at line 169 of file qgstextformatwidget.h.
|
protected |
Associated vector layer.
Definition at line 191 of file qgstextformatwidget.h.
|
protected |
Associated map canvas.
Definition at line 182 of file qgstextformatwidget.h.
|
protected |
Pixel size font limit.
Definition at line 179 of file qgstextformatwidget.h.
|
protected |
Line placement button group.
Definition at line 175 of file qgstextformatwidget.h.
|
protected |
Point placement button group.
Definition at line 173 of file qgstextformatwidget.h.
|
protected |
Polygon placement button group.
Definition at line 177 of file qgstextformatwidget.h.
|
protected |
Quadrant button group.
Definition at line 167 of file qgstextformatwidget.h.
|
protected |
Text substitution list.
Definition at line 165 of file qgstextformatwidget.h.
|
protected |
Upside down labels button group.
Definition at line 171 of file qgstextformatwidget.h.
|
read |
Definition at line 53 of file qgstextformatwidget.h.