QWebEnginePage::certificateError Qt5
-
I have this Qt6 code that I have to adapt to Qt5
connect(webPage, &QWebEnginePage::certificateError, this, &Home::onCertificateError);And the slot:
void Home::onCertificateError(QWebEngineCertificateError error) { auto mutableError = const_cast<QWebEngineCertificateError&>(error); #if QT_VERSION >= QT_VERSION_CHECK(6,0,0) mutableError.acceptCertificate(); #else mutableError.ignoreCertificateError(); #endif }Unfortunately I cannot find a Qt5 alternative to the signal
QWebEnginePage::certificateErrorAny suggestion on how I can solve my problem?
-
I have this Qt6 code that I have to adapt to Qt5
connect(webPage, &QWebEnginePage::certificateError, this, &Home::onCertificateError);And the slot:
void Home::onCertificateError(QWebEngineCertificateError error) { auto mutableError = const_cast<QWebEngineCertificateError&>(error); #if QT_VERSION >= QT_VERSION_CHECK(6,0,0) mutableError.acceptCertificate(); #else mutableError.ignoreCertificateError(); #endif }Unfortunately I cannot find a Qt5 alternative to the signal
QWebEnginePage::certificateErrorAny suggestion on how I can solve my problem?
@franco-amato said in QWebEnginePage::certificateError Qt5:
Unfortunately I cannot find a Qt5 alternative to the signal
It's QWebEnginePage now: https://doc.qt.io/qt-6/qwebenginepage.html#certificateError
-
According to https://doc.qt.io/qt-5/qwebenginepage.html#certificateError, In Qt5
certificateErroris not a signal but a virtual protected function, so instead of connecting a slot like in Qt6, you'll need to subclassQWebEnginePageand reimplement the function. -
According to https://doc.qt.io/qt-5/qwebenginepage.html#certificateError, In Qt5
certificateErroris not a signal but a virtual protected function, so instead of connecting a slot like in Qt6, you'll need to subclassQWebEnginePageand reimplement the function. -
According to https://doc.qt.io/qt-5/qwebenginepage.html#certificateError, In Qt5
certificateErroris not a signal but a virtual protected function, so instead of connecting a slot like in Qt6, you'll need to subclassQWebEnginePageand reimplement the function.@Bonnie said in QWebEnginePage::certificateError Qt5:
According to https://doc.qt.io/qt-5/qwebenginepage.html#certificateError, In Qt5
certificateErroris not a signal but a virtual protected function, so instead of connecting a slot like in Qt6, you'll need to subclassQWebEnginePageand reimplement the function.Unfortunately I cannot subclass the QWebEnginePage. Do you know any other workaround that can temporarily fix?
-
@Bonnie said in QWebEnginePage::certificateError Qt5:
According to https://doc.qt.io/qt-5/qwebenginepage.html#certificateError, In Qt5
certificateErroris not a signal but a virtual protected function, so instead of connecting a slot like in Qt6, you'll need to subclassQWebEnginePageand reimplement the function.Unfortunately I cannot subclass the QWebEnginePage. Do you know any other workaround that can temporarily fix?
-
@franco-amato Nope, that seems to be the only way in Qt5.
If you are usingQWebEngineView, it is possible to use subclassed QWebEnginePage.
Just create an instance and make it replace the original one by callingQWebEngineView::setPage.@Bonnie said in QWebEnginePage::certificateError Qt5:
@franco-amato Nope, that seems to be the only way in Qt5.
If you are usingQWebEngineView, it is possible to use subclassed QWebEnginePage.
Just create an instance and make it replace the original one by callingQWebEngineView::setPage.I didn't get your suggestion. Ccould you help with a small example code please?
-
@Bonnie said in QWebEnginePage::certificateError Qt5:
@franco-amato Nope, that seems to be the only way in Qt5.
If you are usingQWebEngineView, it is possible to use subclassed QWebEnginePage.
Just create an instance and make it replace the original one by callingQWebEngineView::setPage.I didn't get your suggestion. Ccould you help with a small example code please?
@franco-amato Here's a SO post with example code: https://stackoverflow.com/questions/58875159/how-to-ignore-ssl-certificate-errors-with-qwebengineview/58968727#58968727