eric6/Documentation/Source/eric6.WebBrowser.WebBrowserPage.html

branch
maintenance
changeset 6989
8b8cadf8d7e9
parent 6942
2602857055c5
child 7273
391d6b7b1eff
equal deleted inserted replaced
6938:7926553b7509 6989:8b8cadf8d7e9
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.WebBrowser.WebBrowserPage</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body><a NAME="top" ID="top"></a>
22 <h1>eric6.WebBrowser.WebBrowserPage</h1>
23 <p>
24 Module implementing the helpbrowser using QWebView.
25 </p>
26 <h3>Global Attributes</h3>
27 <table>
28 <tr><td>None</td></tr>
29 </table>
30 <h3>Classes</h3>
31 <table>
32 <tr>
33 <td><a href="#WebBrowserPage">WebBrowserPage</a></td>
34 <td>Class implementing an enhanced web page.</td>
35 </tr>
36 </table>
37 <h3>Functions</h3>
38 <table>
39 <tr><td>None</td></tr>
40 </table>
41 <hr /><hr />
42 <a NAME="WebBrowserPage" ID="WebBrowserPage"></a>
43 <h2>WebBrowserPage</h2>
44 <p>
45 Class implementing an enhanced web page.
46 </p><h3>Signals</h3>
47 <dl>
48 <dt>navigationRequestAccepted(url, navigation type, main frame)</dt>
49 <dd>
50 emitted
51 to signal an accepted navigation request
52 </dd><dt>printPageRequested()</dt>
53 <dd>
54 emitted to indicate a print request of the
55 shown web page
56 </dd><dt>safeBrowsingAbort()</dt>
57 <dd>
58 emitted to indicate an abort due to a safe
59 browsing event
60 </dd><dt>safeBrowsingBad(threatType, threatMessages)</dt>
61 <dd>
62 emitted to indicate a
63 malicious web site as determined by safe browsing
64 </dd>
65 </dl>
66 <h3>Derived from</h3>
67 QWebEnginePage
68 <h3>Class Attributes</h3>
69 <table>
70 <tr><td>SafeJsWorld</td></tr><tr><td>UnsafeJsWorld</td></tr>
71 </table>
72 <h3>Class Methods</h3>
73 <table>
74 <tr>
75 <td><a href="#WebBrowserPage.setUserAgent">setUserAgent</a></td>
76 <td>Class method to set the global user agent string.</td>
77 </tr><tr>
78 <td><a href="#WebBrowserPage.userAgent">userAgent</a></td>
79 <td>Class method to get the global user agent setting.</td>
80 </tr><tr>
81 <td><a href="#WebBrowserPage.userAgentForUrl">userAgentForUrl</a></td>
82 <td>Class method to determine the user agent for the given URL.</td>
83 </tr>
84 </table>
85 <h3>Methods</h3>
86 <table>
87 <tr>
88 <td><a href="#WebBrowserPage.__init__">WebBrowserPage</a></td>
89 <td>Constructor</td>
90 </tr><tr>
91 <td><a href="#WebBrowserPage.__contentsSizeChanged">__contentsSizeChanged</a></td>
92 <td>Private slot to work around QWebEnginePage not scrolling to anchors when opened in a background tab.</td>
93 </tr><tr>
94 <td><a href="#WebBrowserPage.__featurePermissionRequested">__featurePermissionRequested</a></td>
95 <td>Private slot handling a feature permission request.</td>
96 </tr><tr>
97 <td><a href="#WebBrowserPage.__fullScreenRequested">__fullScreenRequested</a></td>
98 <td>Private slot handling a full screen request.</td>
99 </tr><tr>
100 <td><a href="#WebBrowserPage.__registerProtocolHandlerRequested">__registerProtocolHandlerRequested</a></td>
101 <td>Private slot to handle the registration of a custom protocol handler.</td>
102 </tr><tr>
103 <td><a href="#WebBrowserPage.__setupChannelTimeout">__setupChannelTimeout</a></td>
104 <td>Private slot to initiate the setup of the web channel.</td>
105 </tr><tr>
106 <td><a href="#WebBrowserPage.__setupWebChannelForUrl">__setupWebChannelForUrl</a></td>
107 <td>Private method to setup a web channel to our external object.</td>
108 </tr><tr>
109 <td><a href="#WebBrowserPage.__urlChanged">__urlChanged</a></td>
110 <td>Private slot to handle changes of the URL.</td>
111 </tr><tr>
112 <td><a href="#WebBrowserPage.acceptNavigationRequest">acceptNavigationRequest</a></td>
113 <td>Public method to determine, if a request may be accepted.</td>
114 </tr><tr>
115 <td><a href="#WebBrowserPage.certificateError">certificateError</a></td>
116 <td>Public method to handle SSL certificate errors.</td>
117 </tr><tr>
118 <td><a href="#WebBrowserPage.execJavaScript">execJavaScript</a></td>
119 <td>Public method to execute a JavaScript function synchroneously.</td>
120 </tr><tr>
121 <td><a href="#WebBrowserPage.execPrintPage">execPrintPage</a></td>
122 <td>Public method to execute a synchronous print.</td>
123 </tr><tr>
124 <td><a href="#WebBrowserPage.getSafeBrowsingStatus">getSafeBrowsingStatus</a></td>
125 <td>Public method to get the safe browsing status of the current page.</td>
126 </tr><tr>
127 <td><a href="#WebBrowserPage.hitTestContent">hitTestContent</a></td>
128 <td>Public method to test the content at a specified position.</td>
129 </tr><tr>
130 <td><a href="#WebBrowserPage.icon">icon</a></td>
131 <td>Public method to get the web site icon.</td>
132 </tr><tr>
133 <td><a href="#WebBrowserPage.isJavaScriptEnabled">isJavaScriptEnabled</a></td>
134 <td>Public method to test, if JavaScript is enabled.</td>
135 </tr><tr>
136 <td><a href="#WebBrowserPage.javaScriptConsoleMessage">javaScriptConsoleMessage</a></td>
137 <td>Public method to show a console message.</td>
138 </tr><tr>
139 <td><a href="#WebBrowserPage.mapToViewport">mapToViewport</a></td>
140 <td>Public method to map a position to the viewport.</td>
141 </tr><tr>
142 <td><a href="#WebBrowserPage.printCallback">printCallback</a></td>
143 <td></td>
144 </tr><tr>
145 <td><a href="#WebBrowserPage.registerProtocolHandlerRequestScheme">registerProtocolHandlerRequestScheme</a></td>
146 <td>Public method to get the registered protocol handler request scheme.</td>
147 </tr><tr>
148 <td><a href="#WebBrowserPage.registerProtocolHandlerRequestUrl">registerProtocolHandlerRequestUrl</a></td>
149 <td>Public method to get the registered protocol handler request URL.</td>
150 </tr><tr>
151 <td><a href="#WebBrowserPage.resultCallback">resultCallback</a></td>
152 <td></td>
153 </tr><tr>
154 <td><a href="#WebBrowserPage.runJavaScript">runJavaScript</a></td>
155 <td>Public method to run a script in the context of the page.</td>
156 </tr><tr>
157 <td><a href="#WebBrowserPage.scroll">scroll</a></td>
158 <td>Public method to scroll by the given amount of pixels.</td>
159 </tr><tr>
160 <td><a href="#WebBrowserPage.scrollPosition">scrollPosition</a></td>
161 <td>Public method to get the scroll position of the web page.</td>
162 </tr><tr>
163 <td><a href="#WebBrowserPage.scrollTo">scrollTo</a></td>
164 <td>Public method to scroll to the given position.</td>
165 </tr>
166 </table>
167 <h3>Static Methods</h3>
168 <table>
169 <tr><td>None</td></tr>
170 </table>
171 <a NAME="WebBrowserPage.setUserAgent" ID="WebBrowserPage.setUserAgent"></a>
172 <h4>WebBrowserPage.setUserAgent (class method)</h4>
173 <b>setUserAgent</b>(<i>agent</i>)
174 <p>
175 Class method to set the global user agent string.
176 </p><dl>
177 <dt><i>agent</i></dt>
178 <dd>
179 new current user agent string (string)
180 </dd>
181 </dl><a NAME="WebBrowserPage.userAgent" ID="WebBrowserPage.userAgent"></a>
182 <h4>WebBrowserPage.userAgent (class method)</h4>
183 <b>userAgent</b>(<i>resolveEmpty=False</i>)
184 <p>
185 Class method to get the global user agent setting.
186 </p><dl>
187 <dt><i>resolveEmpty</i></dt>
188 <dd>
189 flag indicating to resolve an empty
190 user agent (boolean)
191 </dd>
192 </dl><dl>
193 <dt>Returns:</dt>
194 <dd>
195 user agent string (string)
196 </dd>
197 </dl><a NAME="WebBrowserPage.userAgentForUrl" ID="WebBrowserPage.userAgentForUrl"></a>
198 <h4>WebBrowserPage.userAgentForUrl (class method)</h4>
199 <b>userAgentForUrl</b>(<i>url</i>)
200 <p>
201 Class method to determine the user agent for the given URL.
202 </p><dl>
203 <dt><i>url</i></dt>
204 <dd>
205 URL to determine user agent for (QUrl)
206 </dd>
207 </dl><dl>
208 <dt>Returns:</dt>
209 <dd>
210 user agent string (string)
211 </dd>
212 </dl><a NAME="WebBrowserPage.__init__" ID="WebBrowserPage.__init__"></a>
213 <h4>WebBrowserPage (Constructor)</h4>
214 <b>WebBrowserPage</b>(<i>parent=None</i>)
215 <p>
216 Constructor
217 </p><dl>
218 <dt><i>parent</i></dt>
219 <dd>
220 parent widget of this window (QWidget)
221 </dd>
222 </dl><a NAME="WebBrowserPage.__contentsSizeChanged" ID="WebBrowserPage.__contentsSizeChanged"></a>
223 <h4>WebBrowserPage.__contentsSizeChanged</h4>
224 <b>__contentsSizeChanged</b>(<i>size</i>)
225 <p>
226 Private slot to work around QWebEnginePage not scrolling to anchors
227 when opened in a background tab.
228 </p><dl>
229 <dt><i>size</i> (QSize)</dt>
230 <dd>
231 changed contents size (unused)
232 </dd>
233 </dl><a NAME="WebBrowserPage.__featurePermissionRequested" ID="WebBrowserPage.__featurePermissionRequested"></a>
234 <h4>WebBrowserPage.__featurePermissionRequested</h4>
235 <b>__featurePermissionRequested</b>(<i>url, feature</i>)
236 <p>
237 Private slot handling a feature permission request.
238 </p><dl>
239 <dt><i>url</i> (QUrl)</dt>
240 <dd>
241 url requesting the feature
242 </dd><dt><i>feature</i> (QWebEnginePage.Feature)</dt>
243 <dd>
244 requested feature
245 </dd>
246 </dl><a NAME="WebBrowserPage.__fullScreenRequested" ID="WebBrowserPage.__fullScreenRequested"></a>
247 <h4>WebBrowserPage.__fullScreenRequested</h4>
248 <b>__fullScreenRequested</b>(<i>request</i>)
249 <p>
250 Private slot handling a full screen request.
251 </p><dl>
252 <dt><i>request</i> (QWebEngineFullScreenRequest)</dt>
253 <dd>
254 reference to the full screen request
255 </dd>
256 </dl><a NAME="WebBrowserPage.__registerProtocolHandlerRequested" ID="WebBrowserPage.__registerProtocolHandlerRequested"></a>
257 <h4>WebBrowserPage.__registerProtocolHandlerRequested</h4>
258 <b>__registerProtocolHandlerRequested</b>(<i>request</i>)
259 <p>
260 Private slot to handle the registration of a custom protocol
261 handler.
262 </p><dl>
263 <dt><i>request</i> (QWebEngineRegisterProtocolHandlerRequest)</dt>
264 <dd>
265 reference to the registration request
266 </dd>
267 </dl><a NAME="WebBrowserPage.__setupChannelTimeout" ID="WebBrowserPage.__setupChannelTimeout"></a>
268 <h4>WebBrowserPage.__setupChannelTimeout</h4>
269 <b>__setupChannelTimeout</b>(<i></i>)
270 <p>
271 Private slot to initiate the setup of the web channel.
272 </p><a NAME="WebBrowserPage.__setupWebChannelForUrl" ID="WebBrowserPage.__setupWebChannelForUrl"></a>
273 <h4>WebBrowserPage.__setupWebChannelForUrl</h4>
274 <b>__setupWebChannelForUrl</b>(<i>url</i>)
275 <p>
276 Private method to setup a web channel to our external object.
277 </p><dl>
278 <dt><i>url</i> (QUrl)</dt>
279 <dd>
280 URL for which to setup the web channel
281 </dd>
282 </dl><a NAME="WebBrowserPage.__urlChanged" ID="WebBrowserPage.__urlChanged"></a>
283 <h4>WebBrowserPage.__urlChanged</h4>
284 <b>__urlChanged</b>(<i>url</i>)
285 <p>
286 Private slot to handle changes of the URL.
287 </p><dl>
288 <dt><i>url</i> (QUrl)</dt>
289 <dd>
290 new URL
291 </dd>
292 </dl><a NAME="WebBrowserPage.acceptNavigationRequest" ID="WebBrowserPage.acceptNavigationRequest"></a>
293 <h4>WebBrowserPage.acceptNavigationRequest</h4>
294 <b>acceptNavigationRequest</b>(<i>url, type_, isMainFrame</i>)
295 <p>
296 Public method to determine, if a request may be accepted.
297 </p><dl>
298 <dt><i>url</i> (QUrl)</dt>
299 <dd>
300 URL to navigate to
301 </dd><dt><i>type_</i> (QWebEnginePage.NavigationType)</dt>
302 <dd>
303 type of the navigation request
304 </dd><dt><i>isMainFrame</i> (bool)</dt>
305 <dd>
306 flag indicating, that the request originated from
307 the main frame
308 </dd>
309 </dl><dl>
310 <dt>Returns:</dt>
311 <dd>
312 flag indicating acceptance
313 </dd>
314 </dl><dl>
315 <dt>Return Type:</dt>
316 <dd>
317 bool
318 </dd>
319 </dl><a NAME="WebBrowserPage.certificateError" ID="WebBrowserPage.certificateError"></a>
320 <h4>WebBrowserPage.certificateError</h4>
321 <b>certificateError</b>(<i>error</i>)
322 <p>
323 Public method to handle SSL certificate errors.
324 </p><dl>
325 <dt><i>error</i> (QWebEngineCertificateError)</dt>
326 <dd>
327 object containing the certificate error information
328 </dd>
329 </dl><dl>
330 <dt>Returns:</dt>
331 <dd>
332 flag indicating to ignore this error
333 </dd>
334 </dl><dl>
335 <dt>Return Type:</dt>
336 <dd>
337 bool
338 </dd>
339 </dl><a NAME="WebBrowserPage.execJavaScript" ID="WebBrowserPage.execJavaScript"></a>
340 <h4>WebBrowserPage.execJavaScript</h4>
341 <b>execJavaScript</b>(<i>script, worldId=QWebEngineScript.MainWorld, timeout=500</i>)
342 <p>
343 Public method to execute a JavaScript function synchroneously.
344 </p><dl>
345 <dt><i>script</i> (str)</dt>
346 <dd>
347 JavaScript script source to be executed
348 </dd><dt><i>worldId</i> (int)</dt>
349 <dd>
350 ID to run the script under
351 </dd><dt><i>timeout</i> (int)</dt>
352 <dd>
353 max. time the script is given to execute
354 </dd>
355 </dl><dl>
356 <dt>Returns:</dt>
357 <dd>
358 result of the script
359 </dd>
360 </dl><dl>
361 <dt>Return Type:</dt>
362 <dd>
363 depending upon script result
364 </dd>
365 </dl><a NAME="WebBrowserPage.execPrintPage" ID="WebBrowserPage.execPrintPage"></a>
366 <h4>WebBrowserPage.execPrintPage</h4>
367 <b>execPrintPage</b>(<i>printer, timeout=1000</i>)
368 <p>
369 Public method to execute a synchronous print.
370 </p><dl>
371 <dt><i>printer</i> (QPrinter)</dt>
372 <dd>
373 reference to the printer object
374 </dd><dt><i>timeout</i> (int)</dt>
375 <dd>
376 timeout value in milliseconds
377 </dd>
378 </dl><dl>
379 <dt>Returns:</dt>
380 <dd>
381 flag indicating a successful print job
382 </dd>
383 </dl><dl>
384 <dt>Return Type:</dt>
385 <dd>
386 bool
387 </dd>
388 </dl><a NAME="WebBrowserPage.getSafeBrowsingStatus" ID="WebBrowserPage.getSafeBrowsingStatus"></a>
389 <h4>WebBrowserPage.getSafeBrowsingStatus</h4>
390 <b>getSafeBrowsingStatus</b>(<i></i>)
391 <p>
392 Public method to get the safe browsing status of the current page.
393 </p><dl>
394 <dt>Returns:</dt>
395 <dd>
396 flag indicating a safe site
397 </dd>
398 </dl><dl>
399 <dt>Return Type:</dt>
400 <dd>
401 bool
402 </dd>
403 </dl><a NAME="WebBrowserPage.hitTestContent" ID="WebBrowserPage.hitTestContent"></a>
404 <h4>WebBrowserPage.hitTestContent</h4>
405 <b>hitTestContent</b>(<i>pos</i>)
406 <p>
407 Public method to test the content at a specified position.
408 </p><dl>
409 <dt><i>pos</i> (QPoint)</dt>
410 <dd>
411 position to execute the test at
412 </dd>
413 </dl><dl>
414 <dt>Returns:</dt>
415 <dd>
416 test result object
417 </dd>
418 </dl><dl>
419 <dt>Return Type:</dt>
420 <dd>
421 WebHitTestResult
422 </dd>
423 </dl><a NAME="WebBrowserPage.icon" ID="WebBrowserPage.icon"></a>
424 <h4>WebBrowserPage.icon</h4>
425 <b>icon</b>(<i></i>)
426 <p>
427 Public method to get the web site icon.
428 </p><dl>
429 <dt>Returns:</dt>
430 <dd>
431 web site icon
432 </dd>
433 </dl><dl>
434 <dt>Return Type:</dt>
435 <dd>
436 QIcon
437 </dd>
438 </dl><a NAME="WebBrowserPage.isJavaScriptEnabled" ID="WebBrowserPage.isJavaScriptEnabled"></a>
439 <h4>WebBrowserPage.isJavaScriptEnabled</h4>
440 <b>isJavaScriptEnabled</b>(<i></i>)
441 <p>
442 Public method to test, if JavaScript is enabled.
443 </p><dl>
444 <dt>Returns:</dt>
445 <dd>
446 flag indicating the state of the JavaScript support
447 </dd>
448 </dl><dl>
449 <dt>Return Type:</dt>
450 <dd>
451 bool
452 </dd>
453 </dl><a NAME="WebBrowserPage.javaScriptConsoleMessage" ID="WebBrowserPage.javaScriptConsoleMessage"></a>
454 <h4>WebBrowserPage.javaScriptConsoleMessage</h4>
455 <b>javaScriptConsoleMessage</b>(<i>level, message, lineNumber, sourceId</i>)
456 <p>
457 Public method to show a console message.
458 </p><dl>
459 <dt><i>level</i> (QWebEnginePage.JavaScriptConsoleMessageLevel)</dt>
460 <dd>
461 severity
462 </dd><dt><i>message</i> (str)</dt>
463 <dd>
464 message to be shown
465 </dd><dt><i>lineNumber</i> (int)</dt>
466 <dd>
467 line number of an error
468 </dd><dt><i>sourceId</i> (str)</dt>
469 <dd>
470 source URL causing the error
471 </dd>
472 </dl><a NAME="WebBrowserPage.mapToViewport" ID="WebBrowserPage.mapToViewport"></a>
473 <h4>WebBrowserPage.mapToViewport</h4>
474 <b>mapToViewport</b>(<i>pos</i>)
475 <p>
476 Public method to map a position to the viewport.
477 </p><dl>
478 <dt><i>pos</i> (QPoint)</dt>
479 <dd>
480 position to be mapped
481 </dd>
482 </dl><dl>
483 <dt>Returns:</dt>
484 <dd>
485 viewport position
486 </dd>
487 </dl><dl>
488 <dt>Return Type:</dt>
489 <dd>
490 QPoint
491 </dd>
492 </dl><a NAME="WebBrowserPage.printCallback" ID="WebBrowserPage.printCallback"></a>
493 <h4>WebBrowserPage.printCallback</h4>
494 <b>printCallback</b>(<i>resDict=resultDict</i>)
495 <a NAME="WebBrowserPage.registerProtocolHandlerRequestScheme" ID="WebBrowserPage.registerProtocolHandlerRequestScheme"></a>
496 <h4>WebBrowserPage.registerProtocolHandlerRequestScheme</h4>
497 <b>registerProtocolHandlerRequestScheme</b>(<i></i>)
498 <p>
499 Public method to get the registered protocol handler request scheme.
500 </p><dl>
501 <dt>Returns:</dt>
502 <dd>
503 registered protocol handler request scheme
504 </dd>
505 </dl><dl>
506 <dt>Return Type:</dt>
507 <dd>
508 str
509 </dd>
510 </dl><a NAME="WebBrowserPage.registerProtocolHandlerRequestUrl" ID="WebBrowserPage.registerProtocolHandlerRequestUrl"></a>
511 <h4>WebBrowserPage.registerProtocolHandlerRequestUrl</h4>
512 <b>registerProtocolHandlerRequestUrl</b>(<i></i>)
513 <p>
514 Public method to get the registered protocol handler request URL.
515 </p><dl>
516 <dt>Returns:</dt>
517 <dd>
518 registered protocol handler request URL
519 </dd>
520 </dl><dl>
521 <dt>Return Type:</dt>
522 <dd>
523 QUrl
524 </dd>
525 </dl><a NAME="WebBrowserPage.resultCallback" ID="WebBrowserPage.resultCallback"></a>
526 <h4>WebBrowserPage.resultCallback</h4>
527 <b>resultCallback</b>(<i>resDict=resultDict</i>)
528 <a NAME="WebBrowserPage.runJavaScript" ID="WebBrowserPage.runJavaScript"></a>
529 <h4>WebBrowserPage.runJavaScript</h4>
530 <b>runJavaScript</b>(<i>script, worldId=-1, callback=None</i>)
531 <p>
532 Public method to run a script in the context of the page.
533 </p><dl>
534 <dt><i>script</i> (str)</dt>
535 <dd>
536 JavaScript script source to be executed
537 </dd><dt><i>worldId</i> (int)</dt>
538 <dd>
539 ID to run the script under
540 </dd><dt><i>callback</i> (function)</dt>
541 <dd>
542 callback function to be executed when the script has
543 ended
544 </dd>
545 </dl><a NAME="WebBrowserPage.scroll" ID="WebBrowserPage.scroll"></a>
546 <h4>WebBrowserPage.scroll</h4>
547 <b>scroll</b>(<i>x, y</i>)
548 <p>
549 Public method to scroll by the given amount of pixels.
550 </p><dl>
551 <dt><i>x</i> (int)</dt>
552 <dd>
553 horizontal scroll value
554 </dd><dt><i>y</i> (int)</dt>
555 <dd>
556 vertical scroll value
557 </dd>
558 </dl><a NAME="WebBrowserPage.scrollPosition" ID="WebBrowserPage.scrollPosition"></a>
559 <h4>WebBrowserPage.scrollPosition</h4>
560 <b>scrollPosition</b>(<i></i>)
561 <p>
562 Public method to get the scroll position of the web page.
563 </p><dl>
564 <dt>Returns:</dt>
565 <dd>
566 scroll position
567 </dd>
568 </dl><dl>
569 <dt>Return Type:</dt>
570 <dd>
571 QPointF
572 </dd>
573 </dl><a NAME="WebBrowserPage.scrollTo" ID="WebBrowserPage.scrollTo"></a>
574 <h4>WebBrowserPage.scrollTo</h4>
575 <b>scrollTo</b>(<i>pos</i>)
576 <p>
577 Public method to scroll to the given position.
578 </p><dl>
579 <dt><i>pos</i> (QPointF)</dt>
580 <dd>
581 position to scroll to
582 </dd>
583 </dl>
584 <div align="right"><a href="#top">Up</a></div>
585 <hr />
586 </body></html>

eric ide

mercurial