PDA

View Full Version : abstract custome QWidget class



migel
12th July 2011, 09:31
I need to make custome QWidget class and make some kind of helper class, how to do it properly



class MyWidget : public QWidget, public MyHelper

The point is that I need to inherit public QObject in MyHelper to have the parent object available. When I will do it compiler complains


error: 'QObject' is an ambiguous base of 'ListView'


When I take this out


error: type 'QObject' is not a direct base of 'MyHelper'

and


warning: Class MyObject inherits from two QObject subclasses MyHelper and QWidget. This is not supported!


error: Class contains Q_OBJECT macro but does not inherit from QObject

Is it possible ?

mcosta
12th July 2011, 09:41
You cannot use multiple inheritance of QObject.

Try using composition.