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

Class inside namespace with the same name confuses update

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Not Evaluated Not Evaluated
    • None
    • 6.9.0, 6.9.1, 6.9.2
    • Tools: Linguist
    • None
    • macOS

      This seems like a new issue in the 6.9 timeframe. Any time there's class with the same name as the enclosing namespace, lupdate reports a missing `Q_OBJECT` macro error even though the class does mention `Q_OBJECT`. Minimal sample code looks like:

      #include <QObject>
      
      namespace Test {
      class Test : public QObject {
        Q_OBJECT
      
      public:
        Test();
      };
      
      Test::Test() {
        setObjectName(tr("Test"));
      }
      }
      

      Running lupdate on this produces:

      $ ~/Qt/6.9.2/macos/bin/lupdate test.cpp
      lupdate warning: no TS files specified. Only diagnostics will be produced.
      test.cpp:12: Class 'Test' lacks Q_OBJECT macro

      Moving the call to `tr` inline or changing either the class or namespace name avoids the issue.

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

            kkohne Kai Köhne
            jasonhaslam Jason Haslam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes