QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
Signals | Public Member Functions | List of all members
QgsWebEnginePage Class Reference

A wrapper around the QWebEnginePage class, adding extra functionality. More...

#include <qgswebenginepage.h>

Inheritance diagram for QgsWebEnginePage:
Inheritance graph
[legend]

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.
 

Detailed Description

A wrapper around the QWebEnginePage class, adding extra functionality.

Warning
This class is only available on QGIS builds with WebEngine support enabled.
Since
QGIS 3.36

Definition at line 42 of file qgswebenginepage.h.

Constructor & Destructor Documentation

◆ QgsWebEnginePage()

QgsWebEnginePage::QgsWebEnginePage ( QObject *  parent = nullptr)

Constructor for QgsWebEnginePage, with the specified parent widget.

Definition at line 31 of file qgswebenginepage.cpp.

◆ ~QgsWebEnginePage()

QgsWebEnginePage::~QgsWebEnginePage ( )
overridedefault

Member Function Documentation

◆ documentSize()

QSize QgsWebEnginePage::documentSize ( ) const

Returns the size of the page document, in pixels.

Warning
If the page content was NOT loaded using a blocking method, then this method involves running the event loop on the current thread. Take care when calling from the main thread as incorrect use will result in crashes.

Definition at line 140 of file qgswebenginepage.cpp.

◆ loadFinished

void QgsWebEnginePage::loadFinished ( bool  ok)
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.

◆ loadProgress

void QgsWebEnginePage::loadProgress ( int  progress)
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.

◆ loadStarted

void QgsWebEnginePage::loadStarted ( )
signal

This signal is emitted when the page starts loading content.

◆ page()

QWebEnginePage * QgsWebEnginePage::page ( )

Returns a reference to the QWebEnginePage.

Note
Not available in Python bindings

Definition at line 43 of file qgswebenginepage.cpp.

◆ render()

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.

Warning
This method involves running the event loop on the current thread. Take care when calling from the main thread as incorrect use will result in crashes.
This method requires a QGIS build with PDF4Qt library support.
Returns
true if rendering was successful
Exceptions
QgsNotSupportedExceptionon QGIS builds without PDF4Qt library support.

Definition at line 233 of file qgswebenginepage.cpp.

◆ setContent()

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.

Warning
Setting blocking to 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.
Returns
true if loading was successful

Definition at line 48 of file qgswebenginepage.cpp.

◆ setHtml()

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.

Note
This function works only for HTML, for other mime types (such as XHTML and SVG) setContent() should be used instead.
Warning
Setting blocking to 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.
Returns
true if loading was successful

Definition at line 78 of file qgswebenginepage.cpp.

◆ setUrl()

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.

Warning
Setting blocking to 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.
Returns
true if loading was successful

Definition at line 109 of file qgswebenginepage.cpp.


The documentation for this class was generated from the following files: