make BrowserView::onLinkHovered() working with QtWebKit
This commit is contained in:
@@ -411,6 +411,8 @@ BrowserView::BrowserView(QWidget* parent)
|
||||
palette.setBrush(QPalette::Base, Qt::white);
|
||||
view->page()->setPalette(palette);
|
||||
|
||||
connect(view->page(), SIGNAL(linkHovered(const QString &, const QString &, const QString &)),
|
||||
this, SLOT(onLinkHovered(const QString &, const QString &, const QString &)));
|
||||
connect(view, SIGNAL(linkClicked(const QUrl &)),
|
||||
this, SLOT(onLinkClicked(const QUrl &)));
|
||||
connect(view->page(), SIGNAL(downloadRequested(const QNetworkRequest &)),
|
||||
@@ -439,9 +441,9 @@ BrowserView::BrowserView(QWidget* parent)
|
||||
this, SLOT(onDownloadRequested(QWebEngineDownloadItem*)));
|
||||
connect(view->page(), SIGNAL(iconChanged(const QIcon &)),
|
||||
this, SLOT(setWindowIcon(const QIcon &)));
|
||||
#endif
|
||||
connect(view->page(), SIGNAL(linkHovered(const QString &)),
|
||||
this, SLOT(onLinkHovered(const QString &)));
|
||||
#endif
|
||||
connect(view, SIGNAL(viewSource(const QUrl&)),
|
||||
this, SLOT(onViewSource(const QUrl&)));
|
||||
connect(view, SIGNAL(loadStarted()),
|
||||
@@ -465,11 +467,6 @@ BrowserView::~BrowserView()
|
||||
delete view;
|
||||
}
|
||||
|
||||
void BrowserView::onLinkHovered(const QString& url)
|
||||
{
|
||||
Gui::getMainWindow()->statusBar()->showMessage(url);
|
||||
}
|
||||
|
||||
#ifdef QTWEBENGINE
|
||||
void BrowserView::urlFilter(const QUrl &url)
|
||||
#else
|
||||
@@ -570,6 +567,11 @@ void BrowserView::setWindowIcon(const QIcon &icon)
|
||||
Gui::MDIView::setWindowIcon(icon);
|
||||
}
|
||||
|
||||
void BrowserView::onLinkHovered(const QString& url)
|
||||
{
|
||||
Gui::getMainWindow()->statusBar()->showMessage(url);
|
||||
}
|
||||
|
||||
void BrowserView::onViewSource(const QUrl &url)
|
||||
{
|
||||
Q_UNUSED(url);
|
||||
@@ -601,6 +603,15 @@ void BrowserView::onUnsupportedContent(QNetworkReply* reply)
|
||||
view->reload();
|
||||
}
|
||||
|
||||
void BrowserView::onLinkHovered(const QString& link, const QString& title, const QString& textContent)
|
||||
{
|
||||
Q_UNUSED(title)
|
||||
Q_UNUSED(textContent)
|
||||
QUrl url = QUrl::fromEncoded(link.toLatin1());
|
||||
QString str = url.isValid() ? url.toString() : link;
|
||||
Gui::getMainWindow()->statusBar()->showMessage(str);
|
||||
}
|
||||
|
||||
void BrowserView::onViewSource(const QUrl &url)
|
||||
{
|
||||
Q_UNUSED(url);
|
||||
|
||||
@@ -114,12 +114,13 @@ protected Q_SLOTS:
|
||||
void onDownloadRequested(QWebEngineDownloadItem *request);
|
||||
void setWindowIcon(const QIcon &icon);
|
||||
void urlFilter(const QUrl &url);
|
||||
void onLinkHovered(const QString& url);
|
||||
#else
|
||||
void onDownloadRequested(const QNetworkRequest& request);
|
||||
void onUnsupportedContent(QNetworkReply* reply);
|
||||
void onLinkClicked (const QUrl& url);
|
||||
void onLinkHovered(const QString& link, const QString& title, const QString& textContent);
|
||||
#endif
|
||||
void onLinkHovered(const QString& url);
|
||||
void onViewSource(const QUrl &url);
|
||||
void onOpenLinkInExternalBrowser(const QUrl& url);
|
||||
void onOpenLinkInNewWindow(const QUrl&);
|
||||
|
||||
Reference in New Issue
Block a user