I am working on a class that has two parent classes:
GetSetInterface which derives QObject and QSpinBox(which derives QObject aswell) And I Call it SpinBoxInterface
class GetSetInterface : public QObject
class SpinBoxInterface : public QSpinBox, public GetSetInterface
In the constructor of SpinBoxInterface
I am trying to connect signal QSpinBox::valueChanged(int)
to the signal GetSetInterface::sendInfo(int, QVariant)
, and here comes a problem:
When I write (of course in SpinBoxInterface
class)
connect(this, QOverload<int>::of(&SpinBoxInterface::valueChanged), this, [=](int value){
emit sendInfo(TYPE_ANYCHANGE, value);
});
I Get an error non-static member 'connect' found in multiple base-class subobjects of type 'QObject'
,
However, when I write
GetSetInterface::connect(this, QOverload<int>::of(&SpinBoxInterface::valueChanged), this, [=](int value){
emit sendInfo(TYPE_ANYCHANGE, value);
});
I get an error
ambigious conversion from derived class 'AxisSpinBox' to base class 'const QObject'
. As long as I understand the first error ('connect found in multiple base-classes'), the second one feels weird, as GetSetInterface::connect has only one parent class, from where to get definition of connect - and it is only one QObject.
#define TYPE_ANYCHANGE 0
is used in a methods above