diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-04-30 12:10:54 +0200 |
---|---|---|
committer | Kirill Burtsev <kirill.burtsev@qt.io> | 2021-05-25 10:31:12 +0200 |
commit | 9167c802f9a05394f72e0ba0dfb744b415686f46 (patch) | |
tree | 294344eda1b5c89de9300a69d8d396bcbeba4ab4 /tests/auto | |
parent | 1a1964e32a78cf917f43c6cfee328f1dadc1d31b (diff) |
Make handling of certificate errors possible from a signal
Task-number: QTBUG-74587
Change-Id: I9955a4c70b339523b5e9e9d6dffe928e61fbab90
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/widgets/certificateerror/tst_certificateerror.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/auto/widgets/certificateerror/tst_certificateerror.cpp b/tests/auto/widgets/certificateerror/tst_certificateerror.cpp index 29b35df93..74c7e3bd4 100644 --- a/tests/auto/widgets/certificateerror/tst_certificateerror.cpp +++ b/tests/auto/widgets/certificateerror/tst_certificateerror.cpp @@ -48,9 +48,15 @@ private Q_SLOTS: struct PageWithCertificateErrorHandler : QWebEnginePage { + Q_OBJECT + +public: PageWithCertificateErrorHandler(bool defer, bool accept, QObject *p = nullptr) : QWebEnginePage(p), deferError(defer), acceptCertificate(accept) - , loadSpy(this, &QWebEnginePage::loadFinished) { + , loadSpy(this, &QWebEnginePage::loadFinished) + { + connect(this, &PageWithCertificateErrorHandler::certificateError, + this, &PageWithCertificateErrorHandler::onCertificateError); } bool deferError, acceptCertificate; @@ -58,7 +64,8 @@ struct PageWithCertificateErrorHandler : QWebEnginePage QSignalSpy loadSpy; QScopedPointer<QWebEngineCertificateError> error; - void certificateError(QWebEngineCertificateError e) override +public Q_SLOTS: + void onCertificateError(QWebEngineCertificateError e) { error.reset(new QWebEngineCertificateError(e)); if (deferError) { |