Uploaded image for project: 'Qt Visual Studio Tools'
  1. Qt Visual Studio Tools
  2. QTVSADDINBUG-867

Header files not moc'ed if containing just Q_NAMESPACE/Q_ENUM_NS (without Q_OBJECT)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: Not Evaluated
    • Resolution: Unresolved
    • Affects Version/s: 2.7.0
    • Fix Version/s: None
    • Component/s: General
    • Labels:
      None
    • Environment:
      VS 2019 16.8.5
    • Platform/s:
      Windows

      Description

      If a  header file contains just an enum declaration:

      // my_enum.h
      
      namespace my_enum
      {
         Q_NAMESPACE
         enum class MyEnum
         {
            One,
            Two
         };
         Q_ENUM_NS(MyEnum)
      }
      

      it doesn't get moc'ed. If a dummy QObject class is be added, everything works as expected (seems like Q_OBJECT is the key):

      namespace my_enum {
        ...
        class Dummy : QObject
        {
          Q_OBJECT
        };
      }
      

       

        Attachments

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

          Activity

            People

            Assignee:
            mecfc Miguel Costa
            Reporter:
            rayx Ray Gray
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes