Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
List of all members | Public Types | Properties | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Friends
qSlicerWebWidget Class Reference

#include <Base/QTGUI/qSlicerWebWidget.h>

Inheritance diagram for qSlicerWebWidget:
Inheritance graph
[legend]
Collaboration diagram for qSlicerWebWidget:
Collaboration graph
[legend]

Public Types

typedef QWidget Superclass
 Superclass typedef. More...
 

Properties

bool handleExternalUrlWithDesktopService
 
QStringList internalHosts
 
bool javaScriptConsoleMessageLoggingEnabled
 
QString url
 

Public Slots

void onDownloadFinished (QNetworkReply *reply)
 
void onDownloadProgress (qint64 bytesReceived, qint64 bytesTotal)
 
void onDownloadStarted (QNetworkReply *reply)
 
void setUrl (const QString &url)
 Convenience for setting the internal webView QUrl from a QString. More...
 
void printToPdf (const QString &filePath)
 
void printToPdf (const QString &filePath, const QPageLayout &pageLayout)
 

Signals

void evalResult (QString js, QString result)
 emitted with result of evalJS More...
 
void loadFinished (bool ok)
 
void loadProgress (int progress)
 
void loadStarted ()
 signal passed through from QWebEngineView More...
 
void pdfPrintingFinished (const QString &filePath, bool success)
 signal passed through from QWebEnginePage More...
 

Public Member Functions

Q_INVOKABLE QString evalJS (const QString &js)
 
bool handleExternalUrlWithDesktopService () const
 Return true if external URL should be open with desktop service. More...
 
QStringList internalHosts () const
 Set/Get internal host. More...
 
bool javaScriptConsoleMessageLoggingEnabled () const
 Return true if javascript console messages should be logged. More...
 
 qSlicerWebWidget (QWidget *parent=nullptr)
 Constructor. More...
 
void setHandleExternalUrlWithDesktopService (bool enable)
 
Q_INVOKABLE void setHtml (const QString &html, const QUrl &baseUrl=QUrl())
 Convenience for setting the internal webView html from a QString. More...
 
void setInternalHosts (const QStringList &hosts)
 
void setJavaScriptConsoleMessageLoggingEnabled (bool enable)
 
Q_INVOKABLE QString url ()
 Convenience for setting the internal webView QUrl from a QString. More...
 
Q_INVOKABLE QWebEngineView * webView ()
 Return a reference to the QWebView used internally. More...
 
 ~qSlicerWebWidget () override
 Destructor. More...
 

Protected Slots

void handleSslErrors (QNetworkReply *reply, const QList< QSslError > &errors)
 
virtual void initJavascript ()
 
virtual void onLoadFinished (bool ok)
 
virtual void onLoadProgress (int progress)
 
virtual void onLoadStarted ()
 

Protected Member Functions

virtual bool acceptNavigationRequest (const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame)
 
bool eventFilter (QObject *obj, QEvent *event) override
 
 qSlicerWebWidget (qSlicerWebWidgetPrivate *pimpl, QWidget *parent=nullptr)
 

Protected Attributes

QScopedPointer< qSlicerWebWidgetPrivate > d_ptr
 

Friends

class qSlicerWebEnginePage
 

Detailed Description

Definition at line 44 of file qSlicerWebWidget.h.

Member Typedef Documentation

◆ Superclass

Superclass typedef.

Definition at line 55 of file qSlicerWebWidget.h.

Property Documentation

◆ handleExternalUrlWithDesktopService

bool qSlicerWebWidget::handleExternalUrlWithDesktopService
readwrite

Definition at line 48 of file qSlicerWebWidget.h.

◆ internalHosts

QStringList qSlicerWebWidget::internalHosts
readwrite

Definition at line 49 of file qSlicerWebWidget.h.

◆ javaScriptConsoleMessageLoggingEnabled

bool qSlicerWebWidget::javaScriptConsoleMessageLoggingEnabled
readwrite

Definition at line 50 of file qSlicerWebWidget.h.

◆ url

QString qSlicerWebWidget::url
readwrite

Definition at line 51 of file qSlicerWebWidget.h.

Constructor & Destructor Documentation

◆ qSlicerWebWidget() [1/2]

qSlicerWebWidget::qSlicerWebWidget ( QWidget *  parent = nullptr)
explicit

Constructor.

◆ ~qSlicerWebWidget()

qSlicerWebWidget::~qSlicerWebWidget ( )
override

Destructor.

◆ qSlicerWebWidget() [2/2]

qSlicerWebWidget::qSlicerWebWidget ( qSlicerWebWidgetPrivate *  pimpl,
QWidget *  parent = nullptr 
)
protected

Member Function Documentation

◆ acceptNavigationRequest()

virtual bool qSlicerWebWidget::acceptNavigationRequest ( const QUrl &  url,
QWebEnginePage::NavigationType  type,
bool  isMainFrame 
)
protectedvirtual

Reimplemented in qSlicerExtensionsServerWidget.

◆ evalJS()

Q_INVOKABLE QString qSlicerWebWidget::evalJS ( const QString &  js)

Convenient function to evaluate JS in main frame context from C++ or Python code

◆ evalResult

void qSlicerWebWidget::evalResult ( QString  js,
QString  result 
)
signal

emitted with result of evalJS

◆ eventFilter()

bool qSlicerWebWidget::eventFilter ( QObject *  obj,
QEvent *  event 
)
overrideprotected

Event filter used to capture WebView Show and Hide events in order to both set "document.webkitHidden" property and trigger the associated event.

◆ handleExternalUrlWithDesktopService()

bool qSlicerWebWidget::handleExternalUrlWithDesktopService ( ) const

Return true if external URL should be open with desktop service.

Setting both this property to true and at least one internal host will ensure URLs not matching an internal host are open with the current desktop browser.

See also
setInternalHost(const QString&)
QDesktopServices::openUrl

◆ handleSslErrors

void qSlicerWebWidget::handleSslErrors ( QNetworkReply *  reply,
const QList< QSslError > &  errors 
)
protectedslot

◆ initJavascript

virtual void qSlicerWebWidget::initJavascript ( )
protectedvirtualslot

◆ internalHosts()

QStringList qSlicerWebWidget::internalHosts ( ) const

Set/Get internal host.

See also
setHandleExternalUrlWithDesktopService(bool)

◆ javaScriptConsoleMessageLoggingEnabled()

bool qSlicerWebWidget::javaScriptConsoleMessageLoggingEnabled ( ) const

Return true if javascript console messages should be logged.

Default value initialized based on the "Developer/DeveloperMode" setting.

See also
setJavaScriptConsoleMessageLoggingEnabled(bool)
QWebEnginePage::javaScriptConsoleMessage

◆ loadFinished

void qSlicerWebWidget::loadFinished ( bool  ok)
signal

◆ loadProgress

void qSlicerWebWidget::loadProgress ( int  progress)
signal

◆ loadStarted

void qSlicerWebWidget::loadStarted ( )
signal

signal passed through from QWebEngineView

◆ onDownloadFinished

void qSlicerWebWidget::onDownloadFinished ( QNetworkReply *  reply)
slot

◆ onDownloadProgress

void qSlicerWebWidget::onDownloadProgress ( qint64  bytesReceived,
qint64  bytesTotal 
)
slot

◆ onDownloadStarted

void qSlicerWebWidget::onDownloadStarted ( QNetworkReply *  reply)
slot

◆ onLoadFinished

virtual void qSlicerWebWidget::onLoadFinished ( bool  ok)
protectedvirtualslot

◆ onLoadProgress

virtual void qSlicerWebWidget::onLoadProgress ( int  progress)
protectedvirtualslot

◆ onLoadStarted

virtual void qSlicerWebWidget::onLoadStarted ( )
protectedvirtualslot

◆ pdfPrintingFinished

void qSlicerWebWidget::pdfPrintingFinished ( const QString &  filePath,
bool  success 
)
signal

signal passed through from QWebEnginePage

◆ printToPdf [1/2]

void qSlicerWebWidget::printToPdf ( const QString &  filePath)
slot

Renders the current content of the page into a PDF document and saves it in the location specified in filePath.

The page size and orientation of the produced PDF document are taken from the values specified in pageLayout. This method issues an asynchronous request for printing the web page into a PDF and returns immediately. To be informed about the result of the request, connect to the signal pdfPrintingFinished().

If a file already exists at the provided file path, it will be overwritten.

See also
QWebEnginePage::printToPdf

◆ printToPdf [2/2]

void qSlicerWebWidget::printToPdf ( const QString &  filePath,
const QPageLayout &  pageLayout 
)
slot

◆ setHandleExternalUrlWithDesktopService()

void qSlicerWebWidget::setHandleExternalUrlWithDesktopService ( bool  enable)

◆ setHtml()

Q_INVOKABLE void qSlicerWebWidget::setHtml ( const QString &  html,
const QUrl &  baseUrl = QUrl() 
)

Convenience for setting the internal webView html from a QString.

◆ setInternalHosts()

void qSlicerWebWidget::setInternalHosts ( const QStringList &  hosts)

◆ setJavaScriptConsoleMessageLoggingEnabled()

void qSlicerWebWidget::setJavaScriptConsoleMessageLoggingEnabled ( bool  enable)

◆ setUrl

void qSlicerWebWidget::setUrl ( const QString &  url)
slot

Convenience for setting the internal webView QUrl from a QString.

◆ url()

Q_INVOKABLE QString qSlicerWebWidget::url ( )

Convenience for setting the internal webView QUrl from a QString.

◆ webView()

Q_INVOKABLE QWebEngineView* qSlicerWebWidget::webView ( )

Return a reference to the QWebView used internally.

Friends And Related Function Documentation

◆ qSlicerWebEnginePage

friend class qSlicerWebEnginePage
friend

Definition at line 52 of file qSlicerWebWidget.h.

Member Data Documentation

◆ d_ptr

QScopedPointer<qSlicerWebWidgetPrivate> qSlicerWebWidget::d_ptr
protected

Definition at line 150 of file qSlicerWebWidget.h.


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