21 #ifndef __qSlicerWebWidget_h 22 #define __qSlicerWebWidget_h 29 #include "qSlicerBaseQTGUIExport.h" 31 #include "vtkSlicerConfigure.h" 34 class qSlicerWebWidgetPrivate;
37 #include <QWebEnginePage> 48 Q_PROPERTY(
bool handleExternalUrlWithDesktopService READ handleExternalUrlWithDesktopService WRITE setHandleExternalUrlWithDesktopService)
49 Q_PROPERTY(QStringList internalHosts READ internalHosts WRITE setInternalHosts)
50 Q_PROPERTY(QString url READ url WRITE setUrl)
51 friend class qSlicerWebEnginePage;
70 bool handleExternalUrlWithDesktopService() const;
71 void setHandleExternalUrlWithDesktopService(
bool enable);
76 QStringList internalHosts() const;
77 void setInternalHosts(const QStringList& hosts);
83 Q_INVOKABLE QWebEngineView * webView();
87 Q_INVOKABLE QString evalJS(const QString &js);
90 Q_INVOKABLE QString url();
93 Q_INVOKABLE
void setHtml(const QString &html, const QUrl &baseUrl = QUrl());
98 void setUrl(const QString &url);
100 void onDownloadStarted(QNetworkReply* reply);
102 void onDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
104 void onDownloadFinished(QNetworkReply* reply);
114 void printToPdf(const QString& filePath);
118 void evalResult(QString js, QString result);
122 void loadProgress(
int progress);
123 void loadFinished(
bool ok);
126 void pdfPrintingFinished(const QString &filePath,
bool success);
129 virtual
void initJavascript();
130 virtual
void onLoadStarted();
131 virtual
void onLoadProgress(
int progress);
132 virtual
void onLoadFinished(
bool ok);
133 void handleSslErrors(QNetworkReply* reply, const
QList<QSslError> &errors);
136 qSlicerWebWidget(qSlicerWebWidgetPrivate* pimpl, QWidget* parent =
nullptr);
137 QScopedPointer<qSlicerWebWidgetPrivate> d_ptr;
141 bool eventFilter(QObject *obj, QEvent *event) override;
143 virtual
bool acceptNavigationRequest(const QUrl & url, QWebEnginePage::NavigationType type,
bool isMainFrame);