Solved Slots not added in moc file
-
Hi
It can be stale qmake cache.
Try to delete build folder and do rebuild all. -
i used clean build.
then i manualy delete the build directory! it didnt work as well -
@mahd96
Ok, if you make a default GUI project, and paste those slots to mainwindow and
their bodies to cpp. Is it still not included?
It could choke on something but your slots seem perfectly normal. -
Hi,
To add to @mrjj, can you post the complete class declaration ?
-
@mrjj
no its not GUI project.
every thing is fine with cpp an header file. Moc file is not being created correctly -
QObject::connect(&networkHandler,SIGNAL(replyReady(QByteArray)),this,SLOT(replyReady(QByteArray)));
QObject::connect(&networkHandler,SIGNAL(error()),this,SLOT(doError()));
QObject::connect(&networkHandler,SIGNAL(timeout()),this,SLOT(timeout()));retryTimer.setInterval(UploadRequest::RetryTimerInterval); retryTimer.setSingleShot(true); QObject::connect(&retryTimer,SIGNAL(timeout()),this,SLOT(retryTimerTimeout()));
//#######################################################################################
void UploadExistApi::replyReady(QByteArray array)
{
qDebug() << "UploadExistApi::replyReady | replyData: " << array;
if(!processResult(array))
{
doError();
}
}
//#######################################################################################
void UploadExistApi::timeout()
{
qDebug() << "UploadExistApi::timeout";
currentRequest.setIsTimeOut(true);
doError();
}
//#######################################################################################
void UploadExistApi::retryTimerTimeout()
{
startFileExist(currentRequest);
}//#######################################################################################
void UploadExistApi::doError()
{
if(currentRequest.getTries() >= UploadRequest::MaximumTriesCount)
{
qDebug() << "UploadExistApi::startFileExist | Maximum number of tries reached ";
currentFileInfo.clear();
currentRequest.clear();
emit error();
}
else
{
retryTimer.start();
}
} -
Hi
Just to be sure, you are still having a QApplication
calling a.exec() somewhere ? (in main)
Also, can you post your .pro file ? -
@mrjj said in Slots not added in moc file:
Also, can you post your .pro file ?
And you complete source/header also - where did you define your timer?
-
what do you mean by not added ? Is something not working for you ? On what basis are you telling that it is not added ? Did you open the moc_UploadExistingAPi file & verify ? Can you see the time stamp of this file ? If you use those slot, is slot getting called ? I saw that you are creating stack object of retryTimer. Hope the object is still is in scope.
You said last one is added. First three are added. By chance did some body kept the moc files somewhere else ? If last one is added, first three also should be added.
-
@mrjj @SGaist
I solved the issue by reinstalling msvc2015I recently installed Visual Studio 2017 and i had visual studio2015 in my pc. i think the were some kind of incompibality there that cause this issue.
i try to reset my windows and make a clean install of Visual studio(i need msvc compiler and windows kits) and it worked