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

Enums declared in C++ base type

    XMLWordPrintable

Details

    • b7738beda651c2927e1a9d58c592148b1dc99576

    Description

      A common problem for controls is that when the business logic is implemented in a C++ "base" type and the visual parts in a QML "sub" type, enum values provided by the C++ type cannot be accessed by the QML type name.

      Example: a TextField control that inherits QQuickTextInput.

      // TextField.qml
      TextInput {
          id: control
          implicitWidth: ...
          implicitHeight: ...
          Rectangle {
              id: background
              z: -1
          }
      }
      

      Application code cannot use eg. TextField.Password but must use TextInput.Password instead:

      TextField {
          // echoMode: TextField.Password // "ReferenceError: TextField is not defined"
          // vs.
          echoMode: TextInput.Password // :(
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              jpnurmi J-P Nurmi
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes