|
9 | 9 |
|
10 | 10 |
|
11 | 11 |
|
12 | | -class QgsLayoutItemHtml: QgsLayoutMultiFrame |
13 | | -{ |
14 | | -%Docstring |
15 | | - A layout multiframe subclass for HTML content. |
16 | | -.. versionadded:: 3.0 |
17 | | -%End |
18 | | - |
19 | | -%TypeHeaderCode |
20 | | -#include "qgslayoutitemhtml.h" |
21 | | -%End |
22 | | - public: |
23 | | - |
24 | | - enum ContentMode |
25 | | - { |
26 | | - Url, |
27 | | - ManualHtml |
28 | | - }; |
29 | | - |
30 | | - QgsLayoutItemHtml( QgsLayout *layout ); |
31 | | -%Docstring |
32 | | - Constructor for QgsLayoutItemHtml, with the specified parent ``layout``. |
33 | | -%End |
34 | | - |
35 | | - ~QgsLayoutItemHtml(); |
36 | | - |
37 | | - void setContentMode( ContentMode mode ); |
38 | | -%Docstring |
39 | | - Sets the source ``mode`` for item's HTML content. |
40 | | -.. seealso:: contentMode() |
41 | | -.. seealso:: setUrl() |
42 | | -.. seealso:: setHtml() |
43 | | -%End |
44 | | - |
45 | | - ContentMode contentMode() const; |
46 | | -%Docstring |
47 | | - Returns the source mode for item's HTML content. |
48 | | -.. seealso:: setContentMode() |
49 | | -.. seealso:: url() |
50 | | -.. seealso:: html() |
51 | | - :rtype: ContentMode |
52 | | -%End |
53 | | - |
54 | | - void setUrl( const QUrl &url ); |
55 | | -%Docstring |
56 | | - Sets the ``url`` for content to display in the item when the item is using |
57 | | - the QgsLayoutItemHtml.Url mode. Content is automatically fetched and the |
58 | | - HTML item refreshed after calling this function. |
59 | | -.. seealso:: url() |
60 | | -.. seealso:: contentMode() |
61 | | -%End |
62 | | - |
63 | | - QUrl url() const; |
64 | | -%Docstring |
65 | | - Returns the URL of the content displayed in the item if the item is using |
66 | | - the QgsLayoutItemHtml.Url mode. |
67 | | -.. seealso:: setUrl() |
68 | | -.. seealso:: contentMode() |
69 | | - :rtype: QUrl |
70 | | -%End |
71 | | - |
72 | | - void setHtml( const QString &html ); |
73 | | -%Docstring |
74 | | - Sets the ``html`` to display in the item when the item is using |
75 | | - the QgsLayoutItemHtml.ManualHtml mode. Setting the HTML using this function |
76 | | - does not automatically refresh the item's contents. Call loadHtml to trigger |
77 | | - a refresh of the item after setting the HTML content. |
78 | | -.. seealso:: html() |
79 | | -.. seealso:: contentMode() |
80 | | -.. seealso:: loadHtml() |
81 | | -%End |
82 | | - |
83 | | - QString html() const; |
84 | | -%Docstring |
85 | | - Returns the HTML source displayed in the item if the item is using |
86 | | - the QgsLayoutItemHtml.ManualHtml mode. |
87 | | -.. seealso:: setHtml() |
88 | | -.. seealso:: contentMode() |
89 | | - :rtype: str |
90 | | -%End |
91 | | - |
92 | | - bool evaluateExpressions() const; |
93 | | -%Docstring |
94 | | - Returns whether html item will evaluate QGIS expressions prior to rendering |
95 | | - the HTML content. If set, any content inside [% %] tags will be |
96 | | - treated as a QGIS expression and evaluated against the current atlas |
97 | | - feature. |
98 | | -.. seealso:: setEvaluateExpressions() |
99 | | - :rtype: bool |
100 | | -%End |
101 | | - |
102 | | - void setEvaluateExpressions( bool evaluateExpressions ); |
103 | | -%Docstring |
104 | | - Sets whether the html item will evaluate QGIS expressions prior to rendering |
105 | | - the HTML content. If set, any content inside [% %] tags will be |
106 | | - treated as a QGIS expression and evaluated against the current atlas |
107 | | - feature. |
108 | | -.. seealso:: evaluateExpressions() |
109 | | -%End |
110 | | - |
111 | | - bool useSmartBreaks() const; |
112 | | -%Docstring |
113 | | - Returns whether html item is using smart breaks. Smart breaks prevent |
114 | | - the html frame contents from breaking mid-way though a line of text. |
115 | | -.. seealso:: setUseSmartBreaks() |
116 | | - :rtype: bool |
117 | | -%End |
118 | | - |
119 | | - void setUseSmartBreaks( bool useSmartBreaks ); |
120 | | -%Docstring |
121 | | - Sets whether the html item should use smart breaks. Smart breaks prevent |
122 | | - the html frame contents from breaking mid-way though a line of text. |
123 | | -.. seealso:: useSmartBreaks() |
124 | | -%End |
125 | | - |
126 | | - void setMaxBreakDistance( double distance ); |
127 | | -%Docstring |
128 | | - Sets the maximum ``distance`` allowed when calculating where to place page breaks |
129 | | - in the html. This distance is the maximum amount of empty space allowed |
130 | | - at the bottom of a frame after calculating the optimum break location. Setting |
131 | | - a larger value will result in better choice of page break location, but more |
132 | | - wasted space at the bottom of frames. This setting is only effective if |
133 | | - useSmartBreaks is true. |
134 | | -.. seealso:: maxBreakDistance() |
135 | | -.. seealso:: setUseSmartBreaks() |
136 | | -%End |
137 | | - |
138 | | - double maxBreakDistance() const; |
139 | | -%Docstring |
140 | | - Returns the maximum distance allowed when calculating where to place page breaks |
141 | | - in the html. This distance is the maximum amount of empty space allowed |
142 | | - at the bottom of a frame after calculating the optimum break location. This setting |
143 | | - is only effective if useSmartBreaks is true. |
144 | | -.. seealso:: setMaxBreakDistance() |
145 | | -.. seealso:: useSmartBreaks() |
146 | | - :rtype: float |
147 | | -%End |
148 | | - |
149 | | - void setUserStylesheet( const QString &stylesheet ); |
150 | | -%Docstring |
151 | | - Sets the user ``stylesheet`` CSS rules to use while rendering the HTML content. These |
152 | | - allow for overriding the styles specified within the HTML source. Setting the stylesheet |
153 | | - using this function does not automatically refresh the item's contents. Call loadHtml |
154 | | - to trigger a refresh of the item after setting the stylesheet rules. |
155 | | -.. seealso:: userStylesheet() |
156 | | -.. seealso:: setUserStylesheetEnabled() |
157 | | -.. seealso:: loadHtml() |
158 | | -%End |
159 | | - |
160 | | - QString userStylesheet() const; |
161 | | -%Docstring |
162 | | - Returns the user stylesheet CSS rules used while rendering the HTML content. These |
163 | | - overriding the styles specified within the HTML source. |
164 | | -.. seealso:: setUserStylesheet() |
165 | | -.. seealso:: userStylesheetEnabled() |
166 | | - :rtype: str |
167 | | -%End |
168 | | - |
169 | | - void setUserStylesheetEnabled( const bool enabled ); |
170 | | -%Docstring |
171 | | - Sets whether user stylesheets are ``enabled`` for the HTML content. |
172 | | -.. seealso:: userStylesheetEnabled() |
173 | | -.. seealso:: setUserStylesheet() |
174 | | -%End |
175 | | - |
176 | | - bool userStylesheetEnabled() const; |
177 | | -%Docstring |
178 | | - Returns whether user stylesheets are enabled for the HTML content. |
179 | | -.. seealso:: setUserStylesheetEnabled() |
180 | | -.. seealso:: userStylesheet() |
181 | | - :rtype: bool |
182 | | -%End |
183 | | - |
184 | | - virtual QString displayName() const; |
185 | | - |
186 | | - virtual QSizeF totalSize() const; |
187 | | - |
188 | | - virtual void render( QgsRenderContext &context, const QRectF &renderExtent, const int frameIndex, |
189 | | - const QStyleOptionGraphicsItem *itemStyle = 0 ); |
190 | | - |
191 | | - virtual bool writeXml( QDomElement &elem, QDomDocument &doc, bool ignoreFrames = false ) const; |
192 | | - |
193 | | - virtual bool readXml( const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames = false ); |
194 | | - |
195 | | - virtual double findNearbyPageBreak( double yPos ); |
196 | | - |
197 | | - |
198 | | - public slots: |
199 | | - |
200 | | - void loadHtml( const bool useCache = false, const QgsExpressionContext *context = 0 ); |
201 | | -%Docstring |
202 | | - Reloads the html source from the url and redraws the item. |
203 | | - \param useCache set to true to use a cached copy of remote html |
204 | | - content |
205 | | - \param context expression context for evaluating data defined urls and expressions in html |
206 | | -.. seealso:: setUrl |
207 | | -.. seealso:: url |
208 | | -%End |
209 | | - |
210 | | - virtual void recalculateFrameSizes(); |
211 | | - |
212 | | -%Docstring |
213 | | -Recalculates the frame sizes for the current viewport dimensions |
214 | | -%End |
215 | | - void refreshExpressionContext(); |
216 | | - |
217 | | - void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties ); |
218 | | - |
219 | | -}; |
220 | 12 |
|
221 | 13 | /************************************************************************ |
222 | 14 | * This file has been generated automatically from * |
|
0 commit comments