[Qt-interest] Slots in threads ?

Patric userqt at gmail.com
Thu Aug 27 19:33:28 CEST 2009


Hi John,
actually my connection is:

 connect(ui->gameBoard_Widget, SIGNAL(continueAuto()),
ui->gameWorld_Widget->getSimulationEngine(), SLOT(continueAuto()));


and the error is :

mainwindow.cpp: In constructor `MainWindow::MainWindow(QWidget*)':
mainwindow.cpp:35: error: no matching function for call to 
`MainWindow::connect(GameBoard*&, const char*, SimulationEngine*, const 
char*)'

c:/Qt/2009.03/qt/include/QtCore/../../src/corelib/kernel/qobject.h:202: 
note: candidates are: static bool QObject::connect(const QObject*, const 
char*, const QObject*, const char*, Qt::ConnectionType)

c:/Qt/2009.03/qt/include/QtCore/../../src/corelib/kernel/qobject.h:308: 
note: bool QObject::connect(const QObject*, const char*, const char*, 
Qt::ConnectionType) const



where the getSimulationEngine() returns a pointer, gameBoard_Widget is 
actually promoted widget and continueAuto() is slot in the thread. 
SimulationEngine is a thread.

Regards

----- Original Message ----- 
From: "John McClurkin" <jwm at nei.nih.gov>
To: <qt-interest at trolltech.com>
Sent: Thursday, August 27, 2009 8:09 PM
Subject: Re: [Qt-interest] Slots in threads ?


> Patric wrote:
>> Hello,
>> I have a little gui program with one worker thread. I want to stop and
>> start the thread from the gui. So I put some slots inside the thread.
>> But now I'm getting some errors on compilation :
>>
>>
>> mainwindow.cpp: In constructor `MainWindow::MainWindow(QWidget*)':
>>
>> mainwindow.cpp:35: error: no matching function for call to
>> `MainWindow::connect(Board*&, const char*, Engine*, const char*)'
> Do you really want this ^^^^^^ to be Board*&? A reference to a pointer?
> How about just a reference or just a pointer, ie Board& or Board*?
>
>>
>> c:/Qt/2009.03/qt/include/QtCore/../../src/corelib/kernel/qobject..h:202:
>> note: candidates are: static bool QObject::connect(const QObject*, const
>> char*, const QObject*, const char*, Qt::ConnectionType)
>>
>> c:/Qt/2009.03/qt/include/QtCore/../../src/corelib/kernel/qobject..h:308:
>> note: bool QObject::connect(const QObject*, const char*, const char*,
>> Qt::ConnectionType) const
>>
>>
>>
>> Am I allowed to put slots in threads ?
>>
>> Regards
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
> 




More information about the Qt-interest-old mailing list