Hi guys, I'm playing around with composition and inheritance for the first time and I'm hitting a bit of a problem.

From my understanding, to be able to have an object emit a signal and receive signals i.e. for that it must have slots, it must inherit QObject.

So I created my own class and included the Q_OBJECT macro:

Qt Code:
  1. class Button : public QObject
  2. {
  3. Q_OBJECT
To copy to clipboard, switch view to plain text mode 

However, I would also like this button to include other classes which outline the button position and other attributes in their own classes. When I created the initialiser list in the header file, the variables which I assigned to the Button members explicitly i.e. after the : symbol, spit out an error upon building...

'position' was not declared in this scope.
How do I solve this problem?

I tried simply adding my initialiser list after the

Qt Code:
  1. Button::Button(QObject *parent) :
  2. QObject(parent)
To copy to clipboard, switch view to plain text mode 

but that didn't work.