Web: switch to new-style connect in order to find failures with Qt6

This commit is contained in:
wmayer
2023-01-02 00:35:37 +01:00
parent 64f6f73bcf
commit a67f4fcb74

View File

@@ -358,17 +358,21 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
// building a custom signal for external browser action
QSignalMapper* signalMapper = new QSignalMapper (&menu);
signalMapper->setProperty("url", QVariant(linkUrl));
connect(signalMapper, SIGNAL(mapped(int)),
this, SLOT(triggerContextMenuAction(int)));
QAction* extAction = menu.addAction(tr("Open in External Browser"));
connect (extAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
signalMapper->setMapping(extAction, WebAction::OpenLink);
QAction* newAction = menu.addAction(tr("Open in new window"));
connect (newAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
signalMapper->setMapping(newAction, WebAction::OpenLinkInNewWindow);
#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
connect(signalMapper, qOverload<int>(&QSignalMapper::mapped), this, &WebView::triggerContextMenuAction);
#else
connect(signalMapper, &QSignalMapper::mappedInt, this, &WebView::triggerContextMenuAction);
#endif
connect(extAction, &QAction::triggered, signalMapper, qOverload<>(&QSignalMapper::map));
connect(newAction, &QAction::triggered, signalMapper, qOverload<>(&QSignalMapper::map));
menu.addAction(pageAction(QWebEnginePage::DownloadLinkToDisk));
menu.addAction(pageAction(QWebEnginePage::CopyLinkToClipboard));
menu.exec(mapToGlobal(event->pos()));
@@ -391,9 +395,12 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
QSignalMapper* signalMapper = new QSignalMapper (this);
signalMapper->setProperty("url", QVariant(linkUrl));
signalMapper->setMapping(ac, WebAction::ViewSource);
connect(signalMapper, SIGNAL(mapped(int)),
this, SLOT(triggerContextMenuAction(int)));
connect (ac, SIGNAL(triggered()), signalMapper, SLOT(map()));
#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
connect(signalMapper, qOverload<int>(&QSignalMapper::mapped), this, &WebView::triggerContextMenuAction);
#else
connect(signalMapper, &QSignalMapper::mappedInt, this, &WebView::triggerContextMenuAction);
#endif
connect(ac, &QAction::triggered, signalMapper, qOverload<>(&QSignalMapper::map));
}
}
}
@@ -511,27 +518,27 @@ BrowserView::BrowserView(QWidget* parent)
connect(view->page()->profile(), &QWebEngineProfile::downloadRequested,
this, &BrowserView::onDownloadRequested);
connect(view->page(), SIGNAL(iconChanged(const QIcon &)),
this, SLOT(setWindowIcon(const QIcon &)));
connect(view->page(), SIGNAL(linkHovered(const QString &)),
this, SLOT(onLinkHovered(const QString &)));
connect(view->page(), &QWebEnginePage::iconChanged,
this, &BrowserView::setWindowIcon);
connect(view->page(), &QWebEnginePage::linkHovered,
this, &BrowserView::onLinkHovered);
#endif
connect(view, SIGNAL(viewSource(const QUrl&)),
this, SLOT(onViewSource(const QUrl&)));
connect(view, SIGNAL(loadStarted()),
this, SLOT(onLoadStarted()));
connect(view, SIGNAL(loadProgress(int)),
this, SLOT(onLoadProgress(int)));
connect(view, SIGNAL(loadFinished(bool)),
this, SLOT(onLoadFinished(bool)));
connect(view, SIGNAL(openLinkInExternalBrowser(const QUrl &)),
this, SLOT(onOpenLinkInExternalBrowser(const QUrl &)));
connect(view, SIGNAL(openLinkInNewWindow(const QUrl &)),
this, SLOT(onOpenLinkInNewWindow(const QUrl &)));
connect(view, SIGNAL(loadStarted()),
this, SLOT(onUpdateBrowserActions()));
connect(view, SIGNAL(loadFinished(bool)),
this, SLOT(onUpdateBrowserActions()));
connect(view, &WebView::viewSource,
this, &BrowserView::onViewSource);
connect(view, &WebView::loadStarted,
this, &BrowserView::onLoadStarted);
connect(view, &WebView::loadProgress,
this, &BrowserView::onLoadProgress);
connect(view, &WebView::loadFinished,
this, &BrowserView::onLoadFinished);
connect(view, &WebView::openLinkInExternalBrowser,
this, &BrowserView::onOpenLinkInExternalBrowser);
connect(view, &WebView::openLinkInNewWindow,
this, &BrowserView::onOpenLinkInNewWindow);
connect(view, &WebView::loadStarted,
this, &BrowserView::onUpdateBrowserActions);
connect(view, &WebView::loadFinished,
this, &BrowserView::onUpdateBrowserActions);
}
/** Destroys the object and frees any allocated resources */