| QGIS API Documentation
    3.16.0-Hannover (43b64b13f3)
    | 
 
 
 
Go to the documentation of this file.
   16 #ifndef QGSLAYOUTITEMHTML_H 
   17 #define QGSLAYOUTITEMHTML_H 
   19 #include "qgis_core.h" 
   58     int type() 
const override;
 
   59     QIcon 
icon() 
const override;
 
   89     void setUrl( 
const QUrl &url );
 
   97     QUrl 
url()
 const { 
return mUrl; }
 
  108     void setHtml( 
const QString &html );
 
  116     QString 
html()
 const { 
return mHtml; }
 
  134     void setEvaluateExpressions( 
bool evaluateExpressions );
 
  148     void setUseSmartBreaks( 
bool useSmartBreaks );
 
  160     void setMaxBreakDistance( 
double distance );
 
  181     void setUserStylesheet( 
const QString &stylesheet );
 
  196     void setUserStylesheetEnabled( 
bool enabled );
 
  237     std::unique_ptr< QgsWebPage > mWebPage;
 
  239     QString mFetchedHtml;
 
  240     QString mLastFetchedUrl;
 
  241     QString mActualFetchedUrl; 
 
  243     double mHtmlUnitsToLayoutUnits = 1.0;
 
  244     QImage mRenderedPage;
 
  245     bool mEvaluateExpressions = 
true;
 
  246     bool mUseSmartBreaks = 
true;
 
  247     double mMaxBreakDistance = 10.0;
 
  253     QString mUserStylesheet;
 
  254     bool mEnableUserStylesheet = 
false;
 
  257     QString mAtlasFeatureJSON;
 
  261     double htmlUnitsToLayoutUnits(); 
 
  264     void renderCachedImage();
 
  267     QString fetchHtml( 
const QUrl &url );
 
  273     double maxFrameWidth() 
const;
 
  275     void refreshExpressionContext();
 
  283 class JavascriptExecutorLoop : 
public QEventLoop
 
  289     void execIfNotDone();
 
  290     void reportError( 
const QString &error );
 
  300 #endif // QGSLAYOUTITEMHTML_H 
  
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
virtual QSizeF totalSize() const =0
Returns the total size of the multiframe's content, in layout units.
virtual double findNearbyPageBreak(double yPos)
Finds the optimal position to break a frame at.
bool evaluateExpressions() const
Returns whether html item will evaluate QGIS expressions prior to rendering the HTML content.
The class is used as a container of context for various read/write operations on other objects.
virtual void refreshDataDefinedProperty(QgsLayoutObject::DataDefinedProperty property=QgsLayoutObject::AllProperties)
Refreshes a data defined property for the multi frame by reevaluating the property's value and redraw...
Contains settings and helpers relating to a render of a QgsLayoutItem.
A layout multiframe subclass for HTML content.
Abstract base class for layout items with the ability to distribute the content to several frames (Qg...
virtual QIcon icon() const
Returns the item's icon.
QWebPage subclass which redirects JavaScript errors and console output to the QGIS message log.
QString userStylesheet() const
Returns the user stylesheet CSS rules used while rendering the HTML content.
ContentMode
Source modes for the HTML content to render in the item.
@ AllProperties
All properties for item.
virtual int type() const =0
Returns unique multiframe type id.
HTTP network content fetcher.
double maxBreakDistance() const
Returns the maximum distance allowed when calculating where to place page breaks in the html.
bool useSmartBreaks() const
Returns whether html item is using smart breaks.
virtual bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores multiframe state within an XML DOM element.
QString html() const
Returns the HTML source displayed in the item if the item is using the QgsLayoutItemHtml::ManualHtml ...
virtual void render(QgsLayoutItemRenderContext &context, const QRectF &renderExtent, int frameIndex)=0
Renders a portion of the multiframe's content into a render context.
bool userStylesheetEnabled() const
Returns whether user stylesheets are enabled for the HTML content.
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.
ContentMode contentMode() const
Returns the source mode for item's HTML content.
QUrl url() const
Returns the URL of the content displayed in the item if the item is using the QgsLayoutItemHtml::Url ...
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
virtual void recalculateFrameSizes()
Recalculates the portion of the multiframe item which is shown in each of its component frames.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
virtual bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context)
Sets multiframe state from a DOM element.
virtual QString displayName() const
Returns the multiframe display name.
void setContentMode(ContentMode mode)
Sets the source mode for item's HTML content.
DataDefinedProperty
Data defined properties for different item types.
@ Url
Using this mode item fetches its content via a url.