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

Qt Remote Objects: Support enums in namespaces in .rep files

    XMLWordPrintable

Details

    Description

      Currently, ENUM{} can only be applied inside a class{}. Consequently, the enum is not accessible to other Sources and Replicas; the following .rep file produces a compilation error:

      class Aaa
      {
          ENUM Color{Blue=0, Red=1};
          PROP(Color colorOfA=Blue);
      };
      
      class Bbb
      {
          PROP(Aaa::Color colorOfB=Aaa::Red); // error: C2653: 'Aaa': is not a class or namespace name
      };
      

      This is because the generated C++ files contain AaaSource::Color and AaaReplica::Color.

       

      Suggestion

      Let REPC handle namespaces (and enums in namespaces). Take advantage of the existing Q_NAMESPACE and Q_ENUM_NS() macros (https://doc.qt.io/qt-6/qobject.html#Q_ENUM_NS ) to support constructs like this:

      namespace NS
      {
          ENUM Color{Blue=0, Red=1};
      }
      
      class Aaa
      {
          PROP(NS::Color colorOfA=NS::Blue);
      };
      
      class Bbb
      {
          PROP(NS::Color colorOfB=NS::Red);
      };
      

      This should be easy to add, since the namespace can have the same name on both the Source and Replica side (like a POD/Q_GADGET)

      Attachments

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

        Activity

          People

            bstottle Brett Stottlemyer
            skoh-qt Sze Howe Koh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes