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

QMetaObject: add overloads that take a view instead of `const char *`

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • Core: Other
    • None

    Description

      QTBUG-133234 talks about fixing build issues when QT_NO_CAST_FROM_BYTEARRAY is defined. A lot of places in qtdeclarative rely on the QByteArray -> `const char *` implicit conversion when calling QMetaObject's functions, indexOfProperty() and co.

      The build can be fixed by appending `.constData()` in those method calls, but that is a lot of churn. It would be simpler to add overloads to QMetaObect that take a view, then the build issues will disappear.

      There was a previous trial, see the chain starting with https://codereview.qt-project.org/c/qt/qtbase/+/514588, to add such overloads, but it got stuck on deciding which view type to use:

      • QByteArrayView: best candidate
      • QUtf8StringView: missing some API, e.g. indexOf(), so can be in the public API, but internally it'll have to be QBAV
      • QAnyStringView: can accept various types of strings, UTF16/8, but some developers thought it's overkill for QMetaObject, where the method names are typically ASCII and rarely Utf8

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-133235
          # Subject Branch Project Status CR V

          Activity

            People

              ahmad.samir Ahmad Samir
              ahmad.samir Ahmad Samir
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change