Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-108649

make value types uncreatable with QML_UNCREATABLE

    XMLWordPrintable

Details

    Description

      This bug results from QTBUG-108612.

      QtWebEngine uses foreign types in form of:

      namespace ForeignWebEngineCertificateErrorNamespace
      {
          Q_NAMESPACE
          QML_FOREIGN_NAMESPACE(QWebEngineCertificateError)
          QML_NAMED_ELEMENT(WebEngineCertificateError)
          QML_ADDED_IN_VERSION(1, 1)
          QML_EXTRA_VERSION(2, 0)
      }
      

      which is used for example like:

        var handleCertificateError = function(error) {
                      if (deferError)
                          error.defer()
                      else if (acceptCertificate)
                          error.acceptCertificate()
                      else
                          error.rejectCertificate()
                  }
                  view.certificateError.connect(handleCertificateError)
      

      The issue that QWebEngineCertificateError has only a copy constructor , but it is used here as value type. This is not correct as value types should have a default constructor. We do not want to use anonymous qml elements as our classes need proper documentation, therefore qml elements have to stayed named.

      Instead we would like to use a value type which is QML_UNCREATABLE which would mean it can not be used as a property and it does not have a default constructor.

      property webEngineCertificateError myError
      

      This way we have value proper semantic , with value not instanceable by user , passed (copied) in various signal handlers.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtqmlteam Qt Qml Team User
              michal Michal Klocek
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes