Qt-interest Archive, October 2006
reference to connect is ambigious
Message 1 in thread
Hi to all,
sorry if this is more like a general C++ question but since it appears in context with Qt I'll give it a try here :
One class I have inherits from QWidget and QThread.
When I'm using the connect - command to link signals to slots I get the following error :
statistics.cpp:51: error: reference to `connect' is ambiguous
C:/qt-win-opensource-src-4.1.1-snapshot-20060127/qt-win-opensource-src-4.1.1-snapshot-20060127/include/QtCore/qobject.h:275: error: candidates are: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const C:/qt-win-opensource-src-4.1.1-snapshot-20060127/qt-win-opensource-src-4.1.1-snapshot-20060127/include/QtCore/qobject.h:174: error: candidates are: static bool
QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType) C:/qt-win-opensource-src-4.1.1-snapshot-20060127/qt-win-opensource-src-4.1.1-snapshot-20060127/include/QtCore/qobject.h:275:
error: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const C:/qt-win-opensource-src-4.1.1-snapshot-20060127/qt-win-opensource-src-4.1.1-snapshot-20060127/include/QtCore/qobject.h:174: error: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)
This doesn't happen when not inheriting from QThread just with QWidget alone.
Can anyone say how to prevent that ?
Thanks
-- A l e x
--
[ signature omitted ]
Message 2 in thread
Hi,
> sorry if this is more like a general C++ question but since it appears in context with Qt I'll give it a try here :
Actually this *is* a Qt question :-)
> One class I have inherits from QWidget and QThread.
This will not work:
http://doc.trolltech.com/4.2/moc.html#limitations
You cannot inherit more than one QObject class.
--
[ signature omitted ]
Message 3 in thread
I see. MMhhh - so what do you actually recommend when I need QThread and QWidget. When I cannot inherit from both is there a different way to implement it ?
Thanks in advance
-- A l e x
-------- Original-Nachricht --------
Datum: Mon, 16 Oct 2006 22:27:12 +0200
Von: Dimitri <dimitri@xxxxxxxxxxxxx>
An: qt-interest@xxxxxxxxxxxxx
Betreff: Re: reference to connect is ambigious
> Hi,
>
> > sorry if this is more like a general C++ question but since it appears
> in context with Qt I'll give it a try here :
>
> Actually this *is* a Qt question :-)
>
> > One class I have inherits from QWidget and QThread.
>
> This will not work:
> http://doc.trolltech.com/4.2/moc.html#limitations
> You cannot inherit more than one QObject class.
>
> --
> Dimitri
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]
Message 4 in thread
Alexander Carôt wrote:
> I see. MMhhh - so what do you actually recommend when I need QThread and QWidget. When I cannot inherit from both is there a different way to implement it ?
>
> Thanks in advance
>
> -- A l e x
>
>
You can't mix QWidgets with threads -- QWidgets are not reentrant.
Read this: http://doc.trolltech.com/4.2/threads.html
Paul
--
[ signature omitted ]
Message 5 in thread
Paul Koshevoy wrote:
> Alexander Carôt wrote:
>
>> I see. MMhhh - so what do you actually recommend when I need QThread and QWidget. When I cannot inherit from both is there a different way to implement it ?
>>
>> Thanks in advance
>>
>> -- A l e x
>>
>>
>>
> You can't mix QWidgets with threads -- QWidgets are not reentrant.
> Read this: http://doc.trolltech.com/4.2/threads.html
>
> Paul
>
>
Although, your subclass of the QWidget can own any number of QThreads
-- perhaps this is what you are after.
Paul.
--
[ signature omitted ]