21 #ifndef __qSlicerWebWidget_h 22 #define __qSlicerWebWidget_h 29 #include "qSlicerBaseQTGUIExport.h" 31 #include "vtkSlicerConfigure.h" 34 class qSlicerWebWidgetPrivate;
36 #ifdef Slicer_HAVE_WEBKIT_SUPPORT 40 #include <QWebEnginePage> 44 #if (QT_VERSION < QT_VERSION_CHECK(5, 3, 0)) 58 Q_PROPERTY(
bool handleExternalUrlWithDesktopService READ handleExternalUrlWithDesktopService WRITE setHandleExternalUrlWithDesktopService)
59 Q_PROPERTY(QStringList internalHosts READ internalHosts WRITE setInternalHosts)
60 Q_PROPERTY(QString url READ url WRITE setUrl)
61 friend class qSlicerWebEnginePage;
80 bool handleExternalUrlWithDesktopService() const;
81 void setHandleExternalUrlWithDesktopService(
bool enable);
86 QStringList internalHosts() const;
87 void setInternalHosts(const QStringList& hosts);
93 #ifdef Slicer_HAVE_WEBKIT_SUPPORT 94 Q_INVOKABLE QWebView * webView();
96 Q_INVOKABLE QWebEngineView * webView();
101 Q_INVOKABLE QString evalJS(
const QString &js);
104 Q_INVOKABLE QString url();
109 void setUrl(
const QString &url);
111 void onDownloadStarted(QNetworkReply* reply);
113 void onDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
115 void onDownloadFinished(QNetworkReply* reply);
119 void evalResult(QString js, QString result);
123 void loadProgress(
int progress);
124 void loadFinished(
bool ok);
127 virtual void initJavascript();
128 virtual void onLoadStarted();
129 virtual void onLoadProgress(
int progress);
130 virtual void onLoadFinished(
bool ok);
131 #ifdef Slicer_HAVE_WEBKIT_SUPPORT 132 virtual void onLinkClicked(
const QUrl& url);
138 QScopedPointer<qSlicerWebWidgetPrivate>
d_ptr;
142 bool eventFilter(QObject *obj, QEvent *event);
144 #ifndef Slicer_HAVE_WEBKIT_SUPPORT 145 virtual bool acceptNavigationRequest(
const QUrl & url, QWebEnginePage::NavigationType type,
bool isMainFrame);