16#ifndef QGSLAYOUTITEMHTML_H
17#define QGSLAYOUTITEMHTML_H
58 int type()
const override;
59 QIcon
icon()
const override;
96 void setUrl(
const QUrl &url );
104 QUrl
url()
const {
return mUrl; }
115 void setHtml(
const QString &html );
123 QString
html()
const {
return mHtml; }
141 void setEvaluateExpressions(
bool evaluateExpressions );
155 void setUseSmartBreaks(
bool useSmartBreaks );
167 void setMaxBreakDistance(
double distance );
188 void setUserStylesheet(
const QString &stylesheet );
203 void setUserStylesheetEnabled(
bool enabled );
244 std::unique_ptr< QgsWebPage > mWebPage;
246 QString mFetchedHtml;
247 QString mLastFetchedUrl;
248 QString mActualFetchedUrl;
250 double mHtmlUnitsToLayoutUnits = 1.0;
251 QImage mRenderedPage;
252 bool mEvaluateExpressions =
true;
253 bool mUseSmartBreaks =
true;
254 double mMaxBreakDistance = 10.0;
260 QString mUserStylesheet;
261 bool mEnableUserStylesheet =
false;
264 QString mAtlasFeatureJSON;
268 double htmlUnitsToLayoutUnits();
271 void renderCachedImage();
274 QString fetchHtml(
const QUrl &url );
280 double maxFrameWidth()
const;
282 void refreshExpressionContext();
290class JavascriptExecutorLoop :
public QEventLoop
296 void execIfNotDone();
297 void reportError(
const QString &error );
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
A layout multiframe subclass for HTML content.
bool userStylesheetEnabled() const
Returns whether user stylesheets are enabled for the HTML content.
ContentMode contentMode() const
Returns the source mode for item's HTML content.
ContentMode
Source modes for the HTML content to render in the item.
@ Url
Using this mode item fetches its content via a url.
QString userStylesheet() const
Returns the user stylesheet CSS rules used while rendering the HTML content.
QString html() const
Returns the HTML source displayed in the item if the item is using the QgsLayoutItemHtml::ManualHtml ...
double maxBreakDistance() const
Returns the maximum distance allowed when calculating where to place page breaks in the html.
bool evaluateExpressions() const
Returns whether html item will evaluate QGIS expressions prior to rendering the HTML content.
QUrl url() const
Returns the URL of the content displayed in the item if the item is using the QgsLayoutItemHtml::Url ...
void setContentMode(ContentMode mode)
Sets the source mode for item's HTML content.
bool useSmartBreaks() const
Returns whether html item is using smart breaks.
A layout item subclass for text labels.
Contains settings and helpers relating to a render of a QgsLayoutItem.
Abstract base class for layout items with the ability to distribute the content to several frames (Qg...
virtual bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores multiframe state within an XML DOM element.
virtual QSizeF totalSize() const =0
Returns the total size of the multiframe's content, in layout units.
virtual int type() const =0
Returns unique multiframe type id.
virtual QIcon icon() const
Returns the item's icon.
virtual double findNearbyPageBreak(double yPos)
Finds the optimal position to break a frame at.
virtual void recalculateFrameSizes()
Recalculates the portion of the multiframe item which is shown in each of its component frames.
virtual void refreshDataDefinedProperty(QgsLayoutObject::DataDefinedProperty property=QgsLayoutObject::DataDefinedProperty::AllProperties)
Refreshes a data defined property for the multi frame by reevaluating the property's value and redraw...
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.
virtual void render(QgsLayoutItemRenderContext &context, const QRectF &renderExtent, int frameIndex)=0
Renders a portion of the multiframe's content into a render context.
DataDefinedProperty
Data defined properties for different item types.
@ AllProperties
All properties for item.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
HTTP network content fetcher.
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.
QWebPage subclass which redirects JavaScript errors and console output to the QGIS message log.