[Qt-interest] Multiple Inheritance Ambiguity question for QT4?

Rob Frohne rob.frohne at wallawalla.edu
Sun Oct 3 08:43:09 CEST 2010


Thanks Paule,

That seems to have solved my dilemma.

Thanks so much!

Rob

On 10/02/2010 11:03 PM, slayer81 at gmx.de wrote:
> Hello!
>
> QThread inherits QObject, so you don't need to inherit both QObject and QThread in your class.
> Just write "class hamlibWrapper : QThread" and you should be able to use Slots and Signals.
>
> Greetings,
> Paule
>
>
> Am 03.10.2010 07:47:51, schrieb Rob Frohne<rob.frohne at wallawalla.edu>:
>
>    
>> Hi,
>>
>> I'm attempting to move some code I wrote for QT3 to QT4, and it appears
>> that I may have gotten away with something in QT3 that I should not be
>> doing. I think my problem is that I am trying to inherit from QObject so
>> I can use my own signals&  slots, and also from QThread, which itself
>> inherits from QObject, leading to an ambiguity. Here is my header file:
>>
>> class hamlibWrapper : public QObject, QThread
>> {
>> Q_OBJECT
>> public:
>> hamlibWrapper ( QWidget *parent=0, const char *name=0 );
>> ~hamlibWrapper();
>> int init ( rig_model_t, const char* port, int speed );
>> void run();
>> void setPause ( bool p );
>>
>> public slots:
>> void setMode ( rmode_t, pbwidth_t );
>> void pollSlopeTuning ( bool );
>> void useMuteXmit ( bool );
>>
>> private:
>> RIG* rRig;
>> double freq, getfreq;
>> bool shouldexit;
>> ptt_t transmit;
>> bool setmodes;
>> QMutex mutex;
>> freq_t getHardwareFrequency();
>> rmode_t mode;
>> rmode_t newMode;
>> pbwidth_t width;
>> pbwidth_t newWidth;
>> value_t slopeLowVal;
>> int slopeLow;
>> value_t slopeHighVal;
>> int slopeHigh;
>> vfo_t vfo;
>> bool useSlopeTuning;
>> bool muteOnXmit;
>>
>> signals: // Signals
>> void newFreq ( double );
>> void nowTransmit ( int );
>> void rigChangedMode ( rmode_t, bool );
>> void slopeLowChangedByRig ( int );
>> void slopeHighChangedByRig ( int );
>> void rigPitch ( int );
>> };
>>
>> and the warning I get is:
>>
>> /home/frohro/Projects/sdr-for-if-qt4/qtmerge/hamlibwrapper.h:35:
>> warning: direct base ‘QObject’ inaccessible in ‘hamlibWrapper’ due to
>> ambiguity
>>
>> Later I get errors resulting from this ambiguity:
>>
>> /home/frohro/Projects/sdr-for-if-qt4/qtmerge/hamlibwrapper.cpp:31:
>> error: reference to ‘connect’ is ambiguous
>>
>>      
> >from the connect lines of this code:
>    
>>
>> #include<string.h>
>> #include<stdlib.h>
>> #include<qapplication.h>
>> #include<math.h>
>>
>> #include "hamlibwrapper.h"
>>
>> hamlibWrapper::hamlibWrapper ( QWidget *parent, const char *name ) :
>> QObject ( parent, name )
>> {
>> rRig=NULL;
>> shouldexit = FALSE;
>> useSlopeTuning = FALSE;
>> rig_set_debug ( RIG_DEBUG_TRACE ); // RIG_DEBUG_NONE for none.
>> connect ( parent, SIGNAL ( changeRigMode ( rmode_t, pbwidth_t ) ), this,
>> SLOT ( setMode ( rmode_t, pbwidth_t ) ) );
>> connect ( parent, SIGNAL ( changeSlopeTune ( bool ) ), this, SLOT (
>> pollSlopeTuning ( bool ) ) );
>> connect ( parent, SIGNAL ( tellMuteXmit ( bool ) ), this, SLOT (
>> useMuteXmit ( bool ) ) );
>> }
>>
>> This code worked fine in QT3, but not in QT4. Can anyone give me some
>> advice?
>>
>> Thanks,
>>
>> Rob
>>
>> -- 
>> Rob Frohne, Ph.D., P.E.
>> E.F. Cross School of Engineering
>> Walla Walla University
>> 100 SW 4th Street
>> College Place, WA 99324
>> (509) 527-2075			 http://people.wallawalla.edu/~rob.frohne
>>
>>
>>      
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>    

-- 
Rob Frohne, Ph.D., P.E.
E.F. Cross School of Engineering
Walla Walla University
100 SW 4th Street
College Place, WA 99324
(509) 527-2075			 http://people.wallawalla.edu/~rob.frohne

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rob_frohne.vcf
Type: text/x-vcard
Size: 298 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101002/217118da/attachment.vcf 


More information about the Qt-interest-old mailing list