QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
17 #ifndef QGSLAYOUTITEMLABEL_H
18 #define QGSLAYOUTITEMLABEL_H
20 #include "qgis_core.h"
61 int type()
const override;
62 QIcon
icon()
const override;
70 void adjustSizeToText();
76 QSizeF sizeForText()
const;
83 QString
text()
const {
return mText; }
89 void setText(
const QString &text );
96 QString currentText()
const;
109 void setMode( Mode mode );
123 Q_DECL_DEPRECATED
void setFont( const QFont &font )
SIP_DEPRECATED;
130 Qt::AlignmentFlag vAlign()
const {
return mVAlignment; }
137 Qt::AlignmentFlag
hAlign()
const {
return mHAlignment; }
144 void setHAlign( Qt::AlignmentFlag alignment ) { mHAlignment = alignment; }
151 void setVAlign( Qt::AlignmentFlag alignment ) { mVAlignment = alignment; }
180 void setMargin(
double margin );
188 void setMarginX(
double margin );
196 void setMarginY(
double margin );
214 QRectF boundingRect()
const override;
247 void convertToStaticText();
257 void loadingHtmlFinished(
bool );
259 void refreshExpressionContext();
262 bool mFirstRender =
true;
267 Mode mMode = ModeFont;
268 double mHtmlUnitsToLayoutUnits = 1.0;
269 double htmlUnitsToLayoutUnits();
270 bool mHtmlLoaded =
false;
273 void itemShiftAdjustSize(
double newWidth,
double newHeight,
double &xShift,
double &yShift )
const;
276 void contentChanged();
281 double mMarginX = 0.0;
283 double mMarginY = 0.0;
286 Qt::AlignmentFlag mHAlignment = Qt::AlignJustify;
289 Qt::AlignmentFlag mVAlignment = Qt::AlignTop;
292 void replaceDateText( QString &text )
const;
295 QUrl createStylesheetUrl()
const;
297 std::unique_ptr< QgsDistanceArea > mDistanceArea;
299 std::unique_ptr< QgsWebPage > mWebPage;
302 #endif //QGSLAYOUTITEMLABEL_H
virtual bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores item state within an XML DOM element.
virtual void setFrameEnabled(bool drawFrame)
Sets whether this item has a frame drawn around it or not.
double marginY() const
Returns the vertical margin between the edge of the frame and the label contents, in layout units.
The class is used as a container of context for various read/write operations on other objects.
virtual void setFrameStrokeWidth(QgsLayoutMeasurement width)
Sets the frame stroke width.
virtual QIcon icon() const
Returns the item's icon.
Contains settings and helpers relating to a render of a QgsLayoutItem.
@ ModeFont
Label displays text rendered using a single font.
void setHAlign(Qt::AlignmentFlag alignment)
Sets the horizontal alignment of the label.
void setVAlign(Qt::AlignmentFlag alignment)
Sets for the vertical alignment of the label.
Mode mode() const
Returns the label's current mode.
virtual bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context)
Sets item state from a DOM element.
virtual void draw(QgsLayoutItemRenderContext &context)=0
Draws the item's contents using the specified item render context.
int type() const override
Returns a unique graphics item type identifier.
Q_DECL_DEPRECATED void setFontColor(const QColor &color)
Sets the label font color.
Container for all settings relating to text rendering.
double marginX() const
Returns the horizontal margin between the edge of the frame and the label contents,...
Qt::AlignmentFlag hAlign() const
Returns the horizontal alignment of the label.
Base class for graphical items within a QgsLayout.
@ ModeHtml
Label displays rendered HTML content.
void refresh() override
Refreshes the item, causing a recalculation of any property overrides and recalculation of its positi...
QString text() const
Returns the label's preset text.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Represents a vector layer which manages a vector based data sets.
Q_DECL_DEPRECATED QColor fontColor() const
Returns the label font color.
virtual QString displayName() const
Gets item display name.
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
A layout item subclass for text labels.
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...