Subgroup: Layout
Class: QgsLayoutItemHtml¶
-
class
qgis.core.
QgsLayoutItemHtml
¶ Bases:
qgis._core.QgsLayoutMultiFrame
A layout multiframe subclass for HTML content.
New in version 3.0: Methods
addFrame
Adds a frame
to the multiframe.beginCommand
Starts new undo command for this item. blockSignals
cancelCommand
Cancels the current item command and discards it. childEvent
children
connectNotify
contentMode
Returns the source mode for item’s HTML content. create
Returns a new QgsLayoutItemHtml for the specified parent layout
.createCommand
createExpressionContext
Creates an expression context relating to the objects’ current state. createNewFrame
Creates a new frame and adds it to the multi frame and layout. customEvent
customProperties
Return list of keys stored in custom properties for the object. customProperty
Read a custom property from the object. dataDefinedProperties
Returns a reference to the object’s property collection, used for data defined overrides. deleteFrames
Removes and deletes all child frames. deleteLater
disconnect
disconnectNotify
displayName
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
endCommand
Completes the current item command and push it onto the layout’s undo stack. evaluateExpressions
Returns whether html item will evaluate QGIS expressions prior to rendering the HTML content. event
eventFilter
finalizeRestoreFromXml
Called after all pending items have been restored from XML. findChild
findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject findChildren
findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findNearbyPageBreak
fixedFrameSize
Returns the fixed size for a frame, if desired. frame
Returns the child frame at a specified index
from the multiframe.frameCount
Returns the number of frames associated with this multiframe. frameIndex
Returns the index of a frame
within the multiframe.frames
Returns a list of all child frames for this multiframe. html
Returns the HTML source displayed in the item if the item is using the QgsLayoutItemHtml.ManualHtml mode. icon
inherits
installEventFilter
isSignalConnected
isWidgetType
isWindowType
killTimer
layout
Returns the layout the object is attached to. loadHtml
Reloads the html source from the url and redraws the item. maxBreakDistance
Returns the maximum distance allowed when calculating where to place page breaks in the html. metaObject
minFrameSize
Returns the minimum size for a frames, if desired. moveToThread
objectName
parent
property
propertyDefinitions
Returns the layout object property definitions. pyqtConfigure
Each keyword argument is either the name of a Qt property or a Qt signal. readObjectPropertiesFromElement
readPropertiesFromElement
readXml
Sets the item state from a DOM element. recalculateFrameRects
Forces a recalculation of all the associated frame’s scene rectangles. recalculateFrameSizes
Recalculates the frame sizes for the current viewport dimensions receivers
refresh
Refreshes the multiframe, causing a recalculation of any property overrides. refreshDataDefinedProperty
removeCustomProperty
Remove a custom property from the object. removeEventFilter
removeFrame
Removes a frame by index
from the multiframe.render
resizeMode
Returns the resize mode for the multiframe. sender
senderSignalIndex
setContentMode
Sets the source mode
for item’s HTML content.setCustomProperty
Set a custom property for the object. setDataDefinedProperties
Sets the objects’s property collection, used for data defined overrides. setEvaluateExpressions
Sets whether the html item will evaluate QGIS expressions prior to rendering the HTML content. setHtml
Sets the html
to display in the item when the item is using the QgsLayoutItemHtml.ManualHtml mode.setMaxBreakDistance
Sets the maximum distance
allowed when calculating where to place page breaks in the html.setObjectName
setParent
setProperty
setResizeMode
Sets the resize mode
for the multiframe, and recalculates frame sizes to match.setUrl
Sets the url
for content to display in the item when the item is using the QgsLayoutItemHtml.Url mode.setUseSmartBreaks
Sets whether the html item should use smart breaks. setUserStylesheet
Sets the user stylesheet
CSS rules to use while rendering the HTML content.setUserStylesheetEnabled
Sets whether user stylesheets are enabled
for the HTML content.signalsBlocked
startTimer
thread
timerEvent
totalSize
tr
type
update
Forces a redraw of all child frames. url
Returns the URL of the content displayed in the item if the item is using the QgsLayoutItemHtml.Url mode. useSmartBreaks
Returns whether html item is using smart breaks. userStylesheet
Returns the user stylesheet CSS rules used while rendering the HTML content. userStylesheetEnabled
Returns whether user stylesheets are enabled for the HTML content. uuid
Returns the multiframe identification string. writeObjectPropertiesToElement
writePropertiesToElement
writeXml
Stores the multiframe state in a DOM element. Attributes
AllProperties
BackgroundColor
BlendMode
EvaluatedValue
ExcludeFromExports
ExtendToNextPage
FrameColor
ItemHeight
ItemRotation
ItemWidth
LegendColumnCount
LegendTitle
ManualHtml
MapAtlasMargin
MapLayers
MapRotation
MapScale
MapStylePreset
MapXMax
MapXMin
MapYMax
MapYMin
NoProperty
NumPages
Opacity
OriginalValue
PageNumber
PaperHeight
PaperOrientation
PaperWidth
PictureSource
PictureSvgBackgroundColor
PictureSvgStrokeColor
PictureSvgStrokeWidth
PositionX
PositionY
PresetPaperSize
RepeatOnEveryPage
RepeatUntilFinished
ScalebarFillColor
ScalebarFillColor2
ScalebarLineColor
ScalebarLineWidth
SourceUrl
TestProperty
Transparency
UndoHtmlBreakDistance
UndoHtmlSource
UndoHtmlStylesheet
UndoNone
UndoTableBackgroundColor
UndoTableCellStyle
UndoTableContentFontColor
UndoTableGridColor
UndoTableGridStrokeWidth
UndoTableHeaderFontColor
UndoTableMargin
UndoTableMaximumFeatures
Url
UseExistingFrames
changed
Emitted when the properties of a multi frame have changed, and the GUI item widget must be updated. contentsChanged
Emitted when the contents of the multi frame have changed and the frames must be redrawn. destroyed
destroyed(self, QObject = None) [signal] objectNameChanged
objectNameChanged(self, str) [signal] staticMetaObject
-
class
ContentMode
¶ Bases:
int
-
ManualHtml
= 1¶
-
Url
= 0¶
-
childEvent
()¶
-
connectNotify
()¶
-
contentMode
(self) → QgsLayoutItemHtml.ContentMode¶ Returns the source mode for item’s HTML content.
See also
See also
See also
-
create
(layout: QgsLayout) → QgsLayoutItemHtml¶ Returns a new QgsLayoutItemHtml for the specified parent
layout
.
-
customEvent
()¶
-
disconnectNotify
()¶
-
displayName
(self) → str¶
-
evaluateExpressions
(self) → bool¶ Returns whether html item will evaluate QGIS expressions prior to rendering the HTML content. If set, any content inside [% %] tags will be treated as a QGIS expression and evaluated against the current atlas feature.
See also
-
findNearbyPageBreak
(self, yPos: float) → float¶
-
html
(self) → str¶ Returns the HTML source displayed in the item if the item is using the QgsLayoutItemHtml.ManualHtml mode.
See also
See also
-
icon
(self) → QIcon¶
-
isSignalConnected
()¶
-
loadHtml
(self, useCache: bool = False, context: QgsExpressionContext = None)¶ Reloads the html source from the url and redraws the item.
Parameters: useCache – set to true to use a cached copy of remote html content :param context: expression context for evaluating data defined urls and expressions in html
See also
See also
-
maxBreakDistance
(self) → float¶ Returns the maximum distance allowed when calculating where to place page breaks in the html. This distance is the maximum amount of empty space allowed at the bottom of a frame after calculating the optimum break location. This setting is only effective if useSmartBreaks is true.
See also
See also
-
readObjectPropertiesFromElement
()¶
-
readPropertiesFromElement
(self, itemElem: QDomElement, doc: QDomDocument, context: QgsReadWriteContext) → bool¶
-
recalculateFrameSizes
(self)¶ Recalculates the frame sizes for the current viewport dimensions
-
receivers
()¶
-
refreshDataDefinedProperty
(self, property: QgsLayoutObject.DataDefinedProperty = QgsLayoutObject.AllProperties)¶
-
render
(self, context: QgsRenderContext, renderExtent: QRectF, frameIndex: int, itemStyle: QStyleOptionGraphicsItem = None)¶
-
sender
()¶
-
senderSignalIndex
()¶
-
setContentMode
(self, mode: QgsLayoutItemHtml.ContentMode)¶ Sets the source
mode
for item’s HTML content.See also
See also
See also
-
setEvaluateExpressions
(self, evaluateExpressions: bool)¶ Sets whether the html item will evaluate QGIS expressions prior to rendering the HTML content. If set, any content inside [% %] tags will be treated as a QGIS expression and evaluated against the current atlas feature.
See also
-
setHtml
(self, html: str)¶ Sets the
html
to display in the item when the item is using the QgsLayoutItemHtml.ManualHtml mode. Setting the HTML using this function does not automatically refresh the item’s contents. Call loadHtml to trigger a refresh of the item after setting the HTML content.See also
See also
See also
-
setMaxBreakDistance
(self, distance: float)¶ Sets the maximum
distance
allowed when calculating where to place page breaks in the html. This distance is the maximum amount of empty space allowed at the bottom of a frame after calculating the optimum break location. Setting a larger value will result in better choice of page break location, but more wasted space at the bottom of frames. This setting is only effective if useSmartBreaks is true.See also
See also
-
setUrl
(self, url: QUrl)¶ Sets the
url
for content to display in the item when the item is using the QgsLayoutItemHtml.Url mode. Content is automatically fetched and the HTML item refreshed after calling this function.See also
See also
-
setUseSmartBreaks
(self, useSmartBreaks: bool)¶ Sets whether the html item should use smart breaks. Smart breaks prevent the html frame contents from breaking mid-way though a line of text.
See also
-
setUserStylesheet
(self, stylesheet: str)¶ Sets the user
stylesheet
CSS rules to use while rendering the HTML content. These allow for overriding the styles specified within the HTML source. Setting the stylesheet using this function does not automatically refresh the item’s contents. Call loadHtml to trigger a refresh of the item after setting the stylesheet rules.See also
See also
See also
-
setUserStylesheetEnabled
(self, enabled: bool)¶ Sets whether user stylesheets are
enabled
for the HTML content.See also
See also
-
timerEvent
()¶
-
totalSize
(self) → QSizeF¶
-
type
(self) → int¶
-
url
(self) → QUrl¶ Returns the URL of the content displayed in the item if the item is using the QgsLayoutItemHtml.Url mode.
See also
See also
-
useSmartBreaks
(self) → bool¶ Returns whether html item is using smart breaks. Smart breaks prevent the html frame contents from breaking mid-way though a line of text.
See also
-
userStylesheet
(self) → str¶ Returns the user stylesheet CSS rules used while rendering the HTML content. These overriding the styles specified within the HTML source.
See also
See also
-
userStylesheetEnabled
(self) → bool¶ Returns whether user stylesheets are enabled for the HTML content.
See also
See also
-
writeObjectPropertiesToElement
()¶
-
writePropertiesToElement
(self, elem: QDomElement, doc: QDomDocument, context: QgsReadWriteContext) → bool¶
-
class