QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
#include <qgstextfragment.h>
Public Member Functions | |
QgsTextFragment (const QString &text=QString(), const QgsTextCharacterFormat &format=QgsTextCharacterFormat()) | |
Constructor for QgsTextFragment, with the specified text and optional character format. More... | |
QgsTextFragment (const QTextFragment &fragment) | |
Constructor for QgsTextFragment, based on the specified QTextFragment fragment. More... | |
const QgsTextCharacterFormat & | characterFormat () const |
Returns the character formatting for the fragment. More... | |
double | horizontalAdvance (const QFont &font, bool fontHasBeenUpdatedForFragment=false) const |
Returns the horizontal advance associated with this fragment, when rendered using the specified base font. More... | |
void | setCharacterFormat (const QgsTextCharacterFormat &format) |
Sets the character format for the fragment. More... | |
void | setText (const QString &text) |
Sets the text content of the fragment. More... | |
QString | text () const |
Returns the text content of the fragment. More... | |
Stores a fragment of text along with formatting overrides to be used when rendering the fragment.
Definition at line 34 of file qgstextfragment.h.
|
explicit |
Constructor for QgsTextFragment, with the specified text and optional character format.
Definition at line 20 of file qgstextfragment.cpp.
|
explicit |
Constructor for QgsTextFragment, based on the specified QTextFragment fragment.
Definition at line 25 of file qgstextfragment.cpp.
|
inline |
Returns the character formatting for the fragment.
Definition at line 67 of file qgstextfragment.h.
double QgsTextFragment::horizontalAdvance | ( | const QFont & | font, |
bool | fontHasBeenUpdatedForFragment = false |
||
) | const |
Returns the horizontal advance associated with this fragment, when rendered using the specified base font.
Set fontHasBeenUpdatedForFragment to true
if font already represents the character format for this fragment.
Definition at line 47 of file qgstextfragment.cpp.
void QgsTextFragment::setCharacterFormat | ( | const QgsTextCharacterFormat & | format | ) |
Sets the character format for the fragment.
Definition at line 42 of file qgstextfragment.cpp.
void QgsTextFragment::setText | ( | const QString & | text | ) |
Sets the text content of the fragment.
Definition at line 37 of file qgstextfragment.cpp.
QString QgsTextFragment::text | ( | ) | const |
Returns the text content of the fragment.
Definition at line 32 of file qgstextfragment.cpp.