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

Make declaring the same property multiple times an error

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • P2: Important
    • 6.7
    • None
    • Build tools: moc
    • None

    Description

      If one declares the same Q_PROPERTY multiple times, moc limits itself to a warning. E.g.

      class Test : public QObject
      {
        Q_OBJECT
        Q_PROPERTY(int foo MEMBER m_foo);
        Q_PROPERTY(int foo MEMBER m_foo);
      
        int m_foo;
      };
      

      Results in moc warning:

      main.cpp:10:1: warning: The property 'foo' is defined multiple times in class Test.
      

      IMHO this should be a plain build error. There's no defined sematnics on what happens – which declaration "wins"? What if they conflict on which getters/setters to use?

      Attachments

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

        Activity

          People

            fabiankosmale Fabian Kosmale
            peppe Giuseppe D'Angelo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes