Skip to content

Commit

Permalink
BUG: Remove obsolete Webkit-specific integration code from qSlicerWeb…
Browse files Browse the repository at this point in the history
…Widget

This commit updates qSlicerWebWidget to remove obsolete code related to Webkit
integration. The removal of this code prevents the display of a warning message
that occurs when loading a page after opening the extension manager or explicitly
instantiating a qSlicerWebWidget and setting its URL property.

The warning message was:
```
"JQuery not loaded - Failed to trigger webkitvisibilitychange"
```

This integration was initially introduced in commit 8d7f94e ("BUG: Prevent
extensions from being loaded twice when 'Install' tab initially hidden", 2013-02-04),
but the support for Webkit was later removed in commits:
* 6bd2db5 ("COMP: Remove support for building against Qt WebKit module", 2019-03-08)
* f3edc8f ("STYLE: Remove obsolete code supporting use of Qt WebKit module", 2019-03-08)
  • Loading branch information
jcfr committed Mar 6, 2024
1 parent ee89d6f commit 26f728a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
20 changes: 0 additions & 20 deletions Base/QTGUI/qSlicerWebWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ void qSlicerWebWidgetPrivate::init()
this, SLOT(onAppAboutToQuit()));
this->verticalLayout->insertWidget(0, this->WebView);

this->WebView->installEventFilter(q);

QObject::connect(this->WebView, SIGNAL(loadStarted()),
q, SLOT(onLoadStarted()));

Expand Down Expand Up @@ -429,8 +427,6 @@ void qSlicerWebWidget::printToPdf(const QString& filePath, const QPageLayout& pa
// --------------------------------------------------------------------------
void qSlicerWebWidget::initJavascript()
{
Q_D(qSlicerWebWidget);
d->setDocumentWebkitHidden(!d->WebView->isVisible());
}

// --------------------------------------------------------------------------
Expand Down Expand Up @@ -496,19 +492,3 @@ void qSlicerWebWidget::handleSslErrors(QNetworkReply* reply,
}
#endif
}

// --------------------------------------------------------------------------
bool qSlicerWebWidget::eventFilter(QObject* obj, QEvent* event)
{
Q_D(qSlicerWebWidget);
Q_ASSERT(d->WebView == obj);
if (d->WebView == obj && !event->spontaneous() &&
(event->type() == QEvent::Show || event->type() == QEvent::Hide))
{
d->setDocumentWebkitHidden(!d->WebView->isVisible());
this->evalJS("if (typeof $ != 'undefined') {"
" $.event.trigger({type: 'webkitvisibilitychange'})"
"} else { console.info('JQuery not loaded - Failed to trigger webkitvisibilitychange') }");
}
return QObject::eventFilter(obj, event);
}
4 changes: 0 additions & 4 deletions Base/QTGUI/qSlicerWebWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ protected slots:
qSlicerWebWidget(qSlicerWebWidgetPrivate* pimpl, QWidget* parent = nullptr);
QScopedPointer<qSlicerWebWidgetPrivate> d_ptr;

/// Event filter used to capture WebView Show and Hide events in order to both set
/// "document.webkitHidden" property and trigger the associated event.
bool eventFilter(QObject *obj, QEvent *event) override;

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

private:
Expand Down

0 comments on commit 26f728a

Please sign in to comment.