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

Moc: Signals from parent class need to be redefined

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.10.0 Alpha
    • 5.0.1, 5.1.0
    • Build tools: moc
    • None
    • 2ca187caa383ddc0cdebeb1dbc312405c8c871ad

    Description

      In the following testcase, a compilation error arises when the signal is not redefined:
      "/home/caroline/testcases/moc/main.cpp:23: error: NOTIFY signal 'valueChanged' of property 'value' does not exist in class MyClassReadOnly."

      #include <QCoreApplication>
      
      class MyClass : public QObject
      {
          Q_OBJECT
          Q_PROPERTY(bool value READ getValue WRITE setValue NOTIFY valueChanged)
      public:
          MyClass() : m_value(true) {}
          bool getValue() const { return m_value; }
          void setValue(bool newValue) { m_value = newValue; }
      Q_SIGNALS:
          void valueChanged();
      private:
          bool m_value;
      };
      
      class MyClassReadOnly : public MyClass
      {
          Q_OBJECT
          Q_PROPERTY(bool value READ getValue NOTIFY valueChanged)
      Q_SIGNALS:
          //void valueChanged();
      };
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
          MyClassReadOnly w;
          return 0;
      }
      #include "main.moc"
      

      Attachments

        Issue Links

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

          Activity

            People

              ogoffart Olivier Goffart (Woboq GmbH)
              carochao Caroline Chao (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes