17 #ifndef QGSLAYOUTITEMLABEL_H 18 #define QGSLAYOUTITEMLABEL_H 20 #include "qgis_core.h" 59 int type()
const override;
60 QIcon
icon()
const override;
68 void adjustSizeToText();
74 QSizeF sizeForText()
const;
81 QString
text()
const {
return mText; }
87 void setText(
const QString &text );
94 QString currentText()
const;
107 void setMode(
Mode mode );
119 void setFont(
const QFont &font );
126 Qt::AlignmentFlag
vAlign()
const {
return mVAlignment; }
133 Qt::AlignmentFlag
hAlign()
const {
return mHAlignment; }
140 void setHAlign( Qt::AlignmentFlag alignment ) { mHAlignment = alignment; }
147 void setVAlign( Qt::AlignmentFlag alignment ) { mVAlignment = alignment; }
176 void setMargin(
double margin );
184 void setMarginX(
double margin );
192 void setMarginY(
double margin );
208 QRectF boundingRect()
const override;
228 void loadingHtmlFinished(
bool );
230 void refreshExpressionContext();
233 bool mFirstRender =
true;
238 Mode mMode = ModeFont;
239 double mHtmlUnitsToLayoutUnits = 1.0;
240 double htmlUnitsToLayoutUnits();
241 bool mHtmlLoaded =
false;
244 void itemShiftAdjustSize(
double newWidth,
double newHeight,
double &xShift,
double &yShift )
const;
247 void contentChanged();
253 double mMarginX = 0.0;
255 double mMarginY = 0.0;
258 QColor mFontColor = QColor( 0, 0, 0 );
261 Qt::AlignmentFlag mHAlignment = Qt::AlignJustify;
264 Qt::AlignmentFlag mVAlignment = Qt::AlignTop;
267 void replaceDateText( QString &text )
const;
270 QUrl createStylesheetUrl()
const;
272 std::unique_ptr< QgsDistanceArea > mDistanceArea;
274 std::unique_ptr< QgsWebPage > mWebPage;
277 #endif //QGSLAYOUTITEMLABEL_H The class is used as a container of context for various read/write operations on other objects...
virtual QIcon icon() const
Returns the item's icon.
double marginX() const
Returns the horizontal margin between the edge of the frame and the label contents, in layout units.
Base class for graphical items within a QgsLayout.
void setVAlign(Qt::AlignmentFlag alignment)
Sets for the vertical alignment of the label.
int type() const override
Returns a unique graphics item type identifier.
Mode mode() const
Returns the label's current mode.
A layout item subclass for text labels.
Label displays rendered HTML content.
QColor fontColor() const
Returns the label font color.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QString text() const
Returns the label's preset text.
void setHAlign(Qt::AlignmentFlag alignment)
Sets the horizontal alignment of the label.
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...
virtual bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context)
Sets item state from a DOM element.
Qt::AlignmentFlag hAlign() const
Returns the horizontal alignment of the label.
Qt::AlignmentFlag vAlign() const
Returns for the vertical alignment of the label.
virtual void setFrameStrokeWidth(const QgsLayoutMeasurement &width)
Sets the frame stroke width.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Contains settings and helpers relating to a render of a QgsLayoutItem.
Label displays text rendered using a single font.
void setFontColor(const QColor &color)
Sets 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...
virtual bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores item state within an XML DOM element.
double marginY() const
Returns the vertical margin between the edge of the frame and the label contents, in layout units...
virtual void setFrameEnabled(bool drawFrame)
Sets whether this item has a frame drawn around it or not.
virtual void draw(QgsLayoutItemRenderContext &context)=0
Draws the item's contents using the specified item render context.
Represents a vector layer which manages a vector based data sets.
void refresh() override
Refreshes the item, causing a recalculation of any property overrides and recalculation of its positi...