Slicer  4.11
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
 
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...
 

Signals

void evalResult (QString js, QString result)
 emited with result of evalJS More...
 
void loadFinished (bool ok)
 
void loadProgress (int progress)
 
void loadStarted ()
 signal passed through from QWebEngineView 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...
 
 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)
 
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 54 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.

◆ url

QString qSlicerWebWidget::url
readwrite

Definition at line 50 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 qSlicerExtensionsInstallWidget.

◆ 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

emited 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)

◆ 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

◆ 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)

◆ 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 51 of file qSlicerWebWidget.h.

Member Data Documentation

◆ d_ptr

QScopedPointer<qSlicerWebWidgetPrivate> qSlicerWebWidget::d_ptr
protected

Definition at line 124 of file qSlicerWebWidget.h.


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