[Interest] Q_PROPERTY, Subclass and calling SuperClasses signal

Michael Jackson imikejackson at gmail.com
Thu Feb 27 17:24:19 CET 2014


I am trying to make sure I truly understand the Signals/Slots mechanism because this once has me a bit stumped. I _think_ what I am trying is legal but maybe not. Best is an example:

class A : public QObject {
 Q_OBJECT

….
signals:
    void parametersChanged();
….
};


class AlignSectionsFeatureCentroid : public A {
  Q_OBJECT

 public:
   void set ReferenceSlice(int value) { emit parametersChanged(); }
   int get ReferenceSlice();
   Q_PROPERTY(int ReferenceSlice READ get ReferenceSlice WRITE set ReferenceSlice NOTIFY parametersChanged)
….

};

when I compile this I get a compile error similar to this (error taken straight from my project)


SectionsFeatureCentroid.h:118: Error: NOTIFY signal 'parametersChanged' of property 'ReferenceSlice' does not exist in class AlignSectionsFeatureCentroid.
AUTOMOC: error: process for moc_AlignSectionsFeatureCentroid.cpp failed:
AlignSectionsFeatureCentroid.h:118: Error: NOTIFY signal 'parametersChanged' of property 'ReferenceSlice' does not exist in class AlignSectionsFeatureCentroid.


But if I define the signals in the subclass then at runtime I get a warning about the subclass over riding the superclass's signals.


What is the correct answer here?

Thanks
Mike Jackson
dream3d.bluequartz.net


More information about the Interest mailing list