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

[MOC] moc can't find Q_OBJECT if it's wrapped in another macro

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 6.5.0
    • Build tools: moc
    • None
    • Windows

    Description

      The following code won't compile due to MOC can't find the Q_OBJECT macro:

      #include <QObject>
      
      #define MY_MACRO1 Q_CLASSINFO("test1", "1")
      #define MY_MACRO2 Q_CLASSINFO("test2", "2")
      #define TEST_MACRO \
        MY_MACRO1 \
        MY_MACRO2 \
        Q_OBJECT
      
      class Test : public QObject
      {
          TEST_MACRO
      public:
          explicit Test(QObject *parent = nullptr) : QObject(parent) {}
          ~Test() override {}
      };
      

      Attachments

        1. qtbug118665.tar.gz
          4 kB
        2. mocbug.7z
          0.9 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            fabiankosmale Fabian Kosmale
            wangwenx190 赵 宇航
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes