QGIS API Documentation
2.8.2-Wien
|
#include <qgscomposerhtml.h>
Public Types | |
enum | ContentMode { Url, ManualHtml } |
Source modes for the HTML content to render in the item. More... | |
Public Types inherited from QgsComposerMultiFrame | |
enum | ResizeMode { UseExistingFrames = 0, ExtendToNextPage, RepeatOnEveryPage, RepeatUntilFinished } |
Public Types inherited from QgsComposerObject | |
enum | DataDefinedProperty { NoProperty = 0, AllProperties, TestProperty, PresetPaperSize, PaperWidth, PaperHeight, NumPages, PaperOrientation, PageNumber, PositionX, PositionY, ItemWidth, ItemHeight, ItemRotation, Transparency, BlendMode, ExcludeFromExports, MapRotation, MapScale, MapXMin, MapYMin, MapXMax, MapYMax, MapAtlasMargin, PictureSource, SourceUrl } |
Data defined properties for different item types. More... | |
enum | PropertyValueType { EvaluatedValue = 0, OriginalValue } |
Specifies whether the value returned by a function should be the original, user set value, or the current evaluated value for the property. More... |
Public Slots | |
void | loadHtml (const bool useCache=false) |
Reloads the html source from the url and redraws the item. | |
void | recalculateFrameSizes () override |
Recalculates the frame sizes for the current viewport dimensions. | |
virtual void | refreshDataDefinedProperty (const QgsComposerObject::DataDefinedProperty property=QgsComposerObject::AllProperties) override |
void | refreshExpressionContext () |
Public Slots inherited from QgsComposerMultiFrame | |
void | recalculateFrameRects () |
Forces a recalculation of all the associated frame's scene rectangles. | |
virtual void | recalculateFrameSizes () |
Recalculates the portion of the multiframe item which is shown in each of it's component frames. | |
void | update () |
Forces a redraw of all child frames. | |
Public Slots inherited from QgsComposerObject | |
virtual void | refreshDataDefinedProperty (const DataDefinedProperty property=AllProperties) |
Refreshes a data defined property for the item by reevaluating the property's value and redrawing the item with this new value. | |
virtual void | repaint () |
Triggers a redraw for the item. |
Public Member Functions | |
QgsComposerHtml (QgsComposition *c, bool createUndoCommands) | |
QgsComposerHtml () | |
~QgsComposerHtml () | |
void | addFrame (QgsComposerFrame *frame, bool recalcFrameSizes=true) override |
Adds a frame to the multiframe. | |
ContentMode | contentMode () const |
Returns the source mode for item's HTML content. | |
virtual QString | displayName () const override |
Get multiframe display name. | |
bool | evaluateExpressions () const |
Returns whether html item will evaluate QGIS expressions prior to rendering the HTML content. | |
double | findNearbyPageBreak (double yPos) override |
Finds the optimal position to break a frame at. | |
QString | html () const |
Returns the HTML source displayed in the item if the item is using the QgsComposerHtml::ManualHtml mode. | |
double | maxBreakDistance () const |
Returns the maximum distance allowed when calculating where to place page breaks in the html. | |
bool | readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false) override |
Reads multiframe state information from a DOM element. | |
void | render (QPainter *p, const QRectF &renderExtent, const int frameIndex) override |
Renders a portion of the multiframe's content into a painter. | |
void | setContentMode (ContentMode mode) |
Sets the source mode for item's HTML content. | |
void | setEvaluateExpressions (bool evaluateExpressions) |
Sets whether the html item will evaluate QGIS expressions prior to rendering the HTML content. | |
void | setHtml (const QString html) |
Sets the HTML to display in the item when the item is using the QgsComposerHtml::ManualHtml mode. | |
void | setMaxBreakDistance (double maxBreakDistance) |
Sets the maximum distance allowed when calculating where to place page breaks in the html. | |
void | setUrl (const QUrl &url) |
Sets the URL for content to display in the item when the item is using the QgsComposerHtml::Url mode. | |
void | setUserStylesheet (const QString stylesheet) |
Sets the user stylesheet CSS rules to use while rendering the HTML content. | |
void | setUserStylesheetEnabled (const bool stylesheetEnabled) |
Sets whether user stylesheets are enabled for the HTML content. | |
void | setUseSmartBreaks (bool useSmartBreaks) |
Sets whether the html item should use smart breaks. | |
QSizeF | totalSize () const override |
Returns the total size of the multiframe's content. | |
const QUrl & | url () const |
Returns the URL of the content displayed in the item if the item is using the QgsComposerHtml::Url mode. | |
QString | userStylesheet () const |
Returns the user stylesheet CSS rules used while rendering the HTML content. | |
bool | userStylesheetEnabled () const |
Returns whether user stylesheets are enabled for the HTML content. | |
bool | useSmartBreaks () const |
Returns whether html item is using smart breaks. | |
bool | writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const override |
Stores state information about multiframe in DOM element. | |
Public Member Functions inherited from QgsComposerMultiFrame | |
QgsComposerMultiFrame (QgsComposition *c, bool createUndoCommands) | |
Construct a new multiframe item. | |
virtual | ~QgsComposerMultiFrame () |
bool | _readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false) |
Restores state information about base multiframe object from a DOM element. | |
bool | _writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const |
Stores state information about base multiframe object in DOM element. | |
QgsComposition * | composition () |
Returns the parent composition for the multiframe. | |
QgsComposerFrame * | createNewFrame (QgsComposerFrame *currentFrame, QPointF pos, QSizeF size) |
Creates a new frame and adds it to the multi frame and composition. | |
bool | createUndoCommands () const |
Returns whether undo commands should be created for interactions with the multiframe. | |
void | deleteFrames () |
Removes and deletes all child frames. | |
virtual QSizeF | fixedFrameSize (const int frameIndex=-1) const |
Returns the fixed size for a frame, if desired. | |
QgsComposerFrame * | frame (int i) const |
Returns a child frame from the multiframe. | |
int | frameCount () const |
Returns the number of frames associated with this multiframe. | |
int | frameIndex (QgsComposerFrame *frame) const |
Returns the index of a frame within the multiframe. | |
virtual QSizeF | minFrameSize (const int frameIndex=-1) const |
Returns the minimum size for a frames, if desired. | |
void | removeFrame (int i, const bool removeEmptyPages=false) |
Removes a frame from the multiframe. | |
virtual Q_DECL_DEPRECATED void | render (QPainter *p, const QRectF &renderExtent) |
Renders a portion of the multiframe's content into a painter. | |
ResizeMode | resizeMode () const |
Returns the resize mode for the multiframe. | |
void | setCreateUndoCommands (bool enabled) |
Sets whether undo commands should be created for interactions with the multiframe. | |
void | setResizeMode (ResizeMode mode) |
Sets the resize mode for the multiframe, and recalculates frame sizes to match. | |
Public Member Functions inherited from QgsComposerObject | |
QgsComposerObject (QgsComposition *composition) | |
Constructor. | |
virtual | ~QgsComposerObject () |
const QgsComposition * | composition () const |
Returns the composition the item is attached to. | |
QgsDataDefined * | dataDefinedProperty (const DataDefinedProperty property) const |
Returns a reference to the data defined settings for one of the item's data defined properties. | |
virtual bool | readXML (const QDomElement &itemElem, const QDomDocument &doc) |
Sets item state from DOM element. | |
void | setDataDefinedProperty (const DataDefinedProperty property, const bool active, const bool useExpression, const QString &expression, const QString &field) |
Sets parameters for a data defined property for the item. | |
virtual bool | writeXML (QDomElement &elem, QDomDocument &doc) const |
Stores item state in DOM element. |
Additional Inherited Members | |
Signals inherited from QgsComposerMultiFrame | |
void | changed () |
Emitted when the properties of a multi frame have changed, and the GUI item widget must be updated. | |
void | contentsChanged () |
Emitted when the contents of the multi frame have changed and the frames must be redrawn. | |
Protected Slots inherited from QgsComposerMultiFrame | |
void | handleFrameRemoval (QgsComposerItem *item) |
Called before a frame is going to be removed. | |
void | handlePageChange () |
Adapts to changed number of composition pages if resize type is RepeatOnEveryPage. | |
Protected Member Functions inherited from QgsComposerObject | |
bool | dataDefinedEvaluate (const QgsComposerObject::DataDefinedProperty property, QVariant &expressionValue) |
Evaluate a data defined property and return the calculated value. | |
Protected Attributes inherited from QgsComposerMultiFrame | |
bool | mCreateUndoCommands |
True: creates QgsMultiFrameCommands on internal changes (e.g. | |
QList< QgsComposerFrame * > | mFrameItems |
ResizeMode | mResizeMode |
Definition at line 29 of file qgscomposerhtml.h.
Source modes for the HTML content to render in the item.
Definition at line 36 of file qgscomposerhtml.h.
QgsComposerHtml::QgsComposerHtml | ( | QgsComposition * | c, |
bool | createUndoCommands | ||
) |
Definition at line 35 of file qgscomposerhtml.cpp.
QgsComposerHtml::QgsComposerHtml | ( | ) |
Definition at line 88 of file qgscomposerhtml.cpp.
QgsComposerHtml::~QgsComposerHtml | ( | ) |
Definition at line 109 of file qgscomposerhtml.cpp.
|
overridevirtual |
Adds a frame to the multiframe.
frame | frame to add |
recalcFrameSizes | set to true to force recalculation of all existing frame sizes |
Implements QgsComposerMultiFrame.
Definition at line 333 of file qgscomposerhtml.cpp.
|
inline |
Returns the source mode for item's HTML content.
Definition at line 65 of file qgscomposerhtml.h.
|
overridevirtual |
Get multiframe display name.
Reimplemented from QgsComposerMultiFrame.
Definition at line 474 of file qgscomposerhtml.cpp.
|
inline |
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.
Definition at line 113 of file qgscomposerhtml.h.
|
overridevirtual |
Finds the optimal position to break a frame at.
yPos | maximum vertical position for break |
Reimplemented from QgsComposerMultiFrame.
Definition at line 360 of file qgscomposerhtml.cpp.
|
inline |
Returns the HTML source displayed in the item if the item is using the QgsComposerHtml::ManualHtml mode.
Definition at line 103 of file qgscomposerhtml.h.
|
slot |
Reloads the html source from the url and redraws the item.
useCache | set to true to use a cached copy of remote html content |
Definition at line 145 of file qgscomposerhtml.cpp.
|
inline |
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.
Definition at line 163 of file qgscomposerhtml.h.
|
overridevirtual |
Reads multiframe state information from a DOM element.
Implementations of readXML should also call the _readXML method to restore general multiframe properties.
itemElem | is DOM element |
doc | is the DOM document |
ignoreFrames | set to false to avoid read state information about child frames from DOM |
Implements QgsComposerMultiFrame.
Definition at line 496 of file qgscomposerhtml.cpp.
|
overrideslot |
Recalculates the frame sizes for the current viewport dimensions.
Definition at line 244 of file qgscomposerhtml.cpp.
|
overridevirtualslot |
Definition at line 575 of file qgscomposerhtml.cpp.
|
slot |
Definition at line 557 of file qgscomposerhtml.cpp.
|
overridevirtual |
Renders a portion of the multiframe's content into a painter.
painter | destination painter |
renderExtent | visible extent of content to render into the painter. |
frameIndex | frame number for content |
Reimplemented from QgsComposerMultiFrame.
Definition at line 306 of file qgscomposerhtml.cpp.
|
inline |
Sets the source mode for item's HTML content.
mode | ContentMode for the item's source |
Definition at line 56 of file qgscomposerhtml.h.
void QgsComposerHtml::setEvaluateExpressions | ( | bool | evaluateExpressions | ) |
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.
evaluateExpressions | set to true to evaluate expressions in the HTML content |
Definition at line 138 of file qgscomposerhtml.cpp.
void QgsComposerHtml::setHtml | ( | const QString | html | ) |
Sets the HTML to display in the item when the item is using the QgsComposerHtml::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.
html | HTML to display in item |
Definition at line 129 of file qgscomposerhtml.cpp.
void QgsComposerHtml::setMaxBreakDistance | ( | double | maxBreakDistance | ) |
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.
maxBreakDistance | maximum amount of empty space to leave when calculating page break locations |
Definition at line 448 of file qgscomposerhtml.cpp.
void QgsComposerHtml::setUrl | ( | const QUrl & | url | ) |
Sets the URL for content to display in the item when the item is using the QgsComposerHtml::Url mode.
Content is automatically fetched and the HTML item refreshed after calling this function.
url | URL of content to display in the item |
Definition at line 117 of file qgscomposerhtml.cpp.
void QgsComposerHtml::setUserStylesheet | ( | const QString | stylesheet | ) |
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.
stylesheet | CSS rules for user stylesheet |
Definition at line 455 of file qgscomposerhtml.cpp.
void QgsComposerHtml::setUserStylesheetEnabled | ( | const bool | stylesheetEnabled | ) |
Sets whether user stylesheets are enabled for the HTML content.
stylesheetEnabled | set to true to enable user stylesheets |
Definition at line 464 of file qgscomposerhtml.cpp.
void QgsComposerHtml::setUseSmartBreaks | ( | bool | useSmartBreaks | ) |
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.
useSmartBreaks | set to true to prevent content from breaking mid-way through a line of text |
Definition at line 441 of file qgscomposerhtml.cpp.
|
overridevirtual |
Returns the total size of the multiframe's content.
Implements QgsComposerMultiFrame.
Definition at line 301 of file qgscomposerhtml.cpp.
|
inline |
Returns the URL of the content displayed in the item if the item is using the QgsComposerHtml::Url mode.
Definition at line 82 of file qgscomposerhtml.h.
|
inline |
Returns the user stylesheet CSS rules used while rendering the HTML content.
These overriding the styles specified within the HTML source.
Definition at line 184 of file qgscomposerhtml.h.
|
inline |
Returns whether user stylesheets are enabled for the HTML content.
Definition at line 200 of file qgscomposerhtml.h.
|
inline |
Returns whether html item is using smart breaks.
Smart breaks prevent the html frame contents from breaking mid-way though a line of text.
Definition at line 130 of file qgscomposerhtml.h.
|
overridevirtual |
Stores state information about multiframe in DOM element.
Implementations of writeXML should also call the _writeXML method to save general multiframe properties.
elem | is DOM element |
doc | is the DOM document |
ignoreFrames | set to false to avoid writing state information about child frames into DOM |
Implements QgsComposerMultiFrame.
Definition at line 479 of file qgscomposerhtml.cpp.