PDA

View Full Version : "ambiguous base" error



mhoover
13th June 2006, 22:46
Hi,

I'm porting a co-worker's code to Qt4. It controls a huge vat of great-tasting lemonade. I think great-tasting lemonade should be controlled by a great-looking GUI. That's why I'm going to Qt4.

It compiles great with Qt3, but when I use Qt4 I get this error:


lemonDiag.C:590: error: 'QObject' is an ambiguous base of 'CHWController'

The line causing the problem looks like this:


QObject::connect(hwc,SIGNAL(ph_off_balance(double) ),temp1A,SLOT(setValue(double)));

And the constructor looks like this:


class CHWController: public QObject, public QThread

Could the dual inheritance be a problem? Is there a simple fix?
What should I do?

jacek
13th June 2006, 22:52
In Qt4 QThread inherits QObject. In Qt3 it is a really bad idea to mix threads and signals.

mhoover
13th June 2006, 23:37
Oh ... Interesting.

So could I then declare his class without explicitly inheriting from QObject?


class CHWController: public QThread

Or would a more drastic solution be in order?

jacek
13th June 2006, 23:49
So could I then declare his class without explicitly inheriting from QObject?
Yes, because QObject is already there.