Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QWebEnginePage::certificateError Qt5
Forum Updated to NodeBB v4.3 + New Features

QWebEnginePage::certificateError Qt5

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 640 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • franco.amatoF Offline
    franco.amatoF Offline
    franco.amato
    wrote on last edited by
    #1

    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::certificateError
    

    Any suggestion on how I can solve my problem?

    jsulmJ 1 Reply Last reply
    0
    • franco.amatoF franco.amato

      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::certificateError
      

      Any suggestion on how I can solve my problem?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Bonnie
        wrote on last edited by Bonnie
        #3

        According to https://doc.qt.io/qt-5/qwebenginepage.html#certificateError, In Qt5 certificateError is not a signal but a virtual protected function, so instead of connecting a slot like in Qt6, you'll need to subclass QWebEnginePage and reimplement the function.

        jsulmJ franco.amatoF 2 Replies Last reply
        0
        • B Bonnie

          According to https://doc.qt.io/qt-5/qwebenginepage.html#certificateError, In Qt5 certificateError is not a signal but a virtual protected function, so instead of connecting a slot like in Qt6, you'll need to subclass QWebEnginePage and reimplement the function.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Bonnie @franco-amato Oh, it looks like I misunderstood the question, forget my post :-)

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • B Bonnie

            According to https://doc.qt.io/qt-5/qwebenginepage.html#certificateError, In Qt5 certificateError is not a signal but a virtual protected function, so instead of connecting a slot like in Qt6, you'll need to subclass QWebEnginePage and reimplement the function.

            franco.amatoF Offline
            franco.amatoF Offline
            franco.amato
            wrote on last edited by
            #5

            @Bonnie said in QWebEnginePage::certificateError Qt5:

            According to https://doc.qt.io/qt-5/qwebenginepage.html#certificateError, In Qt5 certificateError is not a signal but a virtual protected function, so instead of connecting a slot like in Qt6, you'll need to subclass QWebEnginePage and reimplement the function.

            Unfortunately I cannot subclass the QWebEnginePage. Do you know any other workaround that can temporarily fix?

            B 1 Reply Last reply
            0
            • franco.amatoF franco.amato

              @Bonnie said in QWebEnginePage::certificateError Qt5:

              According to https://doc.qt.io/qt-5/qwebenginepage.html#certificateError, In Qt5 certificateError is not a signal but a virtual protected function, so instead of connecting a slot like in Qt6, you'll need to subclass QWebEnginePage and reimplement the function.

              Unfortunately I cannot subclass the QWebEnginePage. Do you know any other workaround that can temporarily fix?

              B Offline
              B Offline
              Bonnie
              wrote on last edited by
              #6

              @franco-amato Nope, that seems to be the only way in Qt5.
              If you are using QWebEngineView, it is possible to use subclassed QWebEnginePage.
              Just create an instance and make it replace the original one by calling QWebEngineView::setPage.

              franco.amatoF 1 Reply Last reply
              0
              • B Bonnie

                @franco-amato Nope, that seems to be the only way in Qt5.
                If you are using QWebEngineView, it is possible to use subclassed QWebEnginePage.
                Just create an instance and make it replace the original one by calling QWebEngineView::setPage.

                franco.amatoF Offline
                franco.amatoF Offline
                franco.amato
                wrote on last edited by
                #7

                @Bonnie said in QWebEnginePage::certificateError Qt5:

                @franco-amato Nope, that seems to be the only way in Qt5.
                If you are using QWebEngineView, it is possible to use subclassed QWebEnginePage.
                Just create an instance and make it replace the original one by calling QWebEngineView::setPage.

                I didn't get your suggestion. Ccould you help with a small example code please?

                B 1 Reply Last reply
                0
                • franco.amatoF franco.amato

                  @Bonnie said in QWebEnginePage::certificateError Qt5:

                  @franco-amato Nope, that seems to be the only way in Qt5.
                  If you are using QWebEngineView, it is possible to use subclassed QWebEnginePage.
                  Just create an instance and make it replace the original one by calling QWebEngineView::setPage.

                  I didn't get your suggestion. Ccould you help with a small example code please?

                  B Offline
                  B Offline
                  Bonnie
                  wrote on last edited by
                  #8

                  @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

                  1 Reply Last reply
                  1

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved