|
QGIS API Documentation 4.5.0-Master (3b5d115045b)
|
A wrapper around the QWebEnginePage class, adding extra functionality. More...
#include <qgswebenginepage.h>

Signals | |
| void | loadFinished (bool ok) |
| This signal is emitted when the page finishes loading content. | |
| void | loadProgress (int progress) |
| This signal is emitted when the global progress status changes. | |
| void | loadStarted () |
| This signal is emitted when the page starts loading content. | |
Public Member Functions | |
| QgsWebEnginePage (QObject *parent=nullptr) | |
| Constructor for QgsWebEnginePage, with the specified parent widget. | |
| ~QgsWebEnginePage () override | |
| QSize | documentSize () const |
| Returns the size of the page document, in pixels. | |
| QWebEnginePage * | page () |
| Returns a reference to the QWebEnginePage. | |
| bool | render (QPainter *painter, const QRectF &painterRect) |
| Renders the web page contents to a painter. | |
| bool | setContent (const QByteArray &data, const QString &mimeType=QString(), const QUrl &baseUrl=QUrl(), bool blocking=false) |
| Sets the content of the web page to data. | |
| bool | setHtml (const QString &html, const QUrl &baseUrl=QUrl(), bool blocking=false) |
| Sets the content of this page to html. | |
| bool | setUrl (const QUrl &url, bool blocking=false) |
| Sets the url of the web page to be displayed. | |
Static Public Member Functions | |
| static bool | printToPdfBlocking (const QString &html, const QString &pdfFileName, QString &errorMessage, int width, const QgsHtmlRenderSettings &settings=QgsHtmlRenderSettings(), QgsFeedback *feedback=nullptr) |
| Renders HTML content to a PDF file asynchronously. | |
| static bool | printToPdfBlocking (const QUrl &url, const QString &pdfFileName, QString &errorMessage, int width, const QgsHtmlRenderSettings &settings=QgsHtmlRenderSettings(), QgsFeedback *feedback=nullptr) |
| Renders HTML content to a PDF file asynchronously. | |
| static bool | renderBlocking (const QString &html, QPainter *painter, const QRectF &painterRect, QString &errorMessage, QSizeF &renderedSize, const QgsHtmlRenderSettings &settings=QgsHtmlRenderSettings(), QgsFeedback *feedback=nullptr) |
| Renders HTML content to a painter asynchronously. | |
| static bool | renderBlocking (const QUrl &url, QPainter *painter, const QRectF &painterRect, QString &errorMessage, QSizeF &renderedSize, const QgsHtmlRenderSettings &settings=QgsHtmlRenderSettings(), QgsFeedback *feedback=nullptr) |
| Renders HTML content to a painter asynchronously. | |
A wrapper around the QWebEnginePage class, adding extra functionality.
Definition at line 47 of file qgswebenginepage.h.
| QgsWebEnginePage::QgsWebEnginePage | ( | QObject * | parent = nullptr | ) |
Constructor for QgsWebEnginePage, with the specified parent widget.
Definition at line 48 of file qgswebenginepage.cpp.
|
overridedefault |
| QSize QgsWebEnginePage::documentSize | ( | ) | const |
Returns the size of the page document, in pixels.
Definition at line 154 of file qgswebenginepage.cpp.
|
signal |
This signal is emitted when the page finishes loading content.
This signal is independent of script execution or page rendering.
ok will indicate whether the load was successful or any error occurred.
|
signal |
This signal is emitted when the global progress status changes.
The current value is provided by progress and scales from 0 to 100. It accumulates changes from all the child frames.
|
signal |
This signal is emitted when the page starts loading content.
| QWebEnginePage * QgsWebEnginePage::page | ( | ) |
Returns a reference to the QWebEnginePage.
Definition at line 60 of file qgswebenginepage.cpp.
|
static |
Renders HTML content to a PDF file asynchronously.
This method is safe to call on either the main or background threads, and will safely ensure that the main thread event loop is NOT run during the HTML rendering or PDF generation.
| html | HTML content |
| pdfFileName | destination filename for PDF |
| errorMessage | will be set to a descriptive error message if the printing fails |
| width | page width |
| settings | optional HTML render settings |
| feedback | optional feedback for early cancellation |
true if the printing was successfulDefinition at line 340 of file qgswebenginepage.cpp.
|
static |
Renders HTML content to a PDF file asynchronously.
This method is safe to call on either the main or background threads, and will safely ensure that the main thread event loop is NOT run during the HTML rendering or PDF generation.
| url | URL of HTML content |
| pdfFileName | destination filename for PDF |
| errorMessage | will be set to a descriptive error message if the printing fails |
| width | page width |
| settings | optional HTML render settings |
| feedback | optional feedback for early cancellation |
true if the printing was successfulDefinition at line 365 of file qgswebenginepage.cpp.
| bool QgsWebEnginePage::render | ( | QPainter * | painter, |
| const QRectF & | painterRect ) |
Renders the web page contents to a painter.
Content will be rendered as vector objects.
The painterRect argument specifies the target rectangle for the page in painter coordinates.
true if rendering was successful| QgsNotSupportedException | on QGIS builds without PDF4Qt library support. |
Definition at line 246 of file qgswebenginepage.cpp.
|
static |
Renders HTML content to a painter asynchronously.
Content will be rendered as vector objects.
This method is safe to call on either the main or background threads, and will safely ensure that the main thread event loop is NOT run during the HTML rendering.
| html | HTML content |
| painter | destination QPainter |
| painterRect | specifies the target rectangle for the page in painter coordinates |
| errorMessage | will be set to a descriptive error message if the printing fails |
| renderedSize | will be set to the actual size of the rendered HTML |
| settings | optional HTML render settings |
| feedback | optional feedback for early cancellation |
true if rendering was successful| QgsNotSupportedException | on QGIS builds without PDF4Qt library support. |
Definition at line 378 of file qgswebenginepage.cpp.
|
static |
Renders HTML content to a painter asynchronously.
Content will be rendered as vector objects.
This method is safe to call on either the main or background threads, and will safely ensure that the main thread event loop is NOT run during the HTML rendering.
| url | URL of HTML content |
| painter | destination QPainter |
| painterRect | specifies the target rectangle for the page in painter coordinates |
| errorMessage | will be set to a descriptive error message if the printing fails |
| renderedSize | will be set to the actual size of the rendered HTML |
| settings | optional HTML render settings |
| feedback | optional feedback for early cancellation |
true if rendering was successful| QgsNotSupportedException | on QGIS builds without PDF4Qt library support. |
Definition at line 408 of file qgswebenginepage.cpp.
| bool QgsWebEnginePage::setContent | ( | const QByteArray & | data, |
| const QString & | mimeType = QString(), | ||
| const QUrl & | baseUrl = QUrl(), | ||
| bool | blocking = false ) |
Sets the content of the web page to data.
If the mimeType argument is empty, it is assumed that the content is text/plain,charset=US-ASCII
The baseUrl is optional and used to resolve relative URLs in the document, such as referenced images or stylesheets.
If blocking is true then the call will block while the HTML is loaded. Otherwise the html is loaded immediately; external objects are loaded asynchronously.
true involves running the event loop on the current thread. Take care when calling from the main thread as incorrect use will result in crashes.true if loading was successful Definition at line 65 of file qgswebenginepage.cpp.
| bool QgsWebEnginePage::setHtml | ( | const QString & | html, |
| const QUrl & | baseUrl = QUrl(), | ||
| bool | blocking = false ) |
Sets the content of this page to html.
The baseUrl is optional and used to resolve relative URLs in the document, such as referenced images or stylesheets.
If blocking is true then the call will block while the HTML is loaded. Otherwise the html is loaded immediately; external objects are loaded asynchronously.
true involves running the event loop on the current thread. Take care when calling from the main thread as incorrect use will result in crashes.true if loading was successful Definition at line 94 of file qgswebenginepage.cpp.
| bool QgsWebEnginePage::setUrl | ( | const QUrl & | url, |
| bool | blocking = false ) |
Sets the url of the web page to be displayed.
Setting this property clears the page and loads the URL.
If blocking is true then the call will block while the HTML is loaded. Otherwise the html is loaded immediately; external objects are loaded asynchronously.
true involves running the event loop on the current thread. Take care when calling from the main thread as incorrect use will result in crashes.true if loading was successful Definition at line 124 of file qgswebenginepage.cpp.