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

Name clash warning for enum class with the same named mebers

    XMLWordPrintable

Details

    • Windows

    Description

      After using of:

      Text {
        anchors.centerIn: parent
        text: qsTr("%1 %2").arg(Model.Type.Complex).arg(Model.Mode.Complex)
      }

      I get the warning:

      Previously registered enum will be overwritten due to name clash: Model.Complex
      Possible conflicting items:
          Model.Type.Complex from scope Model injected by Model
          Model.Mode.Complex from scope Model injected by Model
      

      for following enums:

      namespace Model {
      Q_NAMESPACE
      
      enum class Type {
          Simple,
          Complex,
      };
      Q_ENUM_NS(Type)
      
      enum class Mode {
          Normal,
          Super,
          Complex,
      };
      Q_ENUM_NS(Mode)
      
      } // namespace model
      
      

      See the full example in the attached application.

       

      Are enum class incorrectly supported, or can this warning mean something is wrong?

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              permotion88 Karol Polak
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes