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

Enums declared in C++ base type

XMLWordPrintable

    • b7738beda651c2927e1a9d58c592148b1dc99576

      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 // :(
      }
      

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes