File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed
Applications/SlicerApp/Testing/Python Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -98,8 +98,7 @@ def onSiteButtonClicked(self, site):
9898 slicerGeometry = slicer .util .mainWindow ().geometry
9999 webWidget .size = qt .QSize (1536 ,1024 )
100100 webWidget .pos = qt .QPoint (slicerGeometry .x () + 256 , slicerGeometry .y () + 128 )
101- webView = webWidget .webView ()
102- webView .url = qt .QUrl (site ["url" ])
101+ webWidget .url = site ["url" ]
103102 webWidget .show ()
104103 self .webWidgets .append (webWidget )
105104
Original file line number Diff line number Diff line change @@ -358,6 +358,21 @@ QString qSlicerWebWidget::evalJS(const QString &js)
358358
359359}
360360
361+ // -----------------------------------------------------------------------------
362+ void qSlicerWebWidget::setUrl (const QString &url)
363+ {
364+ Q_D (qSlicerWebWidget);
365+
366+ d->WebView ->setUrl (QUrl (url));
367+ }
368+
369+ // -----------------------------------------------------------------------------
370+ QString qSlicerWebWidget::url ()
371+ {
372+ Q_D (qSlicerWebWidget);
373+
374+ return d->WebView ->url ().toString ();
375+ }
361376
362377// --------------------------------------------------------------------------
363378void qSlicerWebWidget::onDownloadStarted (QNetworkReply* reply)
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ class Q_SLICER_BASE_QTGUI_EXPORT qSlicerWebWidget
5757 Q_OBJECT
5858 Q_PROPERTY (bool handleExternalUrlWithDesktopService READ handleExternalUrlWithDesktopService WRITE setHandleExternalUrlWithDesktopService)
5959 Q_PROPERTY (QStringList internalHosts READ internalHosts WRITE setInternalHosts)
60+ Q_PROPERTY (QString url READ url WRITE setUrl)
6061 friend class qSlicerWebEnginePage ;
6162public:
6263 // / Superclass typedef
@@ -99,8 +100,14 @@ class Q_SLICER_BASE_QTGUI_EXPORT qSlicerWebWidget
99100 // / from C++ or Python code
100101 Q_INVOKABLE QString evalJS (const QString &js);
101102
103+ // / Convenience for setting the internal webView QUrl from a QString
104+ Q_INVOKABLE QString url ();
105+
102106public slots:
103107
108+ // / Convenience for setting the internal webView QUrl from a QString
109+ void setUrl (const QString &url);
110+
104111 void onDownloadStarted (QNetworkReply* reply);
105112
106113 void onDownloadProgress (qint64 bytesReceived, qint64 bytesTotal);
You can’t perform that action at this time.
0 commit comments