17 #ifndef QGSLAYOUTITEMLABEL_H 
   18 #define QGSLAYOUTITEMLABEL_H 
   20 #include "qgis_core.h" 
   60     int type() 
const override;
 
   61     QIcon 
icon() 
const override;
 
   69     void adjustSizeToText();
 
   75     QSizeF sizeForText() 
const;
 
   82     QString 
text()
 const { 
return mText; }
 
   88     void setText( 
const QString &text );
 
   95     QString currentText() 
const;
 
  108     void setMode( Mode mode );
 
  120     void setFont( 
const QFont &font );
 
  127     Qt::AlignmentFlag 
vAlign()
 const { 
return mVAlignment; }
 
  134     Qt::AlignmentFlag 
hAlign()
 const { 
return mHAlignment; }
 
  141     void setHAlign( Qt::AlignmentFlag alignment ) { mHAlignment = alignment; }
 
  148     void setVAlign( Qt::AlignmentFlag alignment ) { mVAlignment = alignment; }
 
  177     void setMargin( 
double margin );
 
  185     void setMarginX( 
double margin );
 
  193     void setMarginY( 
double margin );
 
  209     QRectF boundingRect() 
const override;
 
  227     void convertToStaticText();
 
  237     void loadingHtmlFinished( 
bool );
 
  239     void refreshExpressionContext();
 
  242     bool mFirstRender = 
true;
 
  247     Mode mMode = ModeFont;
 
  248     double mHtmlUnitsToLayoutUnits = 1.0;
 
  249     double htmlUnitsToLayoutUnits(); 
 
  250     bool mHtmlLoaded = 
false;
 
  253     void itemShiftAdjustSize( 
double newWidth, 
double newHeight, 
double &xShift, 
double &yShift ) 
const;
 
  256     void contentChanged();
 
  262     double mMarginX = 0.0;
 
  264     double mMarginY = 0.0;
 
  267     QColor mFontColor = QColor( 0, 0, 0 );
 
  270     Qt::AlignmentFlag mHAlignment = Qt::AlignJustify;
 
  273     Qt::AlignmentFlag mVAlignment = Qt::AlignTop;
 
  276     void replaceDateText( QString &text ) 
const;
 
  279     QUrl createStylesheetUrl() 
const;
 
  281     std::unique_ptr< QgsDistanceArea > mDistanceArea;
 
  283     std::unique_ptr< QgsWebPage > mWebPage;
 
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.
Mode mode() const
Returns the label's current mode.
void setHAlign(Qt::AlignmentFlag alignment)
Sets the horizontal alignment of the label.
double marginX() const
Returns the horizontal margin between the edge of the frame and the label contents,...
Qt::AlignmentFlag vAlign() const
Returns for the vertical alignment of the label.
double marginY() const
Returns the vertical margin between the edge of the frame and the label contents, in layout units.
QColor fontColor() const
Returns the label font color.
QString text() const
Returns the label's preset text.
void setVAlign(Qt::AlignmentFlag alignment)
Sets for the vertical alignment of the label.
Qt::AlignmentFlag hAlign() const
Returns the horizontal alignment of the label.
void setFontColor(const QColor &color)
Sets the label font color.
@ ModeHtml
Label displays rendered HTML content.
@ ModeFont
Label displays text rendered using a single font.
Contains settings and helpers relating to a render of a QgsLayoutItem.
Base class for graphical items within a QgsLayout.
virtual void setFrameStrokeWidth(QgsLayoutMeasurement width)
Sets the frame stroke width.
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.
int type() const override
Returns a unique graphics item type identifier.
virtual QString displayName() const
Gets item display name.
virtual QIcon icon() const
Returns the item's icon.
virtual bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context)
Sets item state from a DOM element.
void refresh() override
Refreshes the item, causing a recalculation of any property overrides and recalculation of its positi...
virtual void draw(QgsLayoutItemRenderContext &context)=0
Draws the item's contents using the specified item render context.
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
The class is used as a container of context for various read/write operations on other objects.
Represents a vector layer which manages a vector based data sets.