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

Moc parse issue with type name in global namespace

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.15.7
    • Build tools: moc
    • None

    Description

      if I declare in header:

      namespace my_namespace{
      class my_class{
      ...
      };
      
      class my_class2{
      signals:
        void my_signal(const ::my_namespace::my_class&);
      };
      }
      

      Add, register metatype:

      qRegisterMetatype<::my_namespace::my_class>("::my_namespace::my_class");
      

      But, when the program encountered a runtime error:

      Qt: Cannot queue arguments of type 'const::my_namespace::my_class&'
      

      This error didn't occur if I declare:

      ...
      signals:
      void my_signal(const my_namespace::my_class&);
      ...
      qRegisterMetatype<::my_namespace::my_class>("my_namespace::my_class");
      

      And I have checked the outcome file of MOC, I found if the declaration of argument type is

      const ::my_namespace::my_class&

      , the corresponding metatype name is (YES, NO space between const and ::my_namespace)

      "const::my_namespace::my_class"

      , when

      const my_namespace::my_class&

      is

      "my_namespace::my_class"

      (This satisfy Qt mechanism).

      Attachments

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

        Activity

          People

            fabiankosmale Fabian Kosmale
            alonelur WENHAN YIN
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes